summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/triggers.inc.php
diff options
context:
space:
mode:
authoralex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-08-30 09:57:02 +0000
committeralex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-08-30 09:57:02 +0000
commit7fe4773ebfff9cbe8f02e86aaeceae87ba4bf661 (patch)
treecaf3a82ccd8bd303c367b1bd20c7881ce8229c4b /frontends/php/include/triggers.inc.php
parent6f7349254398d8758d6b4affcdb4afe8b646e7ff (diff)
downloadzabbix-7fe4773ebfff9cbe8f02e86aaeceae87ba4bf661.tar.gz
zabbix-7fe4773ebfff9cbe8f02e86aaeceae87ba4bf661.tar.xz
zabbix-7fe4773ebfff9cbe8f02e86aaeceae87ba4bf661.zip
- support of macro {ITEM.LASTVALUE} for notifications and trigger names (Alexei)
[svn merge -r4699:4702 svn://svn.zabbix.com/branches/1.4] git-svn-id: svn://svn.zabbix.com/trunk@4703 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/triggers.inc.php')
-rw-r--r--frontends/php/include/triggers.inc.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/frontends/php/include/triggers.inc.php b/frontends/php/include/triggers.inc.php
index 5ec350ab..9f202a88 100644
--- a/frontends/php/include/triggers.inc.php
+++ b/frontends/php/include/triggers.inc.php
@@ -1102,6 +1102,16 @@
if(is_null($row["host"])) $row["host"] = "{HOSTNAME}";
$description = str_replace("{HOSTNAME}", $row["host"],$description);
+
+ if(strstr($description,"{ITEM.LASTVALUE}"))
+ {
+ $row2=DBfetch(DBselect('select i.lastvalue from items i, triggers t, functions f '.
+ ' where i.itemid=f.itemid and f.triggerid=t.triggerid and '.
+ ' t.triggerid='.$row["triggerid"]));
+
+ if(is_null($row2["lastvalue"])) $row["lastvalue"] = "{ITEM.LASTVALUE}";
+ $description = str_replace("{ITEM.LASTVALUE}", $row2["lastvalue"],$description);
+ }
}
else
{
@@ -1114,7 +1124,7 @@
{
return expand_trigger_description_by_data(
DBfetch(
- DBselect("select distinct t.description,h.host,t.expression".
+ DBselect("select distinct t.description,h.host,t.expression,t.triggerid ".
" from triggers t left join functions f on t.triggerid=f.triggerid ".
" left join items i on f.itemid=i.itemid ".
" left join hosts h on i.hostid=h.hostid ".