Ad Widget

Collapse

How to use arithmetical operators in triggers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jpawlowski
    Member
    • May 2005
    • 45

    #1

    How to use arithmetical operators in triggers

    I'd like to calculate a delta between two items of a host and like the trigger to be TRUE if the delta is over the limit.

    I tried this trigger:

    ({Host:check_url_lastmod[http://example.com].now(0)}-{Host:check_url_lastmod[http://example.com].last(0)})>21600

    Unfortunately the system rejects this trigger to be false. so how could I realize it?
  • Alexei
    Founder, CEO
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2004
    • 5654

    #2
    Use function change(). Please, read ZABBIX Manual: http://www.zabbix.com/manual/v1.1/config_triggers.php
    Alexei Vladishev
    Creator of Zabbix, Product manager
    New York | Tokyo | Riga
    My Twitter

    Comment

    • jpawlowski
      Member
      • May 2005
      • 45

      #3
      could you please give me an example? I have no idea how this function should solve my problem...

      I don't want to check the difference between last and previous value. I would like to check if the timecode in seconds from that value od that item is older than 6 hours. btw I also do not want to be notified if the item hasn't been checked for longer than 6 hours...

      maybe I'm too stupid today...

      Comment

      • Alexei
        Founder, CEO
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Sep 2004
        • 5654

        #4
        It seems I misunderstood your question. My solution:

        {Host:check_url_lastmod[http://example.com].count(21600)}=1
        Alexei Vladishev
        Creator of Zabbix, Product manager
        New York | Tokyo | Riga
        My Twitter

        Comment

        • jpawlowski
          Member
          • May 2005
          • 45

          #5
          no that would only verify that I retrieved any value since the last 6 hours. that's not my point.

          I simply want to calculate the delta of time from the current moment to that time an internet URL has been last modified. I want to be notified if the URL hasn't been modified since 6 hours.

          so i wrote that script which returns the HTTP-Header "Last-Modified" in seconds since 00:00:00 UTC, January 1, 1970.

          this value is stored in zabbix and I want zabbix to compare this value with the current time in seconds 00:00:00 UTC, January 1, 1970.

          Manually I would now calculate this:

          1117552844sec - 1117539919sec = 12925 sec

          finally the triggers expression should check if the result is larger than 21600 seconds (6 hours).

          I thought I could use your function "now(0)" as it is described in your documentation. So why did you implement this function? If I could not use it I don't understand the sense...

          Comment

          • Alexei
            Founder, CEO
            Zabbix Certified Trainer
            Zabbix Certified SpecialistZabbix Certified Professional
            • Sep 2004
            • 5654

            #6
            Originally posted by jpawlowski
            I tried this trigger:

            ({Host:check_url_lastmod[http://example.com].now(0)}-{Host:check_url_lastmod[http://example.com].last(0)})>21600

            Unfortunately the system rejects this trigger to be false. so how could I realize it?
            The trigger expression should work. Is this trigger in UNKNOWN or FALSE state?
            Alexei Vladishev
            Creator of Zabbix, Product manager
            New York | Tokyo | Riga
            My Twitter

            Comment

            • jpawlowski
              Member
              • May 2005
              • 45

              #7
              neither UNKNOWN nor false...
              in fact I can't create the trigger but get the failure

              "ERROR:Invalid trigger expression"

              I would add it manually to the database but unfortunately this field is of binary type blob :-/

              btw of course I use the current alpha10...

              Comment

              • jpawlowski
                Member
                • May 2005
                • 45

                #8
                does nobody has any idea?

                I just changed my script passing the differnce to me but I think it's really unlovely not to have the real current timestamp...

                so again, why is there a function now() if I can't use it in any case?


                regards,
                Julian

                Comment

                • jpawlowski
                  Member
                  • May 2005
                  • 45

                  #9
                  ----------

                  Comment

                  Working...