Centos – Zabbix – Create Trigger that parse the time in a file

centoszabbix

I have a file that is written on each of my Zabbix clients with a time inside of it every hour.

I need the Zabbix server(s) to check these files and alert if the time is at least 6 hours old.

I cannot see where or how this trigger might be implemented and the Zabbix documentation does not give me enough detail.

Best Answer

The easiest solution would be to output Unix timestamp into the file and read that value using vfs.file.contents[] (see item documentation). This has the benefit that you can specify "unixtime" as the unit in item configuration and you will see a pretty value in "Latest data".

A trigger could then be as follows:

{host:vfs.file.contents[/tmp/timestamp.txt].now()} -
    {host:vfs.file.contents[/tmp/timestamp.txt].last()} > 6h