summaryrefslogtreecommitdiffstats
path: root/frontends/php
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-11-21 14:17:43 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-11-21 14:17:43 +0000
commite46ef00fc9b5b1636e2428bf7ef4201e81420e14 (patch)
tree4cdbe9a9f64efd480f7fe21668d0f7ec8b2dfe12 /frontends/php
parent5df2ecce7fdd320a56d91cf07abfd21d4c15ac50 (diff)
downloadzabbix-e46ef00fc9b5b1636e2428bf7ef4201e81420e14.tar.gz
zabbix-e46ef00fc9b5b1636e2428bf7ef4201e81420e14.tar.xz
zabbix-e46ef00fc9b5b1636e2428bf7ef4201e81420e14.zip
- [DEV-45] merged rev. 5079:5083 of branches/1.4.j/ (Artem) [changes in configuration of events, DB changes: [config.ack_enable -> config.event_ack_enable; config.ack_expire -> config.event_expire;], added new field: [config.event_show_max]]
git-svn-id: svn://svn.zabbix.com/trunk@5084 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
-rw-r--r--frontends/php/config.php23
-rw-r--r--frontends/php/include/config.inc.php14
-rw-r--r--frontends/php/include/forms.inc.php13
-rw-r--r--frontends/php/include/locales/en_gb.inc.php2
-rw-r--r--frontends/php/tr_status.php46
5 files changed, 56 insertions, 42 deletions
diff --git a/frontends/php/config.php b/frontends/php/config.php
index b780242d..04794a19 100644
--- a/frontends/php/config.php
+++ b/frontends/php/config.php
@@ -62,8 +62,9 @@ include_once "include/page_header.php";
"delete"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL),
"cancel"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL),
/* acknowledges */
- 'ack_enable'=> array(T_ZBX_INT, O_OPT, P_SYS|P_ACT, IN("0,1"), 'isset({config})&&({config}==8)&&isset({save})'),
- 'ack_expire'=> array(T_ZBX_INT, O_OPT, P_SYS|P_ACT, BETWEEN(1,65535), 'isset({config})&&({config}==8)&&isset({save})'),
+ 'event_ack_enable'=> array(T_ZBX_INT, O_OPT, P_SYS|P_ACT, IN("0,1"), 'isset({config})&&({config}==8)&&isset({save})'),
+ 'event_expire'=> array(T_ZBX_INT, O_OPT, P_SYS|P_ACT, BETWEEN(1,65535), 'isset({config})&&({config}==8)&&isset({save})'),
+ 'event_show_max'=> array(T_ZBX_INT, O_OPT, P_SYS|P_ACT, BETWEEN(1,65535), 'isset({config})&&({config}==8)&&isset({save})'),
/* other */
"form"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL),
"form_refresh"=> array(T_ZBX_INT, O_OPT, NULL, NULL, NULL)
@@ -137,8 +138,9 @@ include_once "include/page_header.php";
get_request('refresh_unsupported'),
get_request('work_period'),
get_request('alert_usrgrpid'),
- get_request('ack_enable'),
- get_request('ack_expire')
+ get_request('event_ack_enable'),
+ get_request('event_expire'),
+ get_request('event_show_max')
);
show_messages($result, S_CONFIGURATION_UPDATED, S_CONFIGURATION_WAS_NOT_UPDATED);
@@ -146,10 +148,12 @@ include_once "include/page_header.php";
if($result)
{
$msg = array();
- if(!is_null($val = get_request('ack_enable')))
+ if(!is_null($val = get_request('event_ack_enable')))
$msg[] = S_EVENT_ACKNOWLEDGES.' ['.($val?(S_DISABLED):(S_ENABLED)).']';
- if(!is_null($val = get_request('ack_expire')))
+ if(!is_null($val = get_request('event_expire')))
$msg[] = S_SHOW_EVENTS_NOT_OLDER.SPACE.'('.S_DAYS.')'.' ['.$val.']';
+ if(!is_null($val = get_request('event_show_max')))
+ $msg[] = S_SHOW_EVENTS_MAX.' ['.$val.']';
add_audit(AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_ZABBIX_CONFIG,implode('; ',$msg));
}
@@ -167,8 +171,9 @@ include_once "include/page_header.php";
get_request('refresh_unsupported'),
get_request('work_period'),
get_request('alert_usrgrpid'),
- get_request('ack_enable'),
- get_request('ack_expire')
+ get_request('event_ack_enable'),
+ get_request('event_expire'),
+ get_request('event_show_max')
);
show_messages($result, S_CONFIGURATION_UPDATED, S_CONFIGURATION_WAS_NOT_UPDATED);
@@ -286,13 +291,13 @@ include_once "include/page_header.php";
$form = new CForm("config.php");
$form->SetMethod('get');
$cmbConfig = new CCombobox("config",$_REQUEST["config"],"submit()");
+ $cmbConfig->AddItem(8,S_EVENTS);
$cmbConfig->AddItem(0,S_HOUSEKEEPER);
// $cmbConfig->AddItem(2,S_ESCALATION_RULES);
$cmbConfig->AddItem(3,S_IMAGES);
// $cmbConfig->AddItem(4,S_AUTOREGISTRATION);
$cmbConfig->AddItem(6,S_VALUE_MAPPING);
$cmbConfig->AddItem(7,S_WORKING_TIME);
- $cmbConfig->AddItem(8,S_ACKNOWLEDGES);
$cmbConfig->AddItem(5,S_OTHER);
$form->AddItem($cmbConfig);
switch($_REQUEST["config"])
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index 0d339385..52d69e90 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -1006,7 +1006,7 @@ function TODO($msg) { echo "TODO: ".$msg.BR; } // DEBUG INFO!!!
# Update configuration
- function update_config($event_history,$alert_history,$refresh_unsupported,$work_period,$alert_usrgrpid,$ack_enable,$ack_expire)
+ function update_config($event_history,$alert_history,$refresh_unsupported,$work_period,$alert_usrgrpid,$event_ack_enable,$event_expire,$event_show_max)
{
$update = array();
@@ -1040,13 +1040,17 @@ function TODO($msg) { echo "TODO: ".$msg.BR; } // DEBUG INFO!!!
}
$update[] = 'alert_usrgrpid='.$alert_usrgrpid;
}
- if(!is_null($ack_enable))
+ if(!is_null($event_ack_enable))
{
- $update[] = 'ack_enable='.$ack_enable;
+ $update[] = 'event_ack_enable='.$event_ack_enable;
}
- if(!is_null($ack_expire))
+ if(!is_null($event_expire))
{
- $update[] = 'ack_expire='.$ack_expire;
+ $update[] = 'event_expire='.$event_expire;
+ }
+ if(!is_null($event_show_max))
+ {
+ $update[] = 'event_show_max='.$event_show_max;
}
if(count($update) == 0)
{
diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php
index f4858ddd..484fad75 100644
--- a/frontends/php/include/forms.inc.php
+++ b/frontends/php/include/forms.inc.php
@@ -4064,19 +4064,22 @@ include_once 'include/discovery.inc.php';
{
$config=select_config();
- $frmEventAck = new CFormTable(S_ACKNOWLEDGES,"config.php");
+ $frmEventAck = new CFormTable(S_EVENTS,"config.php");
// $frmEventAck->SetHelp("web.config.workperiod.php");
$frmEventAck->AddVar("config",get_request("config",8));
- $exp_select = new CComboBox('ack_enable');
+ $exp_select = new CComboBox('event_ack_enable');
- $exp_select->AddItem(EVENT_ACK_ENABLED,S_ENABLED,$config['ack_enable']?'yes':'no');
- $exp_select->AddItem(EVENT_ACK_DISABLED,S_DISABLED,$config['ack_enable']?'no':'yes');
+ $exp_select->AddItem(EVENT_ACK_ENABLED,S_ENABLED,$config['event_ack_enable']?'yes':'no');
+ $exp_select->AddItem(EVENT_ACK_DISABLED,S_DISABLED,$config['event_ack_enable']?'no':'yes');
$frmEventAck->AddRow(S_EVENT_ACKNOWLEDGES,$exp_select);
$frmEventAck->AddRow(S_SHOW_EVENTS_NOT_OLDER.SPACE.'('.S_DAYS.')',
- new CTextBox('ack_expire',$config['ack_expire'],5));
+ new CTextBox('event_expire',$config['event_expire'],5));
+
+ $frmEventAck->AddRow(S_MAX_COUNT_OF_EVENTS,
+ new CTextBox('event_show_max',$config['event_show_max'],5));
$frmEventAck->AddItemToBottomRow(new CButton("save",S_SAVE));
$frmEventAck->Show();
diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php
index 2580568f..145dd274 100644
--- a/frontends/php/include/locales/en_gb.inc.php
+++ b/frontends/php/include/locales/en_gb.inc.php
@@ -374,6 +374,8 @@
'S_EVENT_ACKNOWLEDGES'=> 'Event acknowledges',
'S_DAYS'=> 'Days',
'S_SHOW_EVENTS_NOT_OLDER'=> 'Show events not older',
+ 'S_SHOW_EVENTS_MAX'=> 'Show events max',
+ 'S_MAX_COUNT_OF_EVENTS'=> 'Max count of events per trigger to show',
'S_CANNNOT_UPDATE_VALUE_MAP'=> 'Cannot update value map',
'S_VALUE_MAP_ADDED'=> 'Value map added',
'S_CANNNOT_ADD_VALUE_MAP'=> 'Cannot add value map',
diff --git a/frontends/php/tr_status.php b/frontends/php/tr_status.php
index 1db8e4f6..ad63796a 100644
--- a/frontends/php/tr_status.php
+++ b/frontends/php/tr_status.php
@@ -149,7 +149,7 @@ include_once "include/page_header.php";
$show_events = EVENTS_OPTION_NOFALSEFORB;
}
- if(!$config['ack_enable'] && (($show_events != EVENTS_OPTION_NOEVENT) || ($show_events != EVENTS_OPTION_ALL))){
+ if(!$config['event_ack_enable'] && (($show_events != EVENTS_OPTION_NOEVENT) || ($show_events != EVENTS_OPTION_ALL))){
$show_events = EVENTS_OPTION_NOEVENT;
}
?>
@@ -260,7 +260,7 @@ include_once "include/page_header.php";
if(TRIGGERS_OPTION_ALL){
$tr_select->Additem(TRIGGERS_OPTION_ALL,S_SHOW_ALL,(TRIGGERS_OPTION_ALL==$show_triggers)?'yes':'no');
}
- if(TRIGGERS_OPTION_NOFALSEFORB){
+ if(TRIGGERS_OPTION_NOFALSEFORB && $config['event_ack_enable']){
$tr_select->Additem(TRIGGERS_OPTION_NOFALSEFORB,S_SHOW_NOFALSEFORB,(TRIGGERS_OPTION_NOFALSEFORB==$show_triggers)?'yes':'no');
}
@@ -269,13 +269,13 @@ include_once "include/page_header.php";
$ev_select->Additem(EVENTS_OPTION_NOEVENT,S_HIDE_ALL,(EVENTS_OPTION_NOEVENT==$show_events)?'yes':'no');
}
if(EVENTS_OPTION_ALL){
- $ev_select->Additem(EVENTS_OPTION_ALL,S_SHOW_ALL.SPACE.'('.$config['ack_expire'].SPACE.(($config['ack_expire']>1)?S_DAYS:S_DAY).')',(EVENTS_OPTION_ALL==$show_events)?'yes':'no');
+ $ev_select->Additem(EVENTS_OPTION_ALL,S_SHOW_ALL.SPACE.'('.$config['event_expire'].SPACE.(($config['event_expire']>1)?S_DAYS:S_DAY).')',(EVENTS_OPTION_ALL==$show_events)?'yes':'no');
}
- if(EVENTS_OPTION_NOT_ACK && $config['ack_enable']){
- $ev_select->Additem(EVENTS_OPTION_NOT_ACK,S_SHOW_UNACKNOWLEDGED.SPACE.'('.$config['ack_expire'].SPACE.(($config['ack_expire']>1)?S_DAYS:S_DAY).')',(EVENTS_OPTION_NOT_ACK==$show_events)?'yes':'no');
+ if(EVENTS_OPTION_NOT_ACK && $config['event_ack_enable']){
+ $ev_select->Additem(EVENTS_OPTION_NOT_ACK,S_SHOW_UNACKNOWLEDGED.SPACE.'('.$config['event_expire'].SPACE.(($config['event_expire']>1)?S_DAYS:S_DAY).')',(EVENTS_OPTION_NOT_ACK==$show_events)?'yes':'no');
}
- if(EVENTS_OPTION_ONLYTRUE_NOTACK && $config['ack_enable']){
- $ev_select->Additem(EVENTS_OPTION_ONLYTRUE_NOTACK,S_SHOW_TRUE_UNACKNOWLEDGED.SPACE.'('.$config['ack_expire'].SPACE.(($config['ack_expire']>1)?S_DAYS:S_DAY).')',(EVENTS_OPTION_ONLYTRUE_NOTACK==$show_events)?'yes':'no');
+ if(EVENTS_OPTION_ONLYTRUE_NOTACK && $config['event_ack_enable']){
+ $ev_select->Additem(EVENTS_OPTION_ONLYTRUE_NOTACK,S_SHOW_TRUE_UNACKNOWLEDGED.SPACE.'('.$config['event_expire'].SPACE.(($config['event_expire']>1)?S_DAYS:S_DAY).')',(EVENTS_OPTION_ONLYTRUE_NOTACK==$show_events)?'yes':'no');
}
//------- JP -------
if($show_triggers==TRIGGERS_OPTION_NOFALSEFORB){
@@ -349,13 +349,13 @@ include_once "include/page_header.php";
$table->SetHeader(array(
is_show_subnodes() ? make_sorting_link(S_NODE,'h.hostid') : null,
$_REQUEST["hostid"] >0 ? null : make_sorting_link(S_HOST,'h.host'),
- ($config['ack_enable'])?(new CCheckBox("all_events",false, "CheckAll('".$m_form->GetName()."','all_events','events');")): NULL,
+ ($config['event_ack_enable'])?(new CCheckBox("all_events",false, "CheckAll('".$m_form->GetName()."','all_events','events');")): NULL,
make_sorting_link(S_NAME,'t.description'),
S_STATUS,
make_sorting_link(S_SEVERITY,'t.priority'),
make_sorting_link(S_LAST_CHANGE,'t.lastchange'),
($noactions!='true')?S_ACTIONS:NULL,
- ($config['ack_enable'])? S_ACKNOWLEDGED : NULL,
+ ($config['event_ack_enable'])? S_ACKNOWLEDGED : NULL,
S_COMMENTS
));
@@ -392,16 +392,16 @@ include_once "include/page_header.php";
if(trigger_dependent($row["triggerid"])) continue;
$cond = '';
- $ack_expire = ($config['ack_expire']*86400); // days
+ $event_expire = ($config['event_expire']*86400); // days
switch($show_events){
case EVENTS_OPTION_ALL:
- $cond.=' AND (('.time().'-e.clock)<'.$ack_expire.')';
+ $cond.=' AND (('.time().'-e.clock)<'.$event_expire.')';
break;
case EVENTS_OPTION_NOT_ACK:
- $cond.=' AND (('.time().'-e.clock)<'.$ack_expire.') AND e.acknowledged=0 ';
+ $cond.=' AND (('.time().'-e.clock)<'.$event_expire.') AND e.acknowledged=0 ';
break;
case EVENTS_OPTION_ONLYTRUE_NOTACK:
- $cond.=' AND (('.time().'-e.clock)<'.$ack_expire.') AND e.acknowledged=0 AND e.value='.TRIGGER_VALUE_TRUE;
+ $cond.=' AND (('.time().'-e.clock)<'.$event_expire.') AND e.acknowledged=0 AND e.value='.TRIGGER_VALUE_TRUE;
break;
case EVENTS_OPTION_NOFALSEFORB:
// $cond.=' AND (('.time().'-e.clock)<'.(86400*16).') AND e.acknowledged=0 AND ((e.value='.TRIGGER_VALUE_TRUE.') OR ((e.value='.TRIGGER_VALUE_FALSE.') AND t.type='.TRIGGER_MULT_EVENT_DISABLED.'))';
@@ -479,10 +479,7 @@ include_once "include/page_header.php";
$actions=array(
new CLink(S_CHANGE,'triggers.php?form=update&triggerid='.$row["triggerid"].url_param('hostid'),"action"));
}
-
- $ack='-';
-
-
+
$host = null;
if($_REQUEST['hostid'] < 1){
$menus = '';
@@ -505,7 +502,7 @@ include_once "include/page_header.php";
$table->AddRow(array(
get_node_name_by_elid($row['triggerid']),
$host,
- ($config['ack_enable'])?SPACE:NULL,
+ ($config['event_ack_enable'])?SPACE:NULL,
$description,
$value,
new CCol(
@@ -515,10 +512,11 @@ include_once "include/page_header.php";
// SPACE,
new CLink(zbx_date2str(S_DATE_FORMAT_YMDHMS,$row["lastchange"]),"tr_events.php?triggerid=".$row["triggerid"],"action"),
$actions,
- ($config['ack_enable'])?$ack:NULL,
+ ($config['event_ack_enable'])?SPACE:NULL,
new CLink(($row["comments"] == "") ? S_ADD : S_SHOW,"tr_comments.php?triggerid=".$row["triggerid"],"action")
));
+ $event_limit=0;
$res_events = DBSelect($event_sql);
while($row_event=DBfetch($res_events)){
@@ -528,7 +526,7 @@ include_once "include/page_header.php";
$value = new CSpan(trigger_value2str($row_event['value']), get_trigger_value_style($row_event['value']));
- if($config['ack_enable']){
+ if($config['event_ack_enable']){
if($row_event['acknowledged'] == 1)
{
$acks_cnt = DBfetch(DBselect('SELECT COUNT(*) as cnt FROM acknowledges WHERE eventid='.$row_event['eventid']));
@@ -562,7 +560,7 @@ include_once "include/page_header.php";
$table->AddRow(array(
get_node_name_by_elid($row['triggerid']),
$host,
- ($config['ack_enable'])?(($row_event['acknowledged'] == 1)?(SPACE):(new CCheckBox('events['.$row_event['eventid'].']', 'no',NULL,$row_event['eventid']))):NULL,
+ ($config['event_ack_enable'])?(($row_event['acknowledged'] == 1)?(SPACE):(new CCheckBox('events['.$row_event['eventid'].']', 'no',NULL,$row_event['eventid']))):NULL,
$description,
$value,
new CCol(
@@ -571,9 +569,11 @@ include_once "include/page_header.php";
),
new CLink(zbx_date2str(S_DATE_FORMAT_YMDHMS,$row_event['clock']),"tr_events.php?triggerid=".$row["triggerid"],"action"),
$actions,
- ($config['ack_enable'])?(new CCol($ack,"center")):NULL,
+ ($config['event_ack_enable'])?(new CCol($ack,"center")):NULL,
new CLink(($row["comments"] == "") ? S_ADD : S_SHOW,"tr_comments.php?triggerid=".$row["triggerid"],"action")
));
+ $event_limit++;
+ if($event_limit >= $config['event_show_max']) break;
}
unset($row,$description, $actions);
@@ -584,7 +584,7 @@ include_once "include/page_header.php";
$m_form->Additem(get_table_header(array(S_TOTAL.": ",
$table->GetNumRows(),
SPACE.SPACE.SPACE,
- ($config['ack_enable'])?(new CButton('bulkacknowledge',S_BULK_ACKNOWLEDGE,'javascript: submit();')):(SPACE)
+ ($config['event_ack_enable'])?(new CButton('bulkacknowledge',S_BULK_ACKNOWLEDGE,'javascript: submit();')):(SPACE)
)));
$m_form->Show();