diff options
author | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-08-01 09:44:42 +0000 |
---|---|---|
committer | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-08-01 09:44:42 +0000 |
commit | 9e81f66c7cac5715f17f60159dc1e16c3d8cd4a3 (patch) | |
tree | e974af1252bf9bc493503fb72d1b4681c423013c /frontends | |
parent | 8c0061780ec40dec2b08c3c6e00840236a3445a0 (diff) | |
download | zabbix-9e81f66c7cac5715f17f60159dc1e16c3d8cd4a3.tar.gz zabbix-9e81f66c7cac5715f17f60159dc1e16c3d8cd4a3.tar.xz zabbix-9e81f66c7cac5715f17f60159dc1e16c3d8cd4a3.zip |
- [DEV-194] dependent triggers are not count in SoT (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5861 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends')
-rw-r--r-- | frontends/php/include/classes/ctriggerinfo.mod.php | 23 | ||||
-rw-r--r-- | frontends/php/include/triggers.inc.php | 18 | ||||
-rw-r--r-- | frontends/php/tr_status.php | 1 |
3 files changed, 24 insertions, 18 deletions
diff --git a/frontends/php/include/classes/ctriggerinfo.mod.php b/frontends/php/include/classes/ctriggerinfo.mod.php index ca71d9fe..adac98d9 100644 --- a/frontends/php/include/classes/ctriggerinfo.mod.php +++ b/frontends/php/include/classes/ctriggerinfo.mod.php @@ -19,15 +19,15 @@ **/ ?> <?php - class CTriggersInfo extends CTable - { + include_once('include/triggers.inc.php'); + + class CTriggersInfo extends CTable{ /* var $style; var $show_header; var $nodeid;*/ - function CTriggersInfo($style = STYLE_HORISONTAL) - { + function CTriggersInfo($style = STYLE_HORISONTAL){ $this->style = null; parent::CTable(NULL,"triggers_info"); @@ -36,8 +36,7 @@ $this->nodeid = get_current_nodeid(); } - function SetOrientation($value) - { + function SetOrientation($value){ if($value != STYLE_HORISONTAL && $value != STYLE_VERTICAL) return $this->error("Incorrect value for SetOrientation [$value]"); @@ -53,9 +52,12 @@ } function BodyToString(){ - global $USER_DETAILS; - $available_hosts = get_accessible_hosts_by_user($USER_DETAILS,PERM_READ_ONLY, PERM_RES_IDS_ARRAY, $this->nodeid); + $available_triggers = get_accessible_triggers(PERM_READ_ONLY, PERM_RES_IDS_ARRAY, $this->nodeid); + foreach($available_triggers as $id => $triggerid){ + if(trigger_dependent($triggerid)) unset($available_triggers[$id]); + } + $this->CleanItems(); $ok = $uncn = $info = $warn = $avg = $high = $dis = 0; @@ -68,9 +70,10 @@ ' AND h.status='.HOST_STATUS_MONITORED. ' AND t.triggerid=f.triggerid '. ' AND i.status='.ITEM_STATUS_ACTIVE. - ' AND '.DBcondition('h.hostid',$available_hosts). - ' GROUP BY priority,t.value'); + ' AND '.DBcondition('t.triggerid',$available_triggers). + ' GROUP BY t.priority,t.value'); while($row=DBfetch($db_priority)){ + switch($row["value"]){ case TRIGGER_VALUE_TRUE: switch($row["priority"]){ diff --git a/frontends/php/include/triggers.inc.php b/frontends/php/include/triggers.inc.php index d07a37f4..892b3143 100644 --- a/frontends/php/include/triggers.inc.php +++ b/frontends/php/include/triggers.inc.php @@ -2108,7 +2108,7 @@ * Comments: Recursive function * */ - function trigger_dependent_rec($triggerid,&$level){ + function trigger_dependent_rec($triggerid,&$level){ $ret = FALSE; $level++; @@ -2116,18 +2116,20 @@ /* Check for recursive loop */ if($level > 32) return $ret; - $result = DBselect("select t.triggerid, t.value from trigger_depends d,triggers t where d.triggerid_down=$triggerid and d.triggerid_up=t.triggerid"); - while($row = DBfetch($result)){ - $triggerid_tmp = $row["triggerid"]; - $value_tmp = $row["value"]; - if(TRIGGER_VALUE_TRUE == $value_tmp || trigger_dependent_rec($triggerid_tmp, $level)) - { + $sql = 'SELECT t.triggerid, t.value '. + ' FROM trigger_depends d, triggers t '. + ' WHERE d.triggerid_down='.$triggerid. + ' AND d.triggerid_up=t.triggerid'; + + $result = DBselect($sql); + while($row = DBfetch($result)){ + if(TRIGGER_VALUE_TRUE == $row['value'] || trigger_dependent_rec($row['triggerid'], $level)){ $ret = TRUE; break; } } - return $ret; + return $ret; } /* diff --git a/frontends/php/tr_status.php b/frontends/php/tr_status.php index c988a2c6..9503f0bd 100644 --- a/frontends/php/tr_status.php +++ b/frontends/php/tr_status.php @@ -448,6 +448,7 @@ include_once "include/page_header.php"; while($row=DBfetch($result)){ // Check for dependencies if(trigger_dependent($row["triggerid"])) continue; + $cond = ''; $event_expire = ($config['event_expire']*86400); // days switch($show_events){ |