View Full Version : How to use arithmetical operators in triggers
jpawlowski
31-05-2005, 16:49
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?
Use function change(). Please, read ZABBIX Manual: http://www.zabbix.com/manual/v1.1/config_triggers.php
jpawlowski
31-05-2005, 17:00
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...
It seems I misunderstood your question. My solution:
{Host:check_url_lastmod[http://example.com].count(21600)}=1
jpawlowski
31-05-2005, 17:24
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...
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?
jpawlowski
31-05-2005, 23:17
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...
jpawlowski
02-06-2005, 18:15
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
jpawlowski
02-06-2005, 19:03
----------