Zabbix: How do I configure a Trigger which will check if a specific value has been changed in the last 10 minutes?

Itai Ganot asked:

I’ve been given the task to monitor a specific value in some MySQL server database, I need to raise a notification if the value has not been changed in the last 10 minutes.

I’ve added to the UserParameter_mysql.conf the following line:

UserParameter=mysql.query, echo "select id from resolved_clicks order by id desc limit 1" | mysql -N -u zabbix -pPASSWORD aggregator

And when running a check from the Zabbix server, it returns the value correctly:

[root@zabbix ~]# zabbix_get -s IP -k mysql.query
7957178672
[root@zabbix ~]#

The next step was to create an Item which I’ve already done so and now I’m trying to configure the Trigger.
The trigger should arise a notification if the value has not been updated in the last 10 minutes.
How can I configure the trigger to reflect this condition? Thanks!

Edit #1:
Here’s the Latest data from the trigger I’ve just created:
enter image description here
My questions are:

1. What's the meaning of change? 
2. How can I know from looking on the Change row how many seconds 
   have passed since the last 2 checks?
3. How can I test that the trigger is operating successfully without
   having to reproduce the problem?

My answer:


Your question is not 100% clear, so I’ve covered both possibilities:


If you want to check whether data is not arriving from the Zabbix agent, use the nodata function.

Returns:
1 – if no data received during period of time in seconds. The period should not be less than 30 seconds.
0 – otherwise

For example, a trigger which will fire if no data was received for 10 minutes:

{mysql.query.nodata(600)}=1

If you want to check whether the value has not changed, use delta.

Returns the difference between the maximum and minimum values in a period (‘max()’ minus ‘min()’). The period is set in seconds or as a number of collected values (preceded by a # hash mark) in the first parameter.

For example, a trigger which will fire if the value has not changed for 10 minutes:

{mysql.query.delta(600)}=0

Finally, you probably want to rename your item. mysql.query is very generic, and is already used by common MySQL templates. Something like aggregator.highest_click_id might be more appropriate.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.