summaryrefslogtreecommitdiffstats
path: root/frontends/php
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-10-12 09:16:34 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-10-12 09:16:34 +0000
commitcc3ab52e16eb4c908f69f23b159293df6bac3f23 (patch)
treec5d8acb73eef41594c3b90ec42b43d85f206fcc7 /frontends/php
parent95036b5d466fb31448afc4c429968ee2fe64ba5e (diff)
downloadzabbix-cc3ab52e16eb4c908f69f23b159293df6bac3f23.tar.gz
zabbix-cc3ab52e16eb4c908f69f23b159293df6bac3f23.tar.xz
zabbix-cc3ab52e16eb4c908f69f23b159293df6bac3f23.zip
- [DEV-45][DEV-47] merged rev. 4859:4861,4864:4865 of branches/1.4.j/ (Artem) [changed design of status of Trigger screen, added bulk acknowledge]
git-svn-id: svn://svn.zabbix.com/trunk@4866 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
-rw-r--r--frontends/php/acknow.php136
-rw-r--r--frontends/php/config.php43
-rw-r--r--frontends/php/include/config.inc.php10
-rw-r--r--frontends/php/include/defines.inc.php33
-rw-r--r--frontends/php/include/forms.inc.php52
-rw-r--r--frontends/php/include/locales/en_gb.inc.php56
-rw-r--r--frontends/php/include/triggers.inc.php16
-rw-r--r--frontends/php/tr_status.php337
-rw-r--r--frontends/php/triggers.php18
9 files changed, 502 insertions, 199 deletions
diff --git a/frontends/php/acknow.php b/frontends/php/acknow.php
index b6006fcf..7ffaf5bd 100644
--- a/frontends/php/acknow.php
+++ b/frontends/php/acknow.php
@@ -31,38 +31,76 @@ include_once "include/page_header.php";
?>
<?php
-// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
+// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields=array(
- "eventid"=> array(T_ZBX_INT, O_MAND, P_SYS, DB_ID, NULL),
- "message"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({save})||isset({saveandreturn})'),
+ 'eventid'=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, '!isset({events})&&!isset({cancel})'),
+ 'events'=> array(T_ZBX_INT, O_OPT, null, DB_ID, '!isset({eventid})&&!isset({cancel})'),
+ 'message'=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({save})||isset({saveandreturn})'),
/* actions */
+ 'bulkacknowledge'=> array(T_ZBX_STR,O_OPT, P_ACT|P_SYS, NULL, NULL),
"saveandreturn" => array(T_ZBX_STR,O_OPT, P_ACT|P_SYS, NULL, NULL),
"save"=> array(T_ZBX_STR,O_OPT, P_ACT|P_SYS, NULL, NULL),
"cancel"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, null, null)
);
check_fields($fields);
+
+ $bulk = isset($_REQUEST['bulkacknowledge']);
+
+ if(isset($_REQUEST['eventid'])){
+ $events[$_REQUEST['eventid']] = $_REQUEST['eventid'];
+ }
+ else{
+ $events = $_REQUEST['events'];
+ }
+
+//$bulk = (count($events) > 1);
?>
<?php
$denyed_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY, PERM_MODE_LT);
- if(! ($db_data = DBfetch(DBselect('select distinct e.*,t.triggerid,t.expression,t.description,t.expression,h.host,h.hostid '.
- ' from hosts h, items i, functions f, events e, triggers t'.
- ' where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=t.triggerid and e.eventid='.$_REQUEST["eventid"].
- ' and i.hostid not in ('.$denyed_hosts.') and e.objectid=t.triggerid and e.object='.EVENT_OBJECT_TRIGGER.
- ' and '.DBin_node('e.eventid')
- ))))
- {
+ $eventids = '';
+ foreach($events as $id => $eventid){
+ $eventids.= $id.',';
+ }
+ $eventids = trim($eventids,',');
+
+ $db_data = DBfetch(DBselect('SELECT COUNT(DISTINCT e.eventid) as cnt'.
+ ' FROM hosts h, items i, functions f, events e, triggers t'.
+ ' WHERE h.hostid=i.hostid '.
+ ' AND i.itemid=f.itemid '.
+ ' AND f.triggerid=t.triggerid '.
+ ' AND e.eventid in ('.$eventids.') '.
+ ' AND i.hostid not in ('.$denyed_hosts.') '.
+ ' AND e.objectid=t.triggerid '.
+ ' AND e.object='.EVENT_OBJECT_TRIGGER.
+ ' AND '.DBin_node('e.eventid')
+ ));
+
+ if($db_data['cnt'] != count($events)){
access_deny();
}
+
+ $db_data = DBfetch(DBselect('SELECT DISTINCT e.*,t.triggerid,t.expression,t.description,t.expression,h.host,h.hostid '.
+ ' FROM hosts h, items i, functions f, events e, triggers t'.
+ ' WHERE h.hostid=i.hostid '.
+ ' AND i.itemid=f.itemid '.
+ ' AND f.triggerid=t.triggerid '.
+ ' AND e.eventid in ('.$eventids.') '.
+ ' AND i.hostid not in ('.$denyed_hosts.') '.
+ ' AND e.objectid=t.triggerid '.
+ ' AND e.object='.EVENT_OBJECT_TRIGGER.
+ ' AND '.DBin_node('e.eventid')
+ ));
+
unset($denyed_hosts);
- if(isset($_REQUEST["save"]))
+ if(isset($_REQUEST['save']) && !$bulk)
{
$result = add_acknowledge_coment(
- $db_data["eventid"],
- $USER_DETAILS["userid"],
- $_REQUEST["message"]);
+ $db_data['eventid'],
+ $USER_DETAILS['userid'],
+ $_REQUEST['message']);
show_messages($result, S_COMMENT_ADDED, S_CANNOT_ADD_COMMENT);
if($result)
@@ -74,56 +112,60 @@ include_once "include/page_header.php";
}
else if(isset($_REQUEST["saveandreturn"]))
{
- $result = add_acknowledge_coment(
- $db_data["eventid"],
- $USER_DETAILS["userid"],
- $_REQUEST["message"]);
+ $result = true;
+ $_REQUEST['message'] .= ($bulk)?("\n\r".S_SYS_BULK_ACKNOWLEDGE):('');
+
+ foreach($events as $id => $eventid){
+ $result &= add_acknowledge_coment(
+ $eventid,
+ $USER_DETAILS['userid'],
+ $_REQUEST['message']);
+ }
- if($result)
- {
+ if($result){
add_audit(AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_TRIGGER, S_ACKNOWLEDGE_ADDED.
- ' ['.expand_trigger_description_by_data($db_data).']'.
- ' ['.$_REQUEST["message"].']');
+ ' ['.($bulk)?(' BULK ACKNOWLEDGE '):(expand_trigger_description_by_data($db_data)).']'.
+ ' ['.$_REQUEST['message'].']');
}
Redirect('tr_status.php?hostid='.get_profile('web.tr_status.hostid',0));
exit;
}
- else if(isset($_REQUEST["cancel"]))
- {
+ else if(isset($_REQUEST['cancel'])){
Redirect('tr_status.php?hostid='.get_profile('web.tr_status.hostid',0));
exit;
}
?>
<?php
- show_table_header(S_ALARM_ACKNOWLEDGES_BIG." : ".
- "\"".expand_trigger_description_by_data($db_data)."\"".BR.
- explode_exp($db_data["expression"],1));
+ $msg=($bulk)?(' BULK ACKNOWLEDGE '):('"'.expand_trigger_description_by_data($db_data).'"'.BR.explode_exp($db_data["expression"],1));
+ show_table_header(S_ALARM_ACKNOWLEDGES_BIG." : ".$msg);
echo BR;
- $table = new CTable(NULL,"ack_msgs");
- $table->SetAlign("center");
+ if(!$bulk){
+ $table = new CTable(NULL,"ack_msgs");
+ $table->SetAlign("center");
- $db_acks = get_acknowledges_by_eventid($db_data["eventid"]);
- while($db_ack = DBfetch($db_acks))
- {
- $db_user = get_user_by_userid($db_ack["userid"]);
- $table->AddRow(array(
- new CCol($db_user["alias"],"user"),
- new CCol(date("d-m-Y h:i:s A",$db_ack["clock"]),"time")),
- "title");
-
- $msgCol = new CCol(nl2br($db_ack["message"]));
- $msgCol->SetColspan(2);
- $table->AddRow($msgCol,"msg");
- }
+ $db_acks = get_acknowledges_by_eventid($db_data["eventid"]);
+ while($db_ack = DBfetch($db_acks))
+ {
+ $db_user = get_user_by_userid($db_ack["userid"]);
+ $table->AddRow(array(
+ new CCol($db_user["alias"],"user"),
+ new CCol(date("d-m-Y h:i:s A",$db_ack["clock"]),"time")),
+ "title");
+
+ $msgCol = new CCol(nl2br($db_ack["message"]));
+ $msgCol->SetColspan(2);
+ $table->AddRow($msgCol,"msg");
+ }
/**/
- if($table->GetNumRows() > 0)
- {
- $table->Show();
- echo BR;
+ if($table->GetNumRows() > 0){
+ $table->Show();
+ echo BR;
+ }
}
- insert_new_message_form();
+
+ insert_new_message_form($events,$bulk);
?>
<?php
diff --git a/frontends/php/config.php b/frontends/php/config.php
index f70a5583..b780242d 100644
--- a/frontends/php/config.php
+++ b/frontends/php/config.php
@@ -34,7 +34,7 @@ include_once "include/page_header.php";
$fields=array(
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
- "config"=> array(T_ZBX_INT, O_OPT, NULL, IN("0,3,5,6,7"), NULL),
+ "config"=> array(T_ZBX_INT, O_OPT, NULL, IN("0,3,5,6,7,8"), NULL),
// other form
"alert_history"=> array(T_ZBX_INT, O_NO, NULL, BETWEEN(0,65535), 'isset({config})&&({config}==0)&&isset({save})'),
@@ -61,6 +61,9 @@ include_once "include/page_header.php";
"save"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL),
"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})'),
/* other */
"form"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL),
"form_refresh"=> array(T_ZBX_INT, O_OPT, NULL, NULL, NULL)
@@ -123,6 +126,34 @@ include_once "include/page_header.php";
unset($image, $_REQUEST["imageid"]);
}
}
+ elseif(isset($_REQUEST["save"]) && ($_REQUEST["config"]==8)){
+ if(count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_WRITE,PERM_MODE_LT,PERM_RES_IDS_ARRAY,get_current_nodeid())))
+ access_deny();
+
+/* OTHER ACTIONS */
+ $result=update_config(
+ get_request('event_history'),
+ get_request('alert_history'),
+ get_request('refresh_unsupported'),
+ get_request('work_period'),
+ get_request('alert_usrgrpid'),
+ get_request('ack_enable'),
+ get_request('ack_expire')
+ );
+
+ show_messages($result, S_CONFIGURATION_UPDATED, S_CONFIGURATION_WAS_NOT_UPDATED);
+
+ if($result)
+ {
+ $msg = array();
+ if(!is_null($val = get_request('ack_enable')))
+ $msg[] = S_EVENT_ACKNOWLEDGES.' ['.($val?(S_DISABLED):(S_ENABLED)).']';
+ if(!is_null($val = get_request('ack_expire')))
+ $msg[] = S_SHOW_EVENTS_NOT_OLDER.SPACE.'('.S_DAYS.')'.' ['.$val.']';
+
+ add_audit(AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_ZABBIX_CONFIG,implode('; ',$msg));
+ }
+ }
elseif(isset($_REQUEST["save"])&&in_array($_REQUEST["config"],array(0,5,7)))
{
@@ -135,7 +166,10 @@ include_once "include/page_header.php";
get_request('alert_history'),
get_request('refresh_unsupported'),
get_request('work_period'),
- get_request('alert_usrgrpid'));
+ get_request('alert_usrgrpid'),
+ get_request('ack_enable'),
+ get_request('ack_expire')
+ );
show_messages($result, S_CONFIGURATION_UPDATED, S_CONFIGURATION_WAS_NOT_UPDATED);
if($result)
@@ -258,6 +292,7 @@ include_once "include/page_header.php";
// $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"])
@@ -288,6 +323,10 @@ include_once "include/page_header.php";
{
insert_work_period_form();
}
+ elseif($_REQUEST["config"]==8)
+ {
+ insert_event_ack_form();
+ }
elseif($_REQUEST["config"]==3)
{
if(isset($_REQUEST["form"]))
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index 1f191b0d..739ab244 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -1005,7 +1005,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)
+ function update_config($event_history,$alert_history,$refresh_unsupported,$work_period,$alert_usrgrpid,$ack_enable,$ack_expire)
{
$update = array();
@@ -1039,6 +1039,14 @@ function TODO($msg) { echo "TODO: ".$msg.BR; } // DEBUG INFO!!!
}
$update[] = 'alert_usrgrpid='.$alert_usrgrpid;
}
+ if(!is_null($ack_enable))
+ {
+ $update[] = 'ack_enable='.$ack_enable;
+ }
+ if(!is_null($ack_expire))
+ {
+ $update[] = 'ack_expire='.$ack_expire;
+ }
if(count($update) == 0)
{
error(S_NOTHING_TO_DO);
diff --git a/frontends/php/include/defines.inc.php b/frontends/php/include/defines.inc.php
index 8360dd51..733362ea 100644
--- a/frontends/php/include/defines.inc.php
+++ b/frontends/php/include/defines.inc.php
@@ -199,12 +199,25 @@
define('SERVICE_ALGORITHM_NONE',0);
define('SERVICE_ALGORITHM_MAX',1);
define('SERVICE_ALGORITHM_MIN',2);
+
+ define('TRIGGER_MULT_EVENT_DISABLED',0);
+ define('TRIGGER_MULT_EVENT_ENABLED',1);
+
+ define('TRIGGER_STATUS_ENABLED',0);
+ define('TRIGGER_STATUS_DISABLED',1);
+ define('TRIGGER_STATUS_UNKNOWN',2);
+
+ define('TRIGGERS_OPTION_DISABLED', 0); // reserved
+ define('TRIGGERS_OPTION_ONLYTRUE', 1); // use 0 to disable
+ define('TRIGGERS_OPTION_ALL', 2); // use 0 to disable
+ define('TRIGGERS_OPTION_NOFALSEFORB', 0); // use 0 to disable
define('TRIGGER_VALUE_FALSE',0);
define('TRIGGER_VALUE_TRUE',1);
define('TRIGGER_VALUE_UNKNOWN',2);
-
- define('TRIGGER_BLINK_PERIOD',1800);
+
+ define('TRIGGER_FALSE_PERIOD', 1800);
+ define('TRIGGER_BLINK_PERIOD', 1800);
define('TRIGGER_SEVERITY_NOT_CLASSIFIED', 0);
define('TRIGGER_SEVERITY_INFORMATION', 1);
@@ -212,7 +225,7 @@
define('TRIGGER_SEVERITY_AVERAGE', 3);
define('TRIGGER_SEVERITY_HIGH', 4);
define('TRIGGER_SEVERITY_DISASTER', 5);
-
+
define('ALERT_STATUS_NOT_SENT',0);
define('ALERT_STATUS_SENT',1);
@@ -237,10 +250,6 @@
define('ACTION_EVAL_TYPE_AND',1);
define('ACTION_EVAL_TYPE_OR',2);
- define('TRIGGER_STATUS_ENABLED',0);
- define('TRIGGER_STATUS_DISABLED',1);
- define('TRIGGER_STATUS_UNKNOWN',2);
-
define('OPERATION_OBJECT_USER', 0);
define('OPERATION_OBJECT_GROUP', 1);
@@ -355,12 +364,22 @@
define('HTTPSTEP_ITEM_TYPE_IN', 2);
define('HTTPSTEP_ITEM_TYPE_LASTSTEP', 3);
+ define('EVENT_ACK_DISABLED','0');
+ define('EVENT_ACK_ENABLED','1');
+
define('EVENT_SOURCE_TRIGGERS', 0);
define('EVENT_SOURCE_DISCOVERY', 1);
define('EVENT_OBJECT_TRIGGER', 0);
define('EVENT_OBJECT_DHOST', 1);
define('EVENT_OBJECT_DSERVICE', 2);
+
+ define('EVENTS_OPTION_DISABLED', 0); // reserved
+ define('EVENTS_OPTION_NOEVENT', 1); // use 0 to disable
+ define('EVENTS_OPTION_ALL', 2); // use 0 to disable
+ define('EVENTS_OPTION_NOT_ACK', 3); // use 0 to disable
+ define('EVENTS_OPTION_ONLYTRUE_NOTACK', 4); // use 0 to disable
+ define('EVENTS_OPTION_NOFALSEFORB', 5); // reserved for TRIGGERS_OPTION_NOFALSEFORB, to disable set TRIGGERS_OPTION_NOFALSEFORB to 0
define('DOBJECT_STATUS_UP', 0);
define('DOBJECT_STATUS_DOWN', 1);
diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php
index 2e010c9d..a05f2da4 100644
--- a/frontends/php/include/forms.inc.php
+++ b/frontends/php/include/forms.inc.php
@@ -637,13 +637,16 @@
$frmNode->Show();
}
- function insert_new_message_form()
+ function insert_new_message_form($events,$bulk)
{
global $USER_DETAILS;
global $_REQUEST;
-
- $db_acks = get_acknowledges_by_eventid($_REQUEST["eventid"]);
- if(!DBfetch($db_acks))
+
+ if($bulk){
+ $title = S_ACKNOWLEDGE_ALARM_BY;
+ $btn_txt2 = S_ACKNOWLEDGE.' '.S_AND_SYMB.' '.S_RETURN;
+ }
+ else if(!DBfetch(get_acknowledges_by_eventid(get_request('eventid',0))))
{
$title = S_ACKNOWLEDGE_ALARM_BY;
$btn_txt = S_ACKNOWLEDGE;
@@ -658,17 +661,22 @@
$frmMsg= new CFormTable($title." \"".$USER_DETAILS["alias"]."\"");
$frmMsg->SetHelp("manual.php");
- $frmMsg->AddVar("eventid",get_request("eventid",0));
+
+ if($bulk) $frmMsg->AddVar('bulkacknowledge',1);
+
+ foreach($events as $id => $eventid){
+ $frmMsg->AddVar('events['.$eventid.']',$eventid);
+ }
$frmMsg->AddRow(S_MESSAGE, new CTextArea("message","",80,6));
$frmMsg->AddItemToBottomRow(new CButton("saveandreturn",$btn_txt2));
- $frmMsg->AddItemToBottomRow(new CButton("save",$btn_txt));
+ (isset($btn_txt))?($frmMsg->AddItemToBottomRow(new CButton("save",$btn_txt))):('');
$frmMsg->AddItemToBottomRow(new CButtonCancel(url_param('eventid')));
$frmMsg->Show(false);
- SetFocus($frmMsg->GetName(),"message");
+ SetFocus($frmMsg->GetName(),'message');
$frmMsg->Destroy();
}
@@ -2255,6 +2263,7 @@
$expression = get_request("expression" ,"");
$description = get_request("description" ,"");
+ $type = get_request('type', 0);
$priority = get_request("priority" ,0);
$status = get_request("status" ,0);
$comments = get_request("comments" ,"");
@@ -2267,6 +2276,7 @@
if(!isset($limited) || !isset($_REQUEST["form_refresh"]))
{
+ $type = $trigger['type'];
$priority = $trigger["priority"];
$status = $trigger["status"];
$comments = $trigger["comments"];
@@ -2326,7 +2336,11 @@
new CButton("add_dependence",S_ADD)
),'new');
- /* end new dwpendence */
+ $type_select = new CComboBox('type');
+ $type_select->Additem(TRIGGER_MULT_EVENT_DISABLED,S_NORMAL,(($type == TRIGGER_MULT_EVENT_ENABLED)?'no':'yes'));
+ $type_select->Additem(TRIGGER_MULT_EVENT_ENABLED,S_NORMAL.SPACE.'+'.SPACE.S_MULTIPLE_TRUE_EVENTS,(($type == TRIGGER_MULT_EVENT_ENABLED)?'yes':'no'));
+ /* end new dependence */
+ $frmTrig->AddRow(S_EVENT_GENERATION,$type_select);
$cmbPrior = new CComboBox("priority",$priority);
for($i = 0; $i <= 5; $i++)
@@ -3924,6 +3938,28 @@ include_once 'include/discovery.inc.php';
$frmHouseKeep->Show();
}
+ function insert_event_ack_form()
+ {
+ $config=select_config();
+
+ $frmEventAck = new CFormTable(S_ACKNOWLEDGES,"config.php");
+// $frmEventAck->SetHelp("web.config.workperiod.php");
+ $frmEventAck->AddVar("config",get_request("config",8));
+
+ $exp_select = new CComboBox('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');
+
+ $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));
+
+ $frmEventAck->AddItemToBottomRow(new CButton("save",S_SAVE));
+ $frmEventAck->Show();
+ }
+
function insert_other_parameters_form()
{
$config=select_config();
diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php
index 3c481f0a..6394397a 100644
--- a/frontends/php/include/locales/en_gb.inc.php
+++ b/frontends/php/include/locales/en_gb.inc.php
@@ -186,15 +186,17 @@
'S_WITH_SUBNODES'=> 'With subnodes',
// acknow.php
- 'S_ACKNOWLEDGES'=> 'Acknowledges',
- 'S_ACKNOWLEDGE'=> 'Acknowledge',
- 'S_RETURN'=> 'Return',
+ 'S_ACKNOWLEDGES'=> 'Acknowledges',
+ 'S_ACKNOWLEDGE'=> 'Acknowledge',
+ 'S_RETURN'=> 'Return',
'S_ACKNOWLEDGE_ALARM_BY'=> 'Acknowledge alarm by',
'S_ADD_COMMENT_BY'=> 'Add comment by',
- 'S_COMMENT_ADDED'=> 'Comment added',
+ 'S_COMMENT_ADDED'=> ' Comment added',
'S_CANNOT_ADD_COMMENT'=> 'Cannot add coment',
- 'S_ALARM_ACKNOWLEDGES_BIG'=> 'ALARM ACKNOWLEDGES',
+ 'S_ALARM_ACKNOWLEDGES_BIG'=> 'ALARM ACKNOWLEDGES',
'S_ACKNOWLEDGE_ADDED'=> 'Acknowledge added',
+ 'S_SYS_BULK_ACKNOWLEDGE'=> '----[BULK ACKNOWLEDGE]----',
+ 'S_BULK_ACKNOWLEDGE'=> 'Bulk acknowledge',
// actionconf.php
'S_CONFIGURATION_OF_ACTIONS'=> 'Configuration of actions',
@@ -368,6 +370,9 @@
'S_YELLOW'=> 'Yellow',
// config.php
+ 'S_EVENT_ACKNOWLEDGES'=> 'Event acknowledges',
+ 'S_DAYS'=> 'Days',
+ 'S_SHOW_EVENTS_NOT_OLDER'=> 'Show events not older',
'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',
@@ -1180,9 +1185,12 @@
'S_SEC_SMALL'=> 'sec',
'S_COUNTS'=> 'Counts',
'S_LAST_OF'=> 'Last of',
+ 'S_MULTIPLE_TRUE_EVENTS'=> 'Multiple TRUE events',
'S_SHOW_DISABLED_TRIGGERS'=> 'Show disabled triggers',
'S_HIDE_DISABLED_TRIGGERS'=> 'Hide disabled triggers',
+ 'S_MULTIPLE_EVENTS'=> 'Multiple events',
+ 'S_EVENT_GENERATION'=> 'Event generation',
// tr_comments.php
'S_TRIGGER_COMMENTS'=> 'Trigger comments',
@@ -1193,24 +1201,30 @@
// tr_status.php
'S_STATUS_OF_TRIGGERS'=> 'Status of triggers',
- 'S_STATUS_OF_TRIGGERS_BIG'=> 'STATUS OF TRIGGERS',
+ 'S_STATUS_OF_TRIGGERS_BIG'=> 'STATUS OF TRIGGERS',
'S_SHOW_ONLY_TRUE'=> 'Show only true',
- 'S_HIDE_ACTIONS'=> 'Hide actions',
- 'S_SHOW_ACTIONS'=> 'Show actions',
- 'S_SHOW_ALL_TRIGGERS'=> 'Show all triggers',
- 'S_HIDE_DETAILS'=> 'Hide details',
- 'S_SHOW_DETAILS'=> 'Show details',
- 'S_SELECT'=> 'Select',
- 'S_HIDE_SELECT'=> 'Hide select',
- 'S_TRIGGERS_BIG'=> 'TRIGGERS',
- 'S_NAME_BIG'=> 'NAME',
- 'S_SEVERITY_BIG'=> 'SEVERITY',
+ 'S_HIDE_ACTIONS'=> 'Hide actions',
+ 'S_SHOW_ACTIONS'=> 'Show actions',
+ 'S_SHOW_ALL'=> 'Show all',
+ 'S_HIDE_ALL'=> 'Hide all',
+ 'S_SHOW_ONLY_TRUE'=> 'Show only true',
+ 'S_SHOW_NOFALSEFORB'=> 'Show all(no FALSE for B)',
+ 'S_SHOW_UNACKNOWLEDGED'=> 'Show unacknowledged',
+ 'S_SHOW_TRUE_UNACKNOWLEDGED'=> 'Show true-unacknowledged',
+ 'S_NOT_ACKNOWLEDGED'=> 'Not acknowledged',
+ 'S_HIDE_DETAILS'=> 'Hide details',
+ 'S_SHOW_DETAILS'=> 'Show details',
+ 'S_SELECT'=> 'Select',
+ 'S_HIDE_SELECT'=> 'Hide select',
+ 'S_TRIGGERS_BIG'=> 'TRIGGERS',
+ 'S_NAME_BIG'=> 'NAME',
+ 'S_SEVERITY_BIG'=> 'SEVERITY',
'S_LAST_CHANGE_BIG'=> 'LAST CHANGE',
- 'S_LAST_CHANGE'=> 'Last change',
- 'S_COMMENTS'=> 'Comments',
- 'S_ACKNOWLEDGED'=> 'Acknowledged',
- 'S_ACK'=> 'Ack',
- 'S_NEVER'=> 'Never',
+ 'S_LAST_CHANGE'=> 'Last change',
+ 'S_COMMENTS'=> 'Comments',
+ 'S_ACKNOWLEDGED'=> 'Acknowledged',
+ 'S_ACK'=> 'Ack',
+ 'S_NEVER'=> 'Never',
// users.php
'S_ZABBIX_USER'=> 'ZABBIX User',
diff --git a/frontends/php/include/triggers.inc.php b/frontends/php/include/triggers.inc.php
index 40cdf44d..9ec4ae64 100644
--- a/frontends/php/include/triggers.inc.php
+++ b/frontends/php/include/triggers.inc.php
@@ -673,7 +673,7 @@
function add_trigger(
- $expression, $description, $priority, $status,
+ $expression, $description, $type, $priority, $status,
$comments, $url, $deps=array(), $templateid=0)
{
if( !validate_expression($expression) )
@@ -682,8 +682,8 @@
$triggerid=get_dbid("triggers","triggerid");
$result=DBexecute("insert into triggers".
- " (triggerid,description,priority,status,comments,url,value,error,templateid)".
- " values ($triggerid,".zbx_dbstr($description).",$priority,$status,".zbx_dbstr($comments).",".
+ " (triggerid,description,type,priority,status,comments,url,value,error,templateid)".
+ " values ($triggerid,".zbx_dbstr($description).",$type,$priority,$status,".zbx_dbstr($comments).",".
"".zbx_dbstr($url).",2,'Trigger just added. No status update so far.',$templateid)");
if(!$result)
{
@@ -810,9 +810,9 @@
$newtriggerid=get_dbid("triggers","triggerid");
$result = DBexecute("insert into triggers".
- " (triggerid,description,priority,status,comments,url,value,expression,templateid)".
- " values ($newtriggerid,".zbx_dbstr($trigger["description"]).",".$trigger["priority"].",".
- $trigger["status"].",".zbx_dbstr($trigger["comments"]).",".
+ " (triggerid,description,type,priority,status,comments,url,value,expression,templateid)".
+ " values ($newtriggerid,".zbx_dbstr($trigger['description']).','.$trigger['type'].','.$trigger['priority'].','.
+ $trigger['status'].','.zbx_dbstr($trigger['comments']).','.
zbx_dbstr($trigger["url"]).",2,'{???:???}',".
($copy_mode ? 0 : $triggerid).")");
@@ -1271,7 +1271,7 @@
* Comments: !!! Don't forget sync code with C !!! *
* *
******************************************************************************/
- function update_trigger($triggerid,$expression=NULL,$description=NULL,$priority=NULL,$status=NULL,
+ function update_trigger($triggerid,$expression=NULL,$description=NULL,$type=NULL,$priority=NULL,$status=NULL,
$comments=NULL,$url=NULL,$deps=array(),$templateid=0)
{
$trigger = get_trigger_by_triggerid($triggerid);
@@ -1317,6 +1317,7 @@
$db_chd_trigger["triggerid"],
$newexpression,
$description,
+ $type,
$priority,
NULL, // status
$comments,
@@ -1341,6 +1342,7 @@
$sql="update triggers set";
if(!is_null($expression)) $sql .= " expression=".zbx_dbstr($expression).",";
if(!is_null($description)) $sql .= " description=".zbx_dbstr($description).",";
+ if(!is_null($type)) $sql .= " type=$type,";
if(!is_null($priority)) $sql .= " priority=$priority,";
if(!is_null($status)) $sql .= " status=$status,";
if(!is_null($comments)) $sql .= " comments=".zbx_dbstr($comments).",";
diff --git a/frontends/php/tr_status.php b/frontends/php/tr_status.php
index c3437f42..dbc26b65 100644
--- a/frontends/php/tr_status.php
+++ b/frontends/php/tr_status.php
@@ -1,7 +1,7 @@
<?php
/*
** ZABBIX
-** Copyright (C) 2000-2005 SIA Zabbix
+** Copyright (C) 2000-2007 SIA Zabbix
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -23,6 +23,7 @@
require_once "include/hosts.inc.php";
require_once "include/acknow.inc.php";
require_once "include/triggers.inc.php";
+ require_once "include/events.inc.php";
$page["file"] = "tr_status.php";
$page["title"] = "S_STATUS_OF_TRIGGERS";
@@ -84,6 +85,7 @@
define('ZBX_PAGE_NO_MENU', 1);
include_once "include/page_header.php";
+echo '<script type="text/javascript" src="js/blink.js"></script>';
?>
<?php
@@ -94,8 +96,9 @@ include_once "include/page_header.php";
"sort"=> array(T_ZBX_STR, O_OPT, null, IN('"host","priority","description","lastchange"'), null),
"noactions"=> array(T_ZBX_STR, O_OPT, null, IN('"true","false"'), null),
"compact"=> array(T_ZBX_STR, O_OPT, null, IN('"true","false"'), null),
- "onlytrue"=> array(T_ZBX_STR, O_OPT, null, IN('"true","false"'), null),
- "show_unknown"=> array(T_ZBX_INT, O_OPT, P_SYS, IN(array(0,1)), null),
+
+ "show_triggers"=> array(T_ZBX_INT, O_OPT, null, null, null),
+ "show_events"=> array(T_ZBX_INT, O_OPT, P_SYS, null, null),
"select"=> array(T_ZBX_STR, O_OPT, null, IN('"true","false"'), null),
"txt_select"=> array(T_ZBX_STR, O_OPT, null, null, null),
"fullscreen"=> array(T_ZBX_STR, O_OPT, null, null, null),
@@ -104,19 +107,22 @@ include_once "include/page_header.php";
check_fields($fields);
- $_REQUEST["onlytrue"] = get_request("onlytrue", get_profile("web.tr_status.onlytrue", 'true'));
- $_REQUEST["noactions"] = get_request("noactions", get_profile("web.tr_status.noactions", 'true'));
- $_REQUEST["compact"] = get_request("compact", get_profile("web.tr_status.compact", 'true'));
- $_REQUEST['show_unknown'] = get_request('show_unknown',get_profile('web.tr_status.show_unknown',0));
+ $_REQUEST['show_triggers'] = get_request('show_triggers', get_profile('web.tr_status.show_triggers', TRIGGERS_OPTION_ONLYTRUE));
+ $_REQUEST['show_events'] = get_request('show_events',get_profile('web.tr_status.show_events', EVENTS_OPTION_NOEVENT));
+
+ $_REQUEST['noactions'] = get_request('noactions', get_profile('web.tr_status.noactions', 'true'));
+ $_REQUEST['compact'] = get_request('compact', get_profile('web.tr_status.compact', 'true'));
+ validate_group_with_host(PERM_READ_ONLY,array('allow_all_hosts','always_select_first_host','monitored_hosts','with_monitored_items'),
+ 'web.tr_status.groupid','web.tr_status.hostid');
- validate_group_with_host(PERM_READ_ONLY,array("allow_all_hosts","always_select_first_host","monitored_hosts","with_monitored_items"),
- "web.tr_status.groupid","web.tr_status.hostid");
+ update_profile('web.tr_status.show_triggers',$_REQUEST['show_triggers']);
+ update_profile('web.tr_status.show_events',$_REQUEST['show_events']);
- update_profile("web.tr_status.onlytrue",$_REQUEST["onlytrue"]);
- update_profile("web.tr_status.noactions",$_REQUEST["noactions"]);
- update_profile("web.tr_status.compact",$_REQUEST["compact"]);
- update_profile('web.tr_status.show_unknown',$_REQUEST['show_unknown']);
+ update_profile('web.tr_status.noactions',$_REQUEST['noactions']);
+ update_profile('web.tr_status.compact',$_REQUEST['compact']);
+
+ $config=select_config();
?>
<?php
@@ -126,22 +132,31 @@ include_once "include/page_header.php";
}
?>
<?php
- $sort = get_request('sort', 'priority');
- $noactions = get_request('noactions', 'true');
- $compact = get_request('compact', 'true');
- $onlytrue = get_request('onlytrue', 'true');
- $show_unknown= get_request('show_unknown',0);
- $select = get_request('select', 'false');
- $txt_select = get_request('txt_select', "");
+ $sort = get_request('sort', 'priority');
+ $noactions = get_request('noactions', 'true');
+ $compact = get_request('compact', 'true');
+ $show_triggers = get_request('show_triggers', TRIGGERS_OPTION_ONLYTRUE);
+ $show_events = get_request('show_events', EVENTS_OPTION_NOEVENT);
+ $select = get_request('select', 'false');
+ $txt_select = get_request('txt_select', '');
+
if($select == 'false') $txt_select = '';
+// if trigger option is NOFALSEFORB than only 1 option avalable for events and we are setting it!!!
+ if(TRIGGERS_OPTION_NOFALSEFORB && ($show_triggers == TRIGGERS_OPTION_NOFALSEFORB)){
+ $show_events = EVENTS_OPTION_NOFALSEFORB;
+ }
+
+ if(!$config['ack_enable'] && (($show_events != EVENTS_OPTION_NOEVENT) || ($show_events != EVENTS_OPTION_ALL))){
+ $show_events = EVENTS_OPTION_NOEVENT;
+ }
?>
<?php
$r_form = new CForm();
$r_form->SetMethod('get');
- $cmbGroup = new CComboBox("groupid",$_REQUEST["groupid"],"submit()");
- $cmbHosts = new CComboBox("hostid",$_REQUEST["hostid"],"submit()");
+ $cmbGroup = new CComboBox('groupid',$_REQUEST['groupid'],'submit()');
+ $cmbHosts = new CComboBox('hostid',$_REQUEST['hostid'],'submit()');
$cmbGroup->AddItem(0,S_ALL_SMALL);
@@ -192,8 +207,8 @@ include_once "include/page_header.php";
$r_form->AddItem(array(SPACE.S_HOST.SPACE,$cmbHosts));
$r_form->AddVar("compact",$compact);
- $r_form->AddVar("onlytrue",$onlytrue);
- $r_form->AddVar('show_unknown',$show_unknown);
+ $r_form->AddVar("show_triggers",$show_triggers);
+ $r_form->AddVar('show_events',$show_events);
$r_form->AddVar("noactions",$noactions);
$r_form->AddVar("select",$select);
$r_form->AddVar("txt_select",$txt_select);
@@ -201,36 +216,74 @@ include_once "include/page_header.php";
if(isset($_REQUEST['fullscreen'])) $r_form->AddVar("fullscreen",1);
show_table_header(
- new CLink(SPACE.S_STATUS_OF_TRIGGERS_BIG.SPACE.date("[H:i:s]",time()),"tr_status.php?onlytrue=$onlytrue&noactions=$noactions".
- "&compact=$compact&sort=$sort".(!isset($_REQUEST["fullscreen"]) ? '&fullscreen=1' : '')),
+ new CLink(SPACE.S_STATUS_OF_TRIGGERS_BIG.SPACE.date("[H:i:s]",time()),'tr_status.php?show_triggers=$show_triggers'.
+ '&show_events=$show_events&noactions=$noactions&compact=$compact&sort=$sort'.
+ (!isset($_REQUEST["fullscreen"]) ? '&fullscreen=1' : '')),
$r_form);
if(!isset($_REQUEST["fullscreen"]))
{
$left_col = array();
- array_push($left_col, '[', new CLink($onlytrue != 'true' ? S_SHOW_ONLY_TRUE : S_SHOW_ALL_TRIGGERS,
- "tr_status.php?onlytrue=".($onlytrue != 'true' ? 'true' : 'false').
- "&noactions=$noactions&compact=$compact&select=$select&txt_select=$txt_select&sort=$sort"
- ), ']'.SPACE);
-
- array_push($left_col, '[', new CLink($show_unknown!=1?S_SHOW_UNKNOWN:S_HIDE_UNKNOWN,
- "tr_status.php?show_unknown=".($show_unknown!=1?'1':'0').
- "&onlytrue=$onlytrue&noactions=$noactions&compact=$compact&select=$select&txt_select=$txt_select&sort=$sort"
- ), ']'.SPACE);
+ $tr_form = new CForm('tr_status.php');
+ $tr_form->SetMethod('get');
+ $tr_form->AddOption('style','display: inline;');
+
+ $tr_form->AddVar("compact",$compact);
+ $tr_form->AddVar("noactions",$noactions);
+ $tr_form->AddVar("select",$select);
+
+ $tr_select = new CComboBox('show_triggers',S_TRIGGERS,'javascript: submit();');
+ if(TRIGGERS_OPTION_ONLYTRUE){
+ $tr_select->Additem(TRIGGERS_OPTION_ONLYTRUE,S_SHOW_ONLY_TRUE,(TRIGGERS_OPTION_ONLYTRUE==$show_triggers)?'yes':'no');
+ }
+ if(TRIGGERS_OPTION_ALL){
+ $tr_select->Additem(TRIGGERS_OPTION_ALL,S_SHOW_ALL,(TRIGGERS_OPTION_ALL==$show_triggers)?'yes':'no');
+ }
+ if(TRIGGERS_OPTION_NOFALSEFORB){
+ $tr_select->Additem(TRIGGERS_OPTION_NOFALSEFORB,S_SHOW_NOFALSEFORB,(TRIGGERS_OPTION_NOFALSEFORB==$show_triggers)?'yes':'no');
+ }
+
+ $ev_select = new CComboBox('show_events',S_EVENTS,'javascript: submit();');
+ if(EVENTS_OPTION_NOEVENT){
+ $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');
+ }
+ 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_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');
+ }
+//------- JP -------
+ if($show_triggers==TRIGGERS_OPTION_NOFALSEFORB){
+ $ev_select->Additem(EVENTS_OPTION_NOFALSEFORB,' - ','yes');
+ $ev_select->AddOption('disabled','disabled');
+ }
+
+ $tr_form->AddItem(S_TRIGGERS);
+ $tr_form->AddItem($tr_select);
+
+ $tr_form->AddItem(SPACE.SPACE.S_EVENTS);
+ $tr_form->AddItem($ev_select);
+
+ array_push($left_col,$tr_form,SPACE);
+
array_push($left_col, '[', new CLink($noactions != 'true' ? S_HIDE_ACTIONS : S_SHOW_ACTIONS,
"tr_status.php?noactions=".($noactions != 'true' ? 'true' : 'false').
- "&onlytrue=$onlytrue&show_unknown=$show_unknown&compact=$compact&select=$select&txt_select=$txt_select&sort=$sort"
+ "&show_triggers=$show_triggers&show_events=$show_events&compact=$compact&select=$select&txt_select=$txt_select&sort=$sort"
), ']'.SPACE);
array_push($left_col, '[', new CLink($compact != 'true' ? S_HIDE_DETAILS: S_SHOW_DETAILS,
"tr_status.php?compact=".($compact != 'true' ? 'true' : 'false').
- "&onlytrue=$onlytrue&show_unknown=$show_unknown&noactions=$noactions&select=$select&txt_select=$txt_select&sort=$sort"
+ "&show_triggers=$show_triggers&show_events=$show_events&noactions=$noactions&select=$select&txt_select=$txt_select&sort=$sort"
), ']'.SPACE);
array_push($left_col, '[', new CLink($select != 'true' ? S_SELECT : S_HIDE_SELECT,
"tr_status.php?select=".($select != 'true' ? 'true' : 'false').
- "&onlytrue=$onlytrue&show_unknown=$show_unknown&noactions=$noactions&compact=$compact&txt_select=$txt_select&sort=$sort"
+ "&show_triggers=$show_triggers&show_events=$show_events&noactions=$noactions&compact=$compact&txt_select=$txt_select&sort=$sort"
), ']');
if($select=='true')
@@ -266,6 +319,9 @@ include_once "include/page_header.php";
$fullscreen="";
}
+ $m_form = new CForm('acknow.php');
+ $m_form->SetName('tr_status');
+
$table = new CTableInfo();
$header=array();
@@ -273,12 +329,13 @@ include_once "include/page_header.php";
is_show_subnodes() ? array('simple_label'=>S_NODE) : null,
$_REQUEST['hostid'] > 0 ? null :
array('select_label'=>S_HOST_BIG , 'simple_label'=>S_HOST, 'sort'=>'host'),
+ array('simple_label'=> new CCheckBox("all_events",false, "CheckAll('".$m_form->GetName()."','all_events','events');")),
array('select_label'=>S_NAME_BIG , 'simple_label'=>S_NAME, 'sort'=>'description'),
array('simple_label'=>S_STATUS),
array('select_label'=>S_SEVERITY_BIG , 'simple_label'=>S_SEVERITY, 'sort'=>'priority'),
array('select_label'=>S_LAST_CHANGE_BIG , 'simple_label'=>S_LAST_CHANGE, 'sort'=>'lastchange'),
array('simple_label'=>($noactions!='true') ? S_ACTIONS : NULL),
- array('simple_label'=>S_ACKNOWLEDGED),
+ array('simple_label'=>($config['ack_enable'])? S_ACKNOWLEDGED : NULL),
array('simple_label'=>S_COMMENTS)
);
@@ -292,7 +349,7 @@ include_once "include/page_header.php";
else if(isset($el['sort']))
{
$descr = new CLink($el['simple_label'],"tr_status.php?sort=".$el['sort'].
- "&onlytrue=$onlytrue&noactions=$noactions&compact=$compact$select_vars$fullscreen");
+ "&show_triggers=$show_triggers&show_events=$show_events&compact=$compact&select=$select&txt_select=$txt_select&sort=$sort");
}
else
{
@@ -301,11 +358,11 @@ include_once "include/page_header.php";
array_push($header,$descr);
unset($el);
}
-
+
$table->SetHeader($header);
unset($header);
- switch ($sort)
+ switch($sort)
{
case "host": $sort="order by h.host"; if($_REQUEST["hostid"] <= 0) break; /* else "description" */
case "description": $sort="order by t.description"; break;
@@ -314,36 +371,85 @@ include_once "include/page_header.php";
default: $sort="order by t.priority desc, t.description";
}
- $cond=($_REQUEST['hostid'] > 0)?' AND h.hostid='.$_REQUEST['hostid'].' ':'';
-
- $cond .=($onlytrue=='true')?' AND ((t.value=1) OR (('.time().' - lastchange)<'.TRIGGER_BLINK_PERIOD.')) ':'';
+ $cond = ($_REQUEST['hostid'] > 0)?' AND h.hostid='.$_REQUEST['hostid'].' ':'';
- $cond.=($show_unknown == 0)?' AND t.value<>2 ':'';
+ switch($show_triggers){
+ case TRIGGERS_OPTION_ALL:
+ $cond.='';
+ break;
+ case TRIGGERS_OPTION_NOFALSEFORB:
+ $cond.=' AND ((t.value='.TRIGGER_VALUE_TRUE.') OR ((t.value='.TRIGGER_VALUE_FALSE.') AND t.type='.TRIGGER_MULT_EVENT_DISABLED.'))';
+ break;
+ case TRIGGERS_OPTION_ONLYTRUE:
+ default:
+ $cond.=' AND ((t.value='.TRIGGER_VALUE_TRUE.') OR ((t.value='.TRIGGER_VALUE_FALSE.') AND (('.time().'-t.lastchange)<'.TRIGGER_FALSE_PERIOD.')))';
+ break;
+ }
- $result = DBselect('SELECT DISTINCT t.triggerid,t.status,t.description, '.
+ $sql = 'SELECT DISTINCT t.triggerid,t.status,t.description, '.
' t.expression,t.priority,t.lastchange,t.comments,t.url,t.value,h.host '.
' FROM triggers t,hosts h,items i,functions f '.
' WHERE f.itemid=i.itemid AND h.hostid=i.hostid '.
' AND t.triggerid=f.triggerid AND t.status='.TRIGGER_STATUS_ENABLED.
' AND i.status='.ITEM_STATUS_ACTIVE.' AND '.DBin_node('t.triggerid').
' AND h.hostid not in ('.get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY, PERM_MODE_LT).') '.
- ' AND h.status='.HOST_STATUS_MONITORED.' '.$cond.' '.$sort);
+ ' AND h.status='.HOST_STATUS_MONITORED.' '.$cond.' '.$sort;
- while($row=DBfetch($result))
- {
-// Check for dependencies
+ $result = DBselect($sql);
+ while($row=DBfetch($result)){
+
+// Check for dependencies
$deps = DBfetch(DBselect("select count(*) as cnt from trigger_depends d, triggers t ".
" where d.triggerid_down=".$row["triggerid"]." and d.triggerid_up=t.triggerid and t.value=1"));
- if($deps["cnt"]>0)
- {
+ if($deps["cnt"]>0){
continue;
}
+ $cond = '';
+ $ack_expire = ($config['ack_expire']*86400);
+ switch($show_events){
+ case EVENTS_OPTION_ALL:
+ $cond.=' AND (('.time().'-e.clock)<'.$ack_expire.')';
+ break;
+ case EVENTS_OPTION_NOT_ACK:
+ $cond.=' AND (('.time().'-e.clock)<'.$ack_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;
+ break;
+ case EVENTS_OPTION_NOFALSEFORB:
+ $cond.=' AND e.acknowledged=0 AND ((e.value='.TRIGGER_VALUE_TRUE.') OR ((e.value='.TRIGGER_VALUE_FALSE.') AND t.type='.TRIGGER_MULT_EVENT_DISABLED.'))';
+ break;
+ case EVENTS_OPTION_NOEVENT:
+ default:
+ $cond.=' AND 1=2 ';
+ break;
+ }
+
+ $event_sql = 'SELECT DISTINCT e.eventid, e.value, e.clock, e.objectid as triggerid, e.acknowledged '.
+ ' FROM events e, triggers t '.
+ ' WHERE e.object=0 AND e.objectid='.$row['triggerid'].
+ ' AND t.triggerid=e.objectid '.$cond.
+ ' ORDER BY e.eventid DESC';
+
+
+ if($show_triggers == TRIGGERS_OPTION_NOFALSEFORB){
+// if(!$eventid = first_initial_eventid($row,$show_unknown)) continue;
+
+ $sql = 'SELECT e.eventid'.
+ ' FROM events e, triggers t '.
+ ' WHERE e.object=0 AND e.objectid='.$row['triggerid'].
+ ' AND t.triggerid=e.objectid '.$cond;
+
+ $res_events = DBSelect($sql,1);
+ if(!DBFetch($res_events)) continue;
+ }
+
$elements=array();
- $description = expand_trigger_description($row["triggerid"]);
+ $description = expand_trigger_description($row['triggerid']);
if(isset($_REQUEST["btnSelect"]) && '' != $txt_select && ((stristr($description, $txt_select)) == ($_REQUEST["btnSelect"]=="Inverse select"))) continue;
@@ -354,11 +460,11 @@ include_once "include/page_header.php";
if($compact != 'true')
{
- $description = array(
- $description, BR,
- "<FONT COLOR=\"#000000\" SIZE=-2>",
- explode_exp($row["expression"],1),
- "</FONT>");
+ $font = new CTag('font','yes');
+ $font->AddOption('color','#000');
+ $font->AddOption('size','-2');
+ $font->AddItem(explode_exp($row["expression"],1));
+ $description = array($description,BR, $font);
}
if((time(NULL)-$row["lastchange"])<TRIGGER_BLINK_PERIOD)
@@ -368,65 +474,98 @@ include_once "include/page_header.php";
$value = new CSpan($blink[1].trigger_value2str($row["value"]).$blink[2], get_trigger_value_style($row["value"]));
- if($noactions=='true')
- {
+ if($noactions=='true'){
$actions=NULL;
}
- else
- {
+ else{
$actions=array(
- new CLink(S_CHANGE,'triggers.php?form=update&triggerid='.$row["triggerid"].url_param('hostid'),"action")
- );
+ new CLink(S_CHANGE,'triggers.php?form=update&triggerid='.$row["triggerid"].url_param('hostid'),"action"));
}
- $ack = "-";
- if($row["value"] == 1)
- {
- if($event = get_last_event_by_triggerid($row["triggerid"]))
- {
- if($event["acknowledged"] == 1)
- {
- $acks_cnt = DBfetch(DBselect("select count(*) as cnt from acknowledges where eventid=".$event["eventid"]));
- $ack=array(
- new CSpan(S_YES,"off"),
- SPACE."(".$acks_cnt['cnt'].SPACE,
- new CLink(S_SHOW,
- "acknow.php?eventid=".$event["eventid"],"action"),
- ")"
- );
- }
- else
- {
- $ack=array(
- new CSpan(S_NO,"on"),
- SPACE."(",
- new CLink(S_ACK,
- "acknow.php?eventid=".$event["eventid"],"action"),
- ")"
- );
- }
- }
- }
+ $ack='-';
$table->AddRow(array(
get_node_name_by_elid($row['triggerid']),
$_REQUEST['hostid'] > 0 ? null : $row['host'],
+ SPACE,
$description,
$value,
- new CCol(
- get_severity_description($row["priority"]),
- get_severity_style($row["priority"])),
+ SPACE,
new CLink(zbx_date2str(S_DATE_FORMAT_YMDHMS,$row["lastchange"]),"tr_events.php?triggerid=".$row["triggerid"],"action"),
$actions,
- new CCol($ack,"center"),
+ ($config['ack_enable'])?$ack:NULL,
new CLink(($row["comments"] == "") ? S_ADD : S_SHOW,"tr_comments.php?triggerid=".$row["triggerid"],"action")
));
+
+ $description = expand_trigger_description($row['triggerid']);
+
+ if($compact != 'true'){
+ $font = new CTag('font','yes');
+ $font->AddOption('color','#000');
+ $font->AddOption('size','-2');
+ $font->AddItem(explode_exp($row["expression"],1));
+ $description = array($description, $font);
+ }
+
+ $font = new CTag('font','yes');
+ $font->AddOption('color','#808080');
+ $font->AddItem(array('&nbsp;-&nbsp;',$description));
+ $description = $font->ToString();
+
+ $res_events = DBSelect($event_sql);
+ while($row_event=DBfetch($res_events)){
+
+// if($row['eventid'] == $row_event['eventid']) continue;
+// if(($show_unknown == 0) && (!event_initial_time($row_event,$show_unknown))) continue;
+
+ $value = new CSpan(trigger_value2str($row_event['value']), get_trigger_value_style($row_event['value']));
+
+ if($config['ack_enable']){
+ if($row_event['acknowledged'] == 1)
+ {
+ $acks_cnt = DBfetch(DBselect('SELECT COUNT(*) as cnt FROM acknowledges WHERE eventid='.$row_event['eventid']));
+ $ack=array(
+ new CSpan(S_YES,"off"),
+ SPACE.'('.$acks_cnt['cnt'].SPACE,
+ new CLink(S_SHOW,'acknow.php?eventid='.$row_event['eventid'],'action'),')');
+ }
+ else{
+ $ack= new CLink(S_NOT_ACKNOWLEDGED,'acknow.php?eventid='.$row_event['eventid'],'on');
+ }
+ }
+
+ $table->AddRow(array(
+ get_node_name_by_elid($row['triggerid']),
+ $_REQUEST['hostid'] > 0 ? null : $row['host'],
+ ($row_event['acknowledged'] == 1)?(SPACE):(new CCheckBox('events['.$row_event['eventid'].']', 'no',NULL,$row_event['eventid'])),
+ $description,
+ $value,
+ new CCol(
+ get_severity_description($row["priority"]),
+ get_severity_style($row["priority"])
+ ),
+ 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,
+ new CLink(($row["comments"] == "") ? S_ADD : S_SHOW,"tr_comments.php?triggerid=".$row["triggerid"],"action")
+ ));
+ }
+
unset($row,$description, $actions);
}
zbx_add_post_js('blink.init();');
- $table->Show(false);
+ $m_form->AddItem($table);
+
+ $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)
+ )));
+
+ $m_form->Show();
+// $table->Show(false);
- show_table_header(S_TOTAL.": ".$table->GetNumRows());
+// show_table_header(S_TOTAL.": ".$table->GetNumRows());
?>
<?php
diff --git a/frontends/php/triggers.php b/frontends/php/triggers.php
index 4f2a6e7c..c6ce4195 100644
--- a/frontends/php/triggers.php
+++ b/frontends/php/triggers.php
@@ -44,6 +44,7 @@ include_once "include/page_header.php";
"copy_type" =>array(T_ZBX_INT, O_OPT, P_SYS, IN("0,1"),'isset({copy})'),
"copy_mode" =>array(T_ZBX_INT, O_OPT, P_SYS, IN("0"),NULL),
+ 'type'=> array(T_ZBX_INT, O_OPT, NULL, IN('0,1'), 'isset({save})'),
"description"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY,'isset({save})'),
"expression"=> array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY,'isset({save})'),
"priority"=> array(T_ZBX_INT, O_OPT, NULL, IN("0,1,2,3,4,5"),'isset({save})'),
@@ -109,8 +110,10 @@ include_once "include/page_header.php";
access_deny();
$now=time();
- if(isset($_REQUEST["status"])) { $status=1; }
- else { $status=0; }
+ if(isset($_REQUEST['status'])) { $status=TRIGGER_STATUS_DISABLED; }
+ else{ $status=TRIGGER_STATUS_ENABLED; }
+
+ $type = $_REQUEST['type'];
$deps = get_request("dependences",array());
@@ -124,7 +127,7 @@ include_once "include/page_header.php";
}
$result=update_trigger($_REQUEST["triggerid"],
- $_REQUEST["expression"],$_REQUEST["description"],
+ $_REQUEST["expression"],$_REQUEST["description"],$type,
$_REQUEST["priority"],$status,$_REQUEST["comments"],$_REQUEST["url"],
$deps, $trigger_data['templateid']);
@@ -133,7 +136,7 @@ include_once "include/page_header.php";
show_messages($result, S_TRIGGER_UPDATED, S_CANNOT_UPDATE_TRIGGER);
} else {
- $triggerid=add_trigger($_REQUEST["expression"],$_REQUEST["description"],
+ $triggerid=add_trigger($_REQUEST["expression"],$_REQUEST["description"],$type,
$_REQUEST["priority"],$status,$_REQUEST["comments"],$_REQUEST["url"],
$deps);
@@ -358,12 +361,13 @@ include_once "include/page_header.php";
/* FORM */
echo BR;
insert_trigger_form();
- } else if(isset($_REQUEST["form_copy_to"]) && isset($_REQUEST["g_triggerid"]))
+ }
+ else if(isset($_REQUEST["form_copy_to"]) && isset($_REQUEST["g_triggerid"]))
{
echo BR;
insert_copy_elements_to_forms("g_triggerid");
- } else
- {
+ }
+ else{
/* TABLE */
$form = new CForm('triggers.php');
$form->SetName('triggers');