Ad Widget

Collapse

Trouble with arithmetic expressions in triggers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • knarfling
    Member
    • Sep 2006
    • 47

    #1

    Trouble with arithmetic expressions in triggers

    I am trying to test to see if a file has been changed in the last hour. I set up a trigger to test now - vfs.file.time[file].last(0)>3600. I kept getting an Expression Error 0-0>600.

    After a little more testing I tried now + 600 > vfs.file.time[file].last(0). This let me create the expression, but it always showed failure. When I checked the server log I got
    Code:
    031506:20060921:202042 Evaluation of expression [(1158870042.000000)+600>({12404})] failed [Unable to get value for functionid [12404]]
    031506:20060921:202042 Expression [({12403})+600 >({12404})] cannot be evaluated [Unable to get value for functionid [12404]]
    Checking the mysql table functions I see
    Code:
    |      12403 |  19476 |     13251 | 1158871801   | now      | 0         |
    |      12404 |  19474 |     13251 | 1158870635   | last     | 1         |
    I am wondering if perhaps the number is too large and is being evaluated to 0 or if there is something else I am missing that might be causing the trouble.

    If the number is too large, can I use arithmetic functions in items so that the number collected is smaller?

    Thanx for any help.
  • Alexei
    Founder, CEO
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2004
    • 5654

    #2
    Please check if it works now. The warning normally means that a trigger is not updated yet (what is refresh period for the item?), so expression cannot be evaluated due to missing data in functions. As soon as ZABBIX gets new values for all items participating in a trigger, the situation recovers automatically.
    Alexei Vladishev
    Creator of Zabbix, Product manager
    New York | Tokyo | Riga
    My Twitter

    Comment

    • knarfling
      Member
      • Sep 2006
      • 47

      #3
      Still not working

      Nope, still not working.

      If I wait long enough, the function error goes away until I make a change to the formula, but the trigger turns to on and then to unknown. Because the value is set to unknown, I can't even get an email sent to me with the value of the expression, so I do not know what it is evaluating to. I have tried several time to change it back to now-vfs.file.time>600, but I still keep getting the Invalid Expression 0-0>600 error.

      The refresh period is 30 second and the collection interval for every item is 30 seconds.

      Comment

      • knarfling
        Member
        • Sep 2006
        • 47

        #4
        Update

        Okay, I have an update.

        The trouble appears to be in the php when it tests the trigger before updating it. As close as I can tell, when I put an arithmatic condition in the trigger expression, it takes time to update the expression. It is almost as if it creates a temporary function that is not saved in the database. But, for some reason, it cannot populate the function and returns a zero. Then the expression checker says that you cannot have a zero minus zero expression.

        I solved this by creating a fictional expression. In this case I tried now + 600 > last modified. Because it was a 0+600 > 0 it gave an error, but I still do not understand why it did not work properly. I then went in and manually updated the trigger directly in mysql back to now-last_modified>600 and it started working.

        The only problem is that if I want to modify the trigger in any way, I must go directly into mysql and make the change.

        Comment

        Working...