'disaster', 4 => 'high', 3 => 'average', 2 => 'warning', 1 => 'information', 0 => 'not_classified'); $prior_dif = $new[0]-$old[0]; krsort($files_apdx); foreach($files_apdx as $priority => $apdx) { if(round($prior_dif / pow(100, $priority)) != 0) { $audio = 'audio/trigger_'.$status.'_'.$apdx.'.wav'; break; } } if(!isset($audio) || !file_exists($audio)) $audio = 'audio/trigger_'.$status.'.wav'; } ?> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), "hostid"=> array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), "sort"=> array(T_ZBX_STR, O_OPT, null, IN('"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), "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), "btnSelect"=> array(T_ZBX_STR, O_OPT, null, null, null) ); check_fields($fields); 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"); ?> AddItem(0,S_ALL_SMALL); $availiable_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_LIST, null, null, $ZBX_CURNODEID); $result=DBselect("select distinct g.groupid,g.name from groups g, hosts_groups hg, hosts h, items i, functions f, triggers t ". " where h.hostid in (".$availiable_hosts.") ". " and hg.groupid=g.groupid and h.status=".HOST_STATUS_MONITORED. " and h.hostid=i.hostid and hg.hostid=h.hostid and i.status=".ITEM_STATUS_ACTIVE. " and i.itemid=f.itemid and t.triggerid=f.triggerid and t.status=".TRIGGER_STATUS_ENABLED. " order by g.name"); while($row=DBfetch($result)) { $cmbGroup->AddItem($row["groupid"],$row["name"]); unset($row); } $r_form->AddItem(array(S_GROUP.SPACE,$cmbGroup)); if($_REQUEST["groupid"] > 0) { $sql="select h.hostid,h.host from hosts h,items i,hosts_groups hg, functions f, triggers t where h.status=".HOST_STATUS_MONITORED. " and h.hostid=i.hostid and hg.groupid=".$_REQUEST["groupid"]." and hg.hostid=h.hostid". " and i.status=".ITEM_STATUS_ACTIVE. " and i.itemid=f.itemid and t.triggerid=f.triggerid and t.status=".TRIGGER_STATUS_ENABLED. " and h.hostid in (".$availiable_hosts.") ". " group by h.hostid,h.host order by h.host"; } else { $cmbHosts->AddItem(0,S_ALL_SMALL); $sql="select h.hostid,h.host from hosts h,items i, functions f, triggers t where h.status=".HOST_STATUS_MONITORED. " and i.status=".ITEM_STATUS_ACTIVE." and h.hostid=i.hostid". " and i.itemid=f.itemid and t.triggerid=f.triggerid and t.status=".TRIGGER_STATUS_ENABLED. " and h.hostid in (".$availiable_hosts.") ". " group by h.hostid,h.host order by h.host"; } $result=DBselect($sql); while($row=DBfetch($result)) { $cmbHosts->AddItem($row["hostid"],$row["host"]); } $r_form->AddItem(array(SPACE.S_HOST.SPACE,$cmbHosts)); $r_form->AddVar("compact",$compact); $r_form->AddVar("onlytrue",$onlytrue); $r_form->AddVar("noactions",$noactions); $r_form->AddVar("select",$select); $r_form->AddVar("txt_select",$txt_select); $r_form->AddVar("sort",$sort); 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' : '')), $r_form); ?> AddItem(new CTextBox("txt_select",$txt_select,15)); $form->AddItem(new CButton("btnSelect", "Select")); $form->AddItem(new CButton("btnSelect", "Inverse select")); $form->AddVar("compact",$compact); $form->AddVar("onlytrue",$onlytrue); $form->AddVar("noactions",$noactions); $form->AddVar("select",$select); array_push($left_col,BR,$form); } show_table_header($left_col); } if(isset($_REQUEST["fullscreen"])) { $triggerInfo = new CTriggersInfo(); $triggerInfo->HideHeader(); $triggerInfo->Show(); } if(isset($_REQUEST["fullscreen"])) { $fullscreen="&fullscreen=1"; } else { $fullscreen=""; } $table = new CTableInfo(); $header=array(); $headers_array = array( 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'=>S_COMMENTS) ); $select_vars = (isset($sort) && $sort=="description") ? "&select=$select&txt_select=$txt_select" : ""; foreach($headers_array as $el) { if(isset($el['sort']) && $sort == $el['sort']) { $descr = $el['select_label']; } 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"); } else { $descr = $el['simple_label']; } array_push($header,$descr); unset($el); } $table->SetHeader($header); unset($header); switch ($sort) { case "description": $sort="order by t.description"; break; case "priority": $sort="order by t.priority desc, t.description"; break; case "lastchange": $sort="order by t.lastchange desc, t.priority"; break; default: $sort="order by t.priority desc, t.description"; } if(isset($_REQUEST["btnSelect"])&&($_REQUEST["btnSelect"]=="Inverse select")) { $select_cond="not like '%$txt_select%'"; } else { $select_cond="like '%$txt_select%'"; } $cond=""; if($_REQUEST["hostid"] > 0) $cond=" and h.hostid=".$_REQUEST["hostid"]." "; if($onlytrue=='true') $cond .= " and t.value=1 "; $result = DBselect("select distinct t.triggerid,t.status,t.description,t.expression,t.priority,". " t.lastchange,t.comments,t.url,t.value 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 t.description $select_cond and i.status=".ITEM_STATUS_ACTIVE. " and ".DBid2nodeid("t.triggerid")."=".$ZBX_CURNODEID. " 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"); 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) { continue; } $elements=array(); $description = expand_trigger_description($row["triggerid"]); if($row["url"] != "") { $description = new CLink($description, $row["url"]); } if($compact != 'true') { $description = array( $description, BR, "", explode_exp($row["expression"],1), ""); } if((time(NULL)-$row["lastchange"])<300) $blink = array(1=>"", 2=>""); else $blink = array(1=>"", 2=>""); if($row["value"]==0) $value = array( 'text' => $blink[1].S_FALSE_BIG.$blink[2], 'style'=> "off" ); else if($row["value"]==2) $value = array( 'text' => $blink[1].S_UNKNOWN_BIG.$blink[2], 'style'=> "unknown" ); else $value = array( 'text' => S_TRUE_BIG, 'style'=> "on" ); if($noactions=='true') { $actions=NULL; } else { $actions=array( new CLink(S_CHANGE,"triggers.php?triggerid=".$row["triggerid"]. ($_REQUEST["hostid"] > 0 ? "&hostid=".$_REQUEST["hostid"] : "" ). "#form","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"), ")" ); } } } $table->AddRow(array( $description, new CSpan($value['text'], $value['style']), new CCol( get_severity_description($row["priority"]), get_severity_style($row["priority"])), new CLink(date(S_DATE_FORMAT_YMDHMS,$row["lastchange"]),"tr_events.php?triggerid=".$row["triggerid"],"action"), $actions, new CCol($ack,"center"), new CLink(($row["comments"] == "") ? S_ADD : S_SHOW,"tr_comments.php?triggerid=".$row["triggerid"],"action") )); unset($row,$description, $actions); } $table->Show(false); show_table_header(S_TOTAL.": ".$table->GetNumRows()); ?>