varnish / varnish-nagios

Nagios plugin for Varnish
Other
21 stars 9 forks source link

Varnish 4.1 MAIN.uptime should have inverted check #12

Closed StoneISStephan closed 7 years ago

StoneISStephan commented 7 years ago

We want to monitor if the Varnish child has been restarted within the last hour, aka if it has been running for less than 3600 seconds. But the check only checks if it has been running for longer than 3600 seconds.

So the check should be "if actual value below treshold" instead of above.

# /usr/lib/nagios/plugins/check_varnish -p MAIN.uptime -w 7200 -c 3600; echo $?
VARNISH OK: Child process uptime (2,985)|MAIN.uptime=2985
0

Is unexpected behaviour.

We are expecting:

# /usr/lib/nagios/plugins/check_varnish -p MAIN.uptime -w 7200 -c 3600; echo $?
VARNISH CRITICAL: Child process uptime (2,985)|MAIN.uptime=2985
2
StoneISStephan commented 7 years ago

Closing this issue as self-resolved, the documentation doesn't say it, but by reading the C-code I found that using @ in front of the value allows you to invert it.

 /usr/lib/nagios/plugins/check_varnish -p MAIN.uptime -w @10000 -c @5000; echo $?
VARNISH CRITICAL: Child process uptime (4,046)|MAIN.uptime=4046
2

Works like a charm!