Relates to http://zabbix.com/forum/showthread.php?t=9305.
This patch (against 1.4.5) allows to import several triggers with the same description and different expressions.
This patch (against 1.4.5) allows to import several triggers with the same description and different expressions.
Code:
--- include/import.inc.php (rev 1.4.5)
+++ include/import.inc.php 2008-04-02 02:32:08.000000000 +0200
@@ -388,11 +388,22 @@
$this->data[XML_TAG_HOST]['name'],
$data['expression']);
- if($trigger = DBfetch(DBselect('select distinct t.triggerid,t.templateid '.
+ $result = DBselect('select distinct t.triggerid,t.templateid,t.expression '.
' from triggers t,functions f,items i '.
' where t.triggerid=f.triggerid and f.itemid=i.itemid'.
' and i.hostid='.$this->data[XML_TAG_HOST]['hostid'].
- ' and t.description='.zbx_dbstr($data['description']))))
+ ' and t.description='.zbx_dbstr($data['description']));
+
+ while($trigger = DBfetch($result))
+ {
+ if(explode_exp($trigger['expression'],0) == $data['expression'])
+ {
+ break;
+ }
+
+ }
+
+ if(!empty($trigger))
{ /* exist */
if($this->trigger['exist']==1) /* skip */
{
Comment