-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Labels
Milestone
Description
Original report by Gabriel Hege (Bitbucket: datensuppe, ).
When passing None as a warning or critical range to the Context or ScalarContext constructor, it uses "0:" for evaluation. This results in a warning or critical status to be written, when the value of the Metric is negative. This is very counterintuitive, because one would expect no warning or critical alert to be generated, especially since the range string does not show in the performance data.
Here is a minimal example:
#!python
import nagiosplugin
class Sensors(nagiosplugin.Resource):
def probe(self):
return nagiosplugin.Metric('sens1', -3)
check = nagiosplugin.Check(Sensors(), nagiosplugin.ScalarContext('sens1', warning="-10:10"))
check.main()
which generates the following output:
SENSORS CRITICAL - sens1 is -3 (outside range 0:) | sens1=-3;-10:10