Using check_snmp with a string - critical when matched


I’ve got some old HP printers that don’t respond properly to check_toner. I’m trying to use check_snmp to get an alert when the toner is low. I have the string check confirmed as working, but I can’t see how to get it to alert when a match is made since it returns OK on a match. It think this would be a good use for negate, but that plugin doesn’t work in 1.4.15.

Here is the check I’m testing with:

check_snmp -C public -H -o -s '"TONER LOW"'

This returns OK when the status is TONER LOW. Any other status returns Critical, but I need it to work the other way.


negate should do what you need.
Negate only changes the exit code so the output will still be OK. but you should see it as a critical in nagios.