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

Discovery action based host removal fails on triggers created by item discovery

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.4.8rc1, 3.0.0alpha5
    • 2.4.7rc1
    • Server (S)
    • mysql Ver 15.1 Distrib 10.0.20-MariaDB, for Linux (x86_64) using readline 5.1

      There is a discovery based action, that removes registered hosts.
      I the host has a trigger, that was created by item discovery, the removal fails with:

      [Z3005] query failed: [1451] Cannot delete or update a parent row: a foreign key constraint fails (`zabbix`.`trigger_discovery`, CONSTRAINT `c_trigger_discovery_2` FOREIGN KEY (`parent_triggerid`) REFERENCES `triggers` (`triggerid`)) [delete from triggers where (triggerid between 22917 and 22921 or triggerid in (22934,22935,22936));
      

      The code tries to delete the triggers "triggerid between 22917 and 22921". As there is trigger_discovery table with foreign key to triggers table, the lookup of dependent records is being performed and "or triggerid in (22934,22935,22936)" clause is added.
      But it seems, that mysql does not understand that the resulting combination will remove all the necessary triggers.
      If the added clause is executed seperately, the the original statement succeeds:

      delete from triggers where triggerid in (22934,22935,22936);
      delete from triggers where (triggerid between 22917 and 22921 or triggerid in (22934,22935,22936));
      

      Also if the parent triggerid is already in the original list, no clause is added, thus requiring a manual query to determine the failing triggerid:

      select * from trigger_discovery where parent_triggerid between 22215 and 22220;
      delete from triggers where triggerid=22220;
      delete from triggers where triggerid between 22215 and 22220;
      

            Unassigned Unassigned
            Wano Bruno Vanters
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: