Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-5218

Editing trigger prototype expression for already discovered triggers is generating orphaned triggers

XMLWordPrintable

      We have one poller configured to simplify debugging, discovery rule update interval - 60 seconds.

      Short scenario is:

      • a LLD discovery works; items, triggers already generated.

      ...

      • in one moment a trigger prototype expression has been changed from:
        Unknown macro: {it3}

        <5

      • In next execution of discovery rule we get (note insertion wrong functions and deleting them together with functions existing before):

      23079:20120620:143154.400 query [txnlev:1] [insert into functions (functionid,itemid,triggerid,function,parameter) values (15207,26700,221169,'last','0'),(15208,26701,221170,'last','0');
      ]
      23079:20120620:143154.401 query [txnlev:1] [update triggers set description='Free disk space is less than 10% on volume C:
      ',expression='

      {15207}

      <5',priority=2,comments='',url='',type=0,flags=4 where triggerid=221169;
      update trigger_discovery set name='Free disk space is less than 10% on volume

      {#FSNAME}' where triggerid=221169 and parent_triggerid=221158;
      delete from functions where triggerid=221169;
      update triggers set description='Free disk space is less than 10% on volume D:
      ',expression='{15208}<5',priority=2,comments='',url='',type=0,flags=4 where triggerid=221170;
      update trigger_discovery set name='Free disk space is less than 10% on volume {#FSNAME}

      ' where triggerid=221170 and parent_triggerid=221158;
      delete from functions where triggerid=221170;
      ]

      • In next execution of discovery rule we get (note creation new triggers, trigger_discovery, functions records):

      23079:20120620:143254.432 query [txnlev:1] [insert into triggers (triggerid,description,expression,priority,status,comments,url,type,value,value_flags,flags,error) values (221171,'Free disk space is less than 10% on volume C:
      ','

      {15209}

      <5',2,0,'','',0,0,1,4,'Trigger just added. No status update so far.'),(221172,'Free disk space is less than 10% on volume D:
      ','

      {15210}

      <5',2,0,'','',0,0,1,4,'Trigger just added. No status update so far.');
      ]
      23079:20120620:143254.433 query [txnlev:1] [insert into trigger_discovery (triggerdiscoveryid,triggerid,parent_triggerid,name) values (13,221171,221158,'Free disk space is less than 10% on volume

      {#FSNAME}'), (14,221172,221158,'Free disk space is less than 10% on volume {#FSNAME}

      ');
      ]
      23079:20120620:143254.433 query [txnlev:1] [insert into functions (functionid,itemid,triggerid,function,parameter) values (15209,26700,221171,'last','0'),(15210,26701,221172,'last','0');
      ]

      Note that between two discovery executions there are NO visible and working triggers for the host(s) !!!
      It can be even accidentally noticeable because update interval for rules usually can be enough big.

      In the result we have orphaned triggers (which were before) in the DB (triggers without functions) and if those triggers generated events - it will be visible in the events page if select All for host groups and hosts.
      In this case there are visible scary PHP errors bottom of the page.

      In the attachment you can see all these queries with all related parts with DebugLevel=4

      To find such triggers here is a simple SQL:
      select * from triggers where triggerid not in (select triggerid from functions)

      To delete orphaned event (if they are) and triggers here is two simple SQLs (order is important):
      delete from events where objectid in (select triggerid from triggers where triggerid not in (select triggerid from functions))
      delete from triggers where triggerid not in (select triggerid from functions)

            Unassigned Unassigned
            zalex_ua Oleksii Zagorskyi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: