You should create a user parameter with content similar to the following:
UserParameter=yum.updates,/usr/bin/yum --debuglevel 2 --security check-update 2>/dev/null | grep -P '(?<! 0 packages) available$'
Place this line either into the main configuration file for Zabbix agent (zabbix_agentd.conf) or into a separate file (which might be better if you are planning on distributing this user parameter on a lot of servers) and include it or its directory using
In the current form, you have a user parameter than returns a string, so in Zabbix frontend you would configure an item with key
yum.updates and type of "Character". A trigger would then be:
However, the problem with string items is that they cannot be graphed. It would be nice to have an item that returns an integer with the number of updates available, like so (note the trailing part):
UserParameter=yum.updates,/usr/bin/yum --debuglevel 2 --security check-update 2>/dev/null | grep -P '...' || echo 0
You will also have to change the regular expression in the
grep so that it returns only an integer.
The benefit of this approach is that the number of available updates can be graphed and you can also set a higher threshold for the trigger:
See also official documentation on user parameters for full details.