[Pkg-nagios-devel] Bug#609011: (no subject)
Thomas Guyot-Sionnest
dermoth at aei.ca
Thu Jan 6 04:03:02 UTC 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
This fails because a threshold was specified, which was superfluous.
This is the behavior of 1.4.14 and earlier, and the reason your check
worked in 1.4.15 was a regression.
I wrote a test. Then using the test I can clearly explain check_snmp's
behaviour:
This is the patched version of 1.4.15:
> $ ./check_snmp -p 16127 -H localhost -o .1.3.6.1.4.1.8072.3.2.67.15
> SNMP OK - "CUSTOM CHECK OK: foo is 12345" |
No check - OK
> $ ./check_snmp -p 16127 -H localhost -o .1.3.6.1.4.1.8072.3.2.67.15 -r 'CUSTOM CHECK OK'
> SNMP OK - "CUSTOM CHECK OK: foo is 12345" |
String match - OK
> $ ./check_snmp -p 16127 -H localhost -o .1.3.6.1.4.1.8072.3.2.67.15 -r 'CUSTOM CHECK FAIL'
> SNMP CRITICAL - *"CUSTOM CHECK OK: foo is 12345"* |
String doesn't match - FAIL
> $ ./check_snmp -p 16127 -H localhost -o .1.3.6.1.4.1.8072.3.2.67.15 -r 'CUSTOM CHECK OK' -c0
> SNMP CRITICAL - *12345* | iso.3.6.1.4.1.8072.3.2.67.15=12345
Critical threshold 0 specified: check_snmp parses the number and detect
a failure (over threshold).
> $ ./check_snmp -p 16127 -H localhost -o .1.3.6.1.4.1.8072.3.2.67.15 -r 'CUSTOM CHECK FAIL' -c0
> SNMP CRITICAL - *12345* | iso.3.6.1.4.1.8072.3.2.67.15=12345
> $
Critical threshold 0 specified: check_snmp parses the number and detect
a failure. This is to show that "-c 0" does not affect the behaviour of
the string check; instead it inhibits it.
As you can see below, the 1.4.14 version works exactly the same way:
> $ ./check_snmp -p 16127 -H localhost -o .1.3.6.1.4.1.8072.3.2.67.15
> SNMP OK - "CUSTOM CHECK OK: foo is 12345" |
> $ ./check_snmp -p 16127 -H localhost -o .1.3.6.1.4.1.8072.3.2.67.15 -r 'CUSTOM CHECK OK'
> SNMP OK - "CUSTOM CHECK OK: foo is 12345" |
> $ ./check_snmp -p 16127 -H localhost -o .1.3.6.1.4.1.8072.3.2.67.15 -r 'CUSTOM CHECK FAIL'
> SNMP CRITICAL - *"CUSTOM CHECK OK: foo is 12345"* |
> $ ./check_snmp -p 16127 -H localhost -o .1.3.6.1.4.1.8072.3.2.67.15 -r 'CUSTOM CHECK OK' -c0
> SNMP CRITICAL - *12345* | iso.3.6.1.4.1.8072.3.2.67.15=12345
> $ ./check_snmp -p 16127 -H localhost -o .1.3.6.1.4.1.8072.3.2.67.15 -r 'CUSTOM CHECK FAIL' -c0
> SNMP CRITICAL - *12345* | iso.3.6.1.4.1.8072.3.2.67.15=12345
And to justify once more the change, consider this check in 1.4.14:
> $ ./check_snmp -Hlocalhost -Cpublic -osystem.sysUpTime.0 -c10000: -u'1/100 sec'
> SNMP OK - 55729143 1/100 sec | DISMAN-EVENT-MIB::sysUpTimeInstance=55729143
There are other uses for this - the one above checks if the system has
been recently rebooted. if this is interpreted as a string, it won't
work, as in release-1.4.15 (I increased the -c threshold so it should
return critical on my system):
> $ ./check_snmp -Hlocalhost -Cpublic -osystem.sysUpTime.0 -c1000000000: -u'1/100 sec'
> SNMP OK - Timeticks: (55738598) 6 days, 10:49:45.98 1/100 sec |
This is a silent failure, which can be pretty nasty.
Please mark as invalid.
Thanks,
- --
Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk0lPvEACgkQ6dZ+Kt5BchZqoQCgiTuyjxT9wKhEteBxaH0pefnZ
KRcAoLnhEogHxc9vrKYfdNeN0JXWMLuf
=TGHQ
-----END PGP SIGNATURE-----
More information about the Pkg-nagios-devel
mailing list