diff options
author | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-08-01 08:36:39 +0000 |
---|---|---|
committer | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2007-08-01 08:36:39 +0000 |
commit | d287bd3f8fcb0f9f33f139bafb98d736553ac7df (patch) | |
tree | 13d0d0e049dd803dea2c81dd249222b6fed42c9a | |
parent | 670a807481687e80a2dda4ba67f6c6988e1c1011 (diff) | |
download | zabbix-d287bd3f8fcb0f9f33f139bafb98d736553ac7df.tar.gz zabbix-d287bd3f8fcb0f9f33f139bafb98d736553ac7df.tar.xz zabbix-d287bd3f8fcb0f9f33f139bafb98d736553ac7df.zip |
- merged rev. 4492:4494 of branches/1.4.2/ (Artem) [fixed getting trigger priority - fixed updating services]
git-svn-id: svn://svn.zabbix.com/trunk@4495 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r-- | frontends/php/include/services.inc.php | 13 | ||||
-rw-r--r-- | frontends/php/include/triggers.inc.php | 7 | ||||
-rw-r--r-- | src/libs/zbxdbhigh/host.c | 8 |
3 files changed, 12 insertions, 16 deletions
diff --git a/frontends/php/include/services.inc.php b/frontends/php/include/services.inc.php index 9b951592..f0c14362 100644 --- a/frontends/php/include/services.inc.php +++ b/frontends/php/include/services.inc.php @@ -141,7 +141,7 @@ * retrive true status * * Author: - * Artem Suahrev + * Artem Suharev * * Comments: * @@ -207,7 +207,7 @@ * removes any links between trigger and service if service is not leaf (treenode) * * Author: - * Artem Suahrev + * Artem Suharev * * Comments: * @@ -825,7 +825,7 @@ function update_services($triggerid, $status){ * Cleaning parent nodes from triggers, updating ALL services status. * * Author: - * Artem Suahrev + * Artem Suharev * * Comments: !!! Don't forget sync code with C !!! * @@ -833,12 +833,9 @@ function update_services($triggerid, $status){ function update_services_status_all(){ - clear_parents_from_trigger(); + clear_parents_from_trigger(); - $result = DBselect('SELECT sl.servicedownid as serviceid,s.algorithm,s.triggerid '. - ' FROM services_links as sl, services as s '. - ' WHERE s.serviceid = sl.servicedownid '. - ' GROUP BY sl.servicedownid'); + $result = DBselect('SELECT s.serviceid,s.algorithm,s.triggerid FROM services as s '); while($rows=DBfetch($result)){ $status = get_service_status($rows['serviceid'],$rows['algorithm'],$rows['triggerid']); diff --git a/frontends/php/include/triggers.inc.php b/frontends/php/include/triggers.inc.php index 4eba2c6c..7d451fca 100644 --- a/frontends/php/include/triggers.inc.php +++ b/frontends/php/include/triggers.inc.php @@ -266,18 +266,19 @@ * Function: get_trigger_priority * * Description: - * retrive triggers priority + * retrive trigger's priority * * Author: - * Artem Suahrev + * Artem Suharev * * Comments: * */ function get_trigger_priority($triggerid){ - $sql = 'SELECT count(*) as count, priority FROM triggers WHERE triggerid='.$triggerid.' GROUP BY priority'; + $sql = 'SELECT count(*) as count, priority FROM triggers WHERE triggerid='.$triggerid.' AND status=0 GROUP BY priority'; $rows = DBfetch(DBselect($sql)); + if($rows && !is_null($rows['count']) && !is_null($rows['priority']) && ($rows['count'] > 0)){ $status = $rows['priority']; } diff --git a/src/libs/zbxdbhigh/host.c b/src/libs/zbxdbhigh/host.c index 715f5eda..8dac06d1 100644 --- a/src/libs/zbxdbhigh/host.c +++ b/src/libs/zbxdbhigh/host.c @@ -278,7 +278,7 @@ static int DBget_service_status( if( 0 != triggerid ) { - result = DBselect("select priority from triggers where trigerid=" ZBX_FS_UI64, triggerid); + result = DBselect("select priority from triggers where trigerid=" ZBX_FS_UI64 " and status=0 ", triggerid); if( (row = DBfetch(result)) ) { status = atoi(row[0]); @@ -414,10 +414,8 @@ static void DBupdate_services_status_all(void) DBclear_parents_from_trigger(0); - result = DBselect("SELECT sl.servicedownid as serviceid,s.algorithm,s.triggerid " - " FROM services_links as sl, services as s " - " WHERE s.serviceid = sl.servicedownid " - " GROUP BY sl.servicedownid"); + result = DBselect("SELECT s.serviceid,s.algorithm,s.triggerid FROM services as s"); + while( (rows = DBfetch(result)) ) { ZBX_STR2UINT64(serviceid, rows[0]); |