diff options
author | Wolfgang Nieder <wnd@gmx.net> | 2018-07-07 07:12:44 (GMT) |
---|---|---|
committer | Sven Nierlein <sven@nierlein.org> | 2022-12-22 11:54:51 (GMT) |
commit | c35bf8966a593d7926470121269b08ec00883593 (patch) | |
tree | f4b811b708c96669cf070d4e8264522a51c9f401 /plugins/tests/check_snmp.t | |
parent | 765b29f09bd3bc2a938260caa5f263343aafadb7 (diff) | |
download | monitoring-plugins-c35bf8966a593d7926470121269b08ec00883593.tar.gz |
add 'multiplier' to modify current value
Diffstat (limited to 'plugins/tests/check_snmp.t')
-rwxr-xr-x | plugins/tests/check_snmp.t | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/plugins/tests/check_snmp.t b/plugins/tests/check_snmp.t index 0a77fa8..e9cc021 100755 --- a/plugins/tests/check_snmp.t +++ b/plugins/tests/check_snmp.t | |||
@@ -9,7 +9,7 @@ use NPTest; | |||
9 | use FindBin qw($Bin); | 9 | use FindBin qw($Bin); |
10 | use POSIX qw/strftime/; | 10 | use POSIX qw/strftime/; |
11 | 11 | ||
12 | my $tests = 73; | 12 | my $tests = 75; |
13 | # Check that all dependent modules are available | 13 | # Check that all dependent modules are available |
14 | eval { | 14 | eval { |
15 | require NetSNMP::OID; | 15 | require NetSNMP::OID; |
@@ -57,9 +57,9 @@ if ($pid) { | |||
57 | exec("snmpd -c tests/conf/snmpd.conf -C -f -r udp:$port_snmp"); | 57 | exec("snmpd -c tests/conf/snmpd.conf -C -f -r udp:$port_snmp"); |
58 | } | 58 | } |
59 | 59 | ||
60 | END { | 60 | END { |
61 | foreach my $pid (@pids) { | 61 | foreach my $pid (@pids) { |
62 | if ($pid) { print "Killing $pid\n"; kill "INT", $pid } | 62 | if ($pid) { print "Killing $pid\n"; kill "INT", $pid } |
63 | } | 63 | } |
64 | }; | 64 | }; |
65 | 65 | ||
@@ -268,3 +268,9 @@ like($res->output, '/SNMP WARNING - \d+ \*-4\* | iso.3.6.1.4.1.8072.3.2.67.10=\d | |||
268 | $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,.1.3.6.1.4.1.8072.3.2.67.17 -w 1,2 -c 1" ); | 268 | $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,.1.3.6.1.4.1.8072.3.2.67.17 -w 1,2 -c 1" ); |
269 | is($res->return_code, 2, "Multiple OIDs with some thresholds" ); | 269 | is($res->return_code, 2, "Multiple OIDs with some thresholds" ); |
270 | like($res->output, '/SNMP CRITICAL - \*\d+\* \*-4\* | iso.3.6.1.4.1.8072.3.2.67.10=\d+c;1;2 iso.3.6.1.4.1.8072.3.2.67.17=-4;;/', "Multiple OIDs with thresholds output" ); | 270 | like($res->output, '/SNMP CRITICAL - \*\d+\* \*-4\* | iso.3.6.1.4.1.8072.3.2.67.10=\d+c;1;2 iso.3.6.1.4.1.8072.3.2.67.17=-4;;/', "Multiple OIDs with thresholds output" ); |
271 | |||
272 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.2.1.25.2.2.0 -M .125 "); | ||
273 | is($res->return_code, 0, "Multiply OK" ); | ||
274 | |||
275 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.2.1.25.2.2.0 --multiplier=.0009765625 -f '%.3f' "); | ||
276 | is($res->return_code, 0, "Multiply format OK" ); | ||