lausser / check_nwc_health

nwc = network component. This plugin checks lots of aspects of routers, switches, wlan controllers, firewalls,.....
http://labs.consol.de/nagios/check_nwc_health
GNU General Public License v2.0
146 stars 88 forks source link

Fixed Sensor Warnings for non-numeric comparison #317

Open arnotron opened 1 year ago

arnotron commented 1 year ago

Hello, we encountered the same problem referenced in #310 - With check_nwc_health version 10.0 the error looks as follows:

Argument "ON" isn't numeric in numeric eq (==) at /usr/lib64/nagios/plugins/check_nwc_health line 71087. Argument "LOST" isn't numeric in numeric eq (==) at /usr/lib64/nagios/plugins/check_nwc_health line 71087. CRITICAL - sensor PSU [2] alarm status is true | 'sensor_PSU [1] '=0;;;; 'sensor_PSU [2] '=0;;;;

Unfortunately, even after applying the fix from dcec checking the value for being actually "-1" in string comparison before doing a numeric eq, I received another error:

Argument "ON" isn't numeric in sprintf at ./check_nwc_health.new line 514. Argument "LOST" isn't numeric in sprintf at ./check_nwc_health.new line 514. CRITICAL - sensor PSU [2] alarm status is true | 'sensor_PSU [1] '=0;;;; 'sensor_PSU [2] '=0;;;;

So I dusted off my perl skills and tried to fix that, too, by sending perfdata only if the value is numeric. Please let me know if this is sufficient and the proper way to do it.