Ad Widget

Collapse

Cannot update trigger error (Trigger already exists) when changing template

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Netbulae
    Junior Member
    • Jul 2009
    • 27

    #1

    Cannot update trigger error (Trigger already exists) when changing template

    Hi,

    We have a zabbix postgresql 5.0.19 install with many hosts. All these hosts inherit from a specific template with a couple triggers.

    Currently I need to change a dependency in the template but I cannot apply the change as it complains one of the triggers already exists.

    When looking at the host it has two triggers with the same name inherited from the template. But one of these is an older version.

    This could explain some of the issues we have with this trigger.

    Trying to delete the trigger gives me a "Cannot delete triggers" error. There are probably more hosts with this faulty trigger.

    How do I get rid of the old trigger without purging all the historical events of this trigger? Or even with the loss of the trigger history?

    Would removing the trigger from the template completely remove both of them?

    The database is currently 550 GB with 19000+ hosts so it's not something I can experiment with at the moment.
  • Brambo
    Senior Member
    • Jul 2023
    • 245

    #2
    For a better understanding on the workings.
    A template is basically a host without an interface, every item-key on a host must be unique. (so linking templates applies on this as well as the master template acts a 'host')
    You first must clear the active problems before you can deleted the trigger because everything is related (how could a problem close if there is no definition to close it and manual is not allowed (that is a checkbox you set on the trigger) )

    Depending on the situation, you can close the problems in a few ways. 1 make the manual close possible, 2 set a recovery expression which matches very easily.
    Keep in mind changing things could take up to 2 minutes to take effect but can be 'forced' with a server config reload. (waiting and grab a cup of coffee is a good practice )

    Your questions about the history I'm not sure, editing a trigger will keep history (I Think), deleting and/or creating a new one will be a new trigger history for that trigger.

    Comment

    • Netbulae
      Junior Member
      • Jul 2009
      • 27

      #3
      Hi,

      Thanks for answering, but it's not entirely the situation I'm in.

      There are no active problems on the trigger and I have two triggers inherited from the same single templated trigger.
      One is the older version and one the newer of the templated trigger.

      So now I cannot change the trigger again and I am unable to remove one of the triggers that are inherited from the host.

      Comment

      • landon_l9
        Junior Member
        • Aug 2024
        • 4

        #4
        This may be a new bug in Zabbix, not sure what causes it... I was able to solve mine by editing the expression on all the triggers. I just slapped an "=1" at the end of the expression, saved, re-opened it and removed it. Seems to allow editing now.

        Comment

        • landon_l9
          Junior Member
          • Aug 2024
          • 4

          #5
          Upon comparing my newest template export to the last version, it looks like this may be due to some field named 'delay' and 'trends'. These aren't fields I see in the web UI. I'm guessing this may be something that I created by accident with the API, since this is a template I've modified with the API in the past.

          Click image for larger version

Name:	image.png
Views:	471
Size:	29.6 KB
ID:	489231

          Comment

          • cyber
            Senior Member
            Zabbix Certified SpecialistZabbix Certified Professional
            • Dec 2006
            • 4806

            #6
            "delay" is "Update interval". "Trends" is "Trend storage period". Delay does not affect dependent items, but trends storage should be there... 0 means no trends...

            Comment

            • Brambo
              Senior Member
              • Jul 2023
              • 245

              #7
              Originally posted by landon_l9
              Upon comparing my newest template export to the last version, it looks like this may be due to some field named 'delay' and 'trends'. These aren't fields I see in the web UI. I'm guessing this may be something that I created by accident with the API, since this is a template I've modified with the API in the past.

              Click image for larger version

Name:	image.png
Views:	471
Size:	29.6 KB
ID:	489231
              And the change on line 367 isn't a issue, looks like something is removed there

              Comment

              • Netbulae
                Junior Member
                • Jul 2009
                • 27

                #8
                I got it fixed by doing a query on the triggers that have an older version of the trigger expression and deleting all of them.

                Then I shut down the incoming messages to save load on the database and applied an updated trigger template. Everything works smoothly now.

                So it must be some issue with the template update timing out before it's applied to all hosts due to the database being busy.

                Thanks all for responding.

                Comment

                Working...