Commit graph

24 commits

Author SHA1 Message Date
Sven Nierlein
024d268386 check_snmp: fix performance thresholds when using multiple oids
when using check_snmp with multiple oids it simply printed the unparsed content
from -w/-c into the thresholds for each oid. So each oid contained the hole -w
from all oids.

./check_snmp ... -o iso.3.6.1.2.1.25.1.3.0,iso.3.6.1.2.1.25.1.5.0 -w '1,2' -c '3,4'

before:
  SNMP ... | HOST-RESOURCES-MIB::hrSystemInitialLoadDevice.0=393216;1,2;3,4 HOST-RESOURCES-MIB::hrSystemNumUsers.0=24;1,2;3,4

after:
  SNMP ... | HOST-RESOURCES-MIB::hrSystemInitialLoadDevice.0=393216;1;3 HOST-RESOURCES-MIB::hrSystemNumUsers.0=24;2;4

This also applies to fixed thresholds since check_snmp translates negative infinities from: '~:-1' to '@-1:~'
2021-11-17 14:04:09 +01:00
Sven Nierlein
22f47fc0c5 tests: make check_snmp test more reliable
The check_snmp rate tests depend on the exact amount of time spend between the
plugin runs and will fail on busy machines, ex. the ci servers. Using faketime
mitigates this issue and also removes all the sleeps.

Signed-off-by: Sven Nierlein <sven@nierlein.de>
2019-01-21 17:41:02 +01:00
Sven Nierlein
75d884ed1e fix snmp test for included threshold
since 6623a1 check_snmp prints the thresholds along the performance data.
This adjust our test cases accordingly.

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
2015-04-12 14:29:05 +02:00
Sven Nierlein
a5b6d94fc6 tests: skip extented snmp tests if snmpd has no perl support
solaris snmpd has no perl support by default, so this test will fail.

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
2014-07-31 21:07:18 +02:00
Sven Nierlein
b2fed383b1 tests: freebsds snmpd does not use quotes
when returning syscontact. So make them optional since we want to test
check_snmp and not the snmpd.

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
2014-06-13 16:34:03 +02:00
Thomas Guyot-Sionnest
f45adede7d Fix snmpd tests 2014-01-31 12:30:11 -05:00
Thomas Guyot-Sionnest
c4e3cd6efd Add tests for negative thresholds in check_snmp
Next commit will work on fixing these!
2014-01-31 00:48:49 -05:00
Thomas Guyot-Sionnest
189e2aa344 Rename MP_STATE_DIRECTORY to MP_STATE_PATH 2014-01-27 08:35:23 -05:00
Thomas Guyot-Sionnest
4caf4ce4fe Rename ENV variable, keep backward compatibility
Rename NAGIOS_PLUGIN_STATE_DIRECTORY to MP_STATE_DIRECTORY
2014-01-25 03:35:46 -05:00
Sven Nierlein
843f954056 check_snmp: use single quotes for perf data labels 2012-06-27 00:02:09 +02:00
Sven Nierlein
9c886d049d Fix performance data label containing spaces in check_snmp (Jochen Bern)
Add --perf-oids option for check_snmp to retain optional 1.4.14 compatibility
2012-06-26 20:53:13 +02:00
Thomas Guyot-Sionnest
ae2a669137 Test updates...
1. Timetick test could fail with uptime > 115 days. Thresholds are
double type, so it's safe to put a large number even for 32bit systems.
2. Add a test based on an invalid bug report, worthy anyway.
2011-01-05 23:09:54 -05:00
Thomas Guyot-Sionnest
c49fed07c3 Fix minor test issues
My Test::More wouldn't print the total number of tests anymore, moving
the plan at the top appears to fix it.

At the same time I made check-http.t eval the special modules so it can
skip the tests instead of failing.
2010-11-30 23:57:04 -05:00
Thomas Guyot-Sionnest
5a2814a21b Revert "check_snmp now considers strings returned by SNMP that contain just"
This reverts commit 896962a1ad.

Conflicts:

	NEWS
	plugins/tests/check_snmp.t

Notes:
	Reverting because I rebased a patch that was doing the same thing, plus
	fixing more related regressions, and both didn't work together.
	I kept the tests intact except for one that wouldn't pass on 1.4.14
	either
2010-11-30 22:48:43 -05:00
Thomas Guyot-Sionnest
811684ffe3 State-based tests enhancements
- Use /var/tmp for state if no state dir environment variable is set,
  this avoid the need for a writable localstatedir during tests.
- Use "rm -f", mostly to avoid printing out garbage of the directory
  doesn't exists
2010-11-30 22:33:34 -05:00
nagios
896962a1ad check_snmp now considers strings returned by SNMP that contain just
numbers (according to strtod) to be a numeric value for threshold and
performance data
2010-11-15 15:43:41 +00:00
tonvoon
5c72d075de Corrected rate_multiplier calculation 2010-06-30 13:16:32 +00:00
tonvoon
3444519014 Removed suffix of "-rate" and let user decide label via --label 2010-06-30 09:37:10 +00:00
tonvoon
752dbc20b2 Tests for --rate-multiplier option 2010-06-30 07:56:05 +00:00
tonvoon
b8e2850c1a Added option to invert search results 2010-06-23 15:56:29 +00:00
Ton Voon
18f6835eda Added state retention APIs. Implemented for check_snmp with --rate option.
See http://nagiosplugin.org/c-api-private for more details on the API.

Also updated check_snmp -l option to change the perfdata label.
2010-06-23 13:30:34 +00:00
Thomas Guyot-Sionnest
00bf32bb60 Fix tests and update NEWS file 2010-04-21 23:04:06 -04:00
Thomas Guyot-Sionnest
181ac1e018 Add a test that succeeds on check_snmp v1.4.13. Newer versions skip additional
lines so this new test fails on the current head.

Note: check_snmp v1.4.13 with multi-line strings return somewhat v3 output;
      it's not exactly what the specs say but it doesn't appears to break them
      either. The fix could eventually supports both v2 and v3 output formats.
2009-09-05 03:16:54 -04:00
Thomas Guyot-Sionnest
8a96ee4741 Add tests using custom snmp agent
Only multi-line string test for now (regression test), counter rollover
tests planed with my snmp_counters_new branch.

NB: 64bit counters are broken in NetSNMP::agent from NetSNMP version 5.4.1
    and lower, but might come in handy one day
2009-07-31 03:07:38 -04:00