summaryrefslogtreecommitdiffstats
path: root/plugins/tests/check_snmp.t
diff options
context:
space:
mode:
authorSven Nierlein <sven@nierlein.de>2012-06-26 20:53:13 +0200
committerSven Nierlein <sven@nierlein.de>2012-06-26 20:53:13 +0200
commit9c886d049d1dec9be0ac147c57d2094d2d4773da (patch)
tree277c3a24d09892713f4d651d980ad748db86d440 /plugins/tests/check_snmp.t
parentcf07b50a8213a5d4e6739e3a426cbe93c7113b1b (diff)
downloadmonitoring-plugins-9c886d049d1dec9be0ac147c57d2094d2d4773da.tar.gz
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
Diffstat (limited to 'plugins/tests/check_snmp.t')
-rwxr-xr-xplugins/tests/check_snmp.t23
1 files changed, 22 insertions, 1 deletions
diff --git a/plugins/tests/check_snmp.t b/plugins/tests/check_snmp.t
index 2645cc1b..7a5a8b3f 100755
--- a/plugins/tests/check_snmp.t
+++ b/plugins/tests/check_snmp.t
@@ -8,7 +8,7 @@ use Test::More;
8use NPTest; 8use NPTest;
9use FindBin qw($Bin); 9use FindBin qw($Bin);
10 10
11my $tests = 41; 11my $tests = 51;
12# Check that all dependent modules are available 12# Check that all dependent modules are available
13eval { 13eval {
14 require NetSNMP::OID; 14 require NetSNMP::OID;
@@ -144,6 +144,27 @@ is($res->return_code, 0, "OK as no thresholds" );
144is($res->output, "SNMP RATE OK - inoctets 333 | inoctets=333 ", "Check rate decreases due to longer interval"); 144is($res->output, "SNMP RATE OK - inoctets 333 | inoctets=333 ", "Check rate decreases due to longer interval");
145 145
146 146
147# label performance data check
148$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 -l test" );
149is($res->return_code, 0, "OK as no thresholds" );
150is($res->output, "SNMP OK - test 67996 | test=67996c ", "Check label");
151
152$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 -l \"test'test\"" );
153is($res->return_code, 0, "OK as no thresholds" );
154is($res->output, "SNMP OK - test'test 68662 | \"test'test\"=68662c ", "Check label");
155
156$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 -l 'test\"test'" );
157is($res->return_code, 0, "OK as no thresholds" );
158is($res->output, "SNMP OK - test\"test 69328 | 'test\"test'=69328c ", "Check label");
159
160$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 -l test -O" );
161is($res->return_code, 0, "OK as no thresholds" );
162is($res->output, "SNMP OK - test 69994 | iso.3.6.1.4.1.8072.3.2.67.10=69994c ", "Check label");
163
164$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10" );
165is($res->return_code, 0, "OK as no thresholds" );
166is($res->output, "SNMP OK - 70660 | iso.3.6.1.4.1.8072.3.2.67.10=70660c ", "Check label");
167
147 168
148$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -l inoctets_per_minute --rate-multiplier=60" ); 169$res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -l inoctets_per_minute --rate-multiplier=60" );
149is($res->return_code, 0, "OK for first call" ); 170is($res->return_code, 0, "OK for first call" );