Fixed Sensor Warnings for non-numeric comparison #317
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.