diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-08-29 10:06:42 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2005-08-29 10:06:42 +0000 |
| commit | 450bedfbd08dbb30b3a6fa47abe411e2bc689024 (patch) | |
| tree | b2a57904c928e0d63785109b7d8db93723e8e365 /frontends/php/include/actions.inc.php | |
| parent | 2ce640571ab5c0db1a26858f96ba804e36f1fb37 (diff) | |
- misc fixes for host-templates linkage (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@2009 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/actions.inc.php')
| -rw-r--r-- | frontends/php/include/actions.inc.php | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/frontends/php/include/actions.inc.php b/frontends/php/include/actions.inc.php index d6e403a1..10a732c2 100644 --- a/frontends/php/include/actions.inc.php +++ b/frontends/php/include/actions.inc.php @@ -101,7 +101,7 @@ # Add action to hardlinked hosts - function add_action_to_templates($actionid) + function add_action_to_linked_hosts($actionid,$hostid=0) { if($actionid<=0) { @@ -117,12 +117,18 @@ { return; } - $row=DBfetch($result); - $hostid=$row["hostid"]; + $host_template=get_host_by_hostid($row["hostid"]); - $sql="select hostid,templateid,actions from hosts_templates where templateid=$hostid"; + if($hostid==0) + { + $sql="select hostid,templateid,actions from hosts_templates where templateid=".$row["hostid"]; + } + else + { + $sql="select hostid,templateid,actions from hosts_templates where hostid=$hostid and templateid=".$row["hostid"]; + } $result=DBselect($sql); while($row=DBfetch($result)) { @@ -132,7 +138,9 @@ $result2=DBselect($sql); while($row2=DBfetch($result2)) { - add_action($row2["triggerid"], $action["userid"], $action["good"], $action["delay"], $action["subject"], $action["message"], $action["scope"], $action["severity"], $action["recipient"], $action["userid"]); + $host=get_host_by_hostid($row["hostid"]); + $message=str_replace("{".$host_template["host"].":", "{".$host["host"].":", $action["message"]); + add_action($row2["triggerid"], $action["userid"], $action["good"], $action["delay"], $action["subject"], $message, $action["scope"], $action["severity"], $action["recipient"], $action["userid"]); } } } |
