summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/items.inc.php
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-10-05 07:44:43 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-10-05 07:44:43 +0000
commitbf8fdb722259feff714daa58d33061fb844421a6 (patch)
tree0575a1452eb807b7b5bca849f0f45f60a1751f5d /frontends/php/include/items.inc.php
parent91e65e1a77c5a4f500a70f115978388da7951122 (diff)
downloadzabbix-bf8fdb722259feff714daa58d33061fb844421a6.tar.gz
zabbix-bf8fdb722259feff714daa58d33061fb844421a6.tar.xz
zabbix-bf8fdb722259feff714daa58d33061fb844421a6.zip
- fixed "Add items from template" functionality (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@2106 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/items.inc.php')
-rw-r--r--frontends/php/include/items.inc.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/frontends/php/include/items.inc.php b/frontends/php/include/items.inc.php
index cb57ef9e..d9bc8ebe 100644
--- a/frontends/php/include/items.inc.php
+++ b/frontends/php/include/items.inc.php
@@ -186,6 +186,23 @@
return $result;
}
+ function sync_items_with_template_host($hostid,$host_templateid)
+ {
+ $sql="select itemid from items where hostid=$host_templateid";
+ $result=DBselect($sql);
+ while($row=DBfetch($result))
+ {
+ $item=get_item_by_itemid($row["itemid"]);
+
+ $sql="select itemid from items where key_=\"".$item["key_"]."\" and hostid=$hostid";
+ $result2=DBselect($sql);
+ if(DBnum_rows($result2)==0)
+ {
+ add_item($item["description"],$item["key_"],$hostid,$item["delay"],$item["history"],$item["status"],$item["type"],$item["snmp_community"],$item["snmp_oid"],$item["value_type"],$item["trapper_hosts"],$item["snmp_port"],$item["units"],$item["multiplier"],$item["delta"],$item["snmpv3_securityname"],$item["snmpv3_securitylevel"],$item["snmpv3_authpassphrase"],$item["snmpv3_privpassphrase"],$item["formula"],$item["trends"],$item["logtimefmt"]);
+ }
+ }
+ }
+
# Add item to hardlinked hosts
function add_item_to_linked_hosts($itemid,$hostid=0)