Ad Widget

Collapse

Making triggers between templates and hosts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • marcusg
    Junior Member
    • Jun 2012
    • 4

    #1

    Making triggers between templates and hosts

    Hi,

    I've previously (In Zabbix 1.8.5 I believe) configured Templates that can have triggers that use items in the template and items on a static host.
    (For example, we have a SVN replica lag check, so we have a Template for each SVN replica that checks the current SVN version and then compares that with the master).
    Since we've upgraded to 1.8.13 however the old triggers are still there, but I can't add any new similar triggers. Even when I go into one of the old triggers and push save it complains with:

    "Incorrect trigger expression. Trigger expression elements cannot not belong to a template and a host simultaneously."

    Is this intentional so the only way to do it is to manually setup every trigger between each slave and the master or have I just missed something?
  • anpat89
    Junior Member
    • Jun 2012
    • 17

    #2
    [Solution] import Templates

    Hi Marcus,
    It's been a week since your post so I hope you have figured it out, but I will post this for other people having trouble.

    I stumbled across another forum which had a similar issue regarding no Triggers.
    Firstly, go into your server through SSL connection, and install php-xml:
    This allows you to import templates.
    yum -y install php-xml

    Then grab the required templates (includes triggers):
    http://www.zabbix.com/wiki/templates/start
    Scroll down the bottom where it says "Operating Systems".

    Go to your Zabbix Administration, and click on Configuration, then Export/Import. Select Import on the right, and then select the XML files that you just downloaded. Should say "import successful" and now you have your triggers.

    Before this I spent a good bit of time within the source directory of Zabbix having a poke but not really finding anything useful.

    Kind Regards,
    Andrew

    Tags: no triggers in zabbix 1.8.3 import template

    Comment

    • anpat89
      Junior Member
      • Jun 2012
      • 17

      #3
      [update] Triggers Disabled

      You will find that it still says "no triggers defined" so you have to click on "show disabled triggers" to see the triggers. Then change them all to "enabled".

      An easier way to do this for all your hosts, is you can update the templates. So under Configuration/Hosts, select Triggers from the drop down menu, select the group as "ALL". Then check the box to make all selected and down the bottom select "Activate Selected" and click "Go".

      Regards,
      Andrew

      Comment

      • marcusg
        Junior Member
        • Jun 2012
        • 4

        #4
        Hi Andrew,

        Well, it wasn't that the triggers hadn't been imported when I upgraded (they were), but that the rules for the triggers have changed.

        Previously I had triggers in templates that compared items in the template to items in a host (which made pushing out tests for say DNS slaves, SVN replicas et.c pretty easy), but this seems to be forbidden now (which is the issue).

        I was wondering if there were any workaround so I can create such a template that compares itself with a host rather than another item in the same template?

        Comment

        • anpat89
          Junior Member
          • Jun 2012
          • 17

          #5
          I misread the question.
          This is out of my level of expertise.
          Sorry for the inconvenience.
          To assist the answerer, what is the code in the triggers at the moment?

          Comment

          • marcusg
            Junior Member
            • Jun 2012
            • 4

            #6
            Oh well, thanks for trying at least.

            The trigger expression we want to add is:
            Code:
            ({Template_SVN_replica:svn.revision[mainrepo].last(#0)}<{svn.office.probability.co.uk:svn.revision[mainrepo].last(#0)})&({Template_SVN_replica:svn.revision[mainrepo].last(#0)}={Template_SVN_replica:svn.revision[mainrepo].last(#1)})
            We've previously used

            Code:
            {Template_DNS_slave:dns_soa_check.sh["probability.co.uk"].last(0)}#{dns1.office.probability.co.uk:dns_soa_check.sh["probability.co.uk"].last(0)}
            which is still in there, we haven't double-checked that it still works though, and we can't edit it anymore.

            Comment

            • Yello
              Senior Member
              • Apr 2011
              • 309

              #7
              Hi,
              I think this is the way it is currently designed to behave. So when I first read your post i was suprised that it had ever worked as you've shown.

              But there are ways around it:

              1. Use a calculated item to derive a normalised value. Calculated items can reference "other" hosts.
              2. Modify your external script to do the data check of the static host outside of zabbix and return a normalised value.

              In both cases, as the value changes you can trigger on it.


              Regards,
              David

              Comment

              • marcusg
                Junior Member
                • Jun 2012
                • 4

                #8
                Ah, it wouldn't be too hard to put in a calculated item I guess, but it seems a bit odd as we'd have to store the data once per each server in the template or is it calculated on the fly?

                Anywho, it does solve our problem, so thanks a lot!

                Comment

                • Yello
                  Senior Member
                  • Apr 2011
                  • 309

                  #9
                  Originally posted by marcusg
                  Ah, it wouldn't be too hard to put in a calculated item I guess, but it seems a bit odd as we'd have to store the data once per each server in the template or is it calculated on the fly?

                  Anywho, it does solve our problem, so thanks a lot!
                  I did say that web checks, while useful, are not perfect - either functionally or non-functionally Raise a feature request and see what feedback you get.


                  Regards,
                  David

                  Comment

                  • furibe
                    Junior Member
                    • May 2011
                    • 1

                    #10
                    Add a trigger for one host and copy it to the rest of the "templated" hosts. Zabbix replaces "this host" with the "copy-to-host". Keep your templated hosts in a group for easier maintenance. For updating the trigger you have to mass-delete it, update the first one and copy it again.

                    Comment

                    Working...