diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2002-05-21 19:46:52 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2002-05-21 19:46:52 +0000 |
| commit | 53e0448d2bbc13ce4539311d738fc8cf33bbdaff (patch) | |
| tree | bcd37c4c99a6e04484099e0817159fc5e89fe3ae /frontends/php/include | |
| parent | d59a50dc3183a8dbb6a7107b0d53bb583b7a9dfb (diff) | |
| download | zabbix-53e0448d2bbc13ce4539311d738fc8cf33bbdaff.tar.gz zabbix-53e0448d2bbc13ce4539311d738fc8cf33bbdaff.tar.xz zabbix-53e0448d2bbc13ce4539311d738fc8cf33bbdaff.zip | |
- fixed double posting of the same trigger status into alarms (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@381 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
| -rw-r--r-- | frontends/php/include/config.inc | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/frontends/php/include/config.inc b/frontends/php/include/config.inc index 005a763c..47d6f676 100644 --- a/frontends/php/include/config.inc +++ b/frontends/php/include/config.inc @@ -1133,6 +1133,16 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; return DBexecute($sql); } + function update_trigger_status_to_unknown_by_hostid($hostid) + { + $sql="select distinct t.triggerid from hosts h,items i,triggers t,functions f where f.triggerid=t.triggerid and f.itemid=i.itemid and h.hostid=i.hostid and h.hostid=$hostid"; + $result=DBselect($sql); + while($row=DBfetch($result)) + { + update_trigger_status($row["triggerid"],3); + } + } + # Update Host status function update_host_status($hostid,$status) @@ -1144,8 +1154,18 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; return 0; } - $sql="update hosts set status=$status where hostid=$hostid"; - return DBexecute($sql); + $sql="select status from hosts where hostid=$hostid"; + $result=DBselect($sql); + if($status != DBget_field($result,0,0)) + { + update_trigger_status_to_unknown_by_hostid($hostid); + $sql="update hosts set status=$status where hostid=$hostid"; + return DBexecute($sql); + } + else + { + return 1; + } } # Update Item definition @@ -1528,12 +1548,12 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid"; function add_alarm($triggerid,$istrue) { - $sql="select max(clock) from alarms"; + $sql="select max(clock) from alarms where triggerid=$triggerid"; $result=DBselect($sql); $row=DBfetch($result); if($row[0]!="") { - $sql="select istrue from alarms where clock=".$row[0]; + $sql="select istrue from alarms where triggerid=$triggerid and clock=".$row[0]; $result=DBselect($sql); if(DBnum_rows($result) == 1) { |
