diff options
-rw-r--r-- | plugins/check_snmp.c | 2 | ||||
-rwxr-xr-x | plugins/tests/check_snmp.t | 10 |
2 files changed, 5 insertions, 7 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index f8cae9b6..e6707a08 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
@@ -493,8 +493,6 @@ main (int argc, char **argv) | |||
493 | temp_string=labels[i]; | 493 | temp_string=labels[i]; |
494 | else | 494 | else |
495 | temp_string=oidname; | 495 | temp_string=oidname; |
496 | if(calculate_rate) | ||
497 | asprintf(&temp_string,"%s-rate",temp_string); | ||
498 | strncat(perfstr, temp_string, sizeof(perfstr)-strlen(perfstr)-1); | 496 | strncat(perfstr, temp_string, sizeof(perfstr)-strlen(perfstr)-1); |
499 | strncat(perfstr, "=", sizeof(perfstr)-strlen(perfstr)-1); | 497 | strncat(perfstr, "=", sizeof(perfstr)-strlen(perfstr)-1); |
500 | len = sizeof(perfstr)-strlen(perfstr)-1; | 498 | len = sizeof(perfstr)-strlen(perfstr)-1; |
diff --git a/plugins/tests/check_snmp.t b/plugins/tests/check_snmp.t index 0fa1691e..1e350f23 100755 --- a/plugins/tests/check_snmp.t +++ b/plugins/tests/check_snmp.t | |||
@@ -51,7 +51,7 @@ if ($ARGV[0] && $ARGV[0] eq "-d") { | |||
51 | } | 51 | } |
52 | } | 52 | } |
53 | 53 | ||
54 | my $tests = 29; | 54 | my $tests = 33; |
55 | if (-x "./check_snmp") { | 55 | if (-x "./check_snmp") { |
56 | plan tests => $tests; | 56 | plan tests => $tests; |
57 | } else { | 57 | } else { |
@@ -116,7 +116,7 @@ sleep 1; | |||
116 | 116 | ||
117 | $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 -w 600" ); | 117 | $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 -w 600" ); |
118 | is($res->return_code, 1, "WARNING - due to going above rate calculation" ); | 118 | is($res->return_code, 1, "WARNING - due to going above rate calculation" ); |
119 | is($res->output, "SNMP RATE WARNING - *666* | iso.3.6.1.4.1.8072.3.2.67.10-rate=666 "); | 119 | is($res->output, "SNMP RATE WARNING - *666* | iso.3.6.1.4.1.8072.3.2.67.10=666 "); |
120 | 120 | ||
121 | $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 -w 600" ); | 121 | $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 -w 600" ); |
122 | is($res->return_code, 3, "UNKNOWN - basically the divide by zero error" ); | 122 | is($res->return_code, 3, "UNKNOWN - basically the divide by zero error" ); |
@@ -132,13 +132,13 @@ sleep 1; | |||
132 | 132 | ||
133 | $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" ); | 133 | $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" ); |
134 | is($res->return_code, 0, "OK as no thresholds" ); | 134 | is($res->return_code, 0, "OK as no thresholds" ); |
135 | is($res->output, "SNMP RATE OK - inoctets 666 | inoctets-rate=666 ", "Check label"); | 135 | is($res->output, "SNMP RATE OK - inoctets 666 | inoctets=666 ", "Check label"); |
136 | 136 | ||
137 | sleep 2; | 137 | sleep 2; |
138 | 138 | ||
139 | $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" ); | 139 | $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" ); |
140 | is($res->return_code, 0, "OK as no thresholds" ); | 140 | is($res->return_code, 0, "OK as no thresholds" ); |
141 | is($res->output, "SNMP RATE OK - inoctets 333 | inoctets-rate=333 ", "Check rate decreases due to longer interval"); | 141 | is($res->output, "SNMP RATE OK - inoctets 333 | inoctets=333 ", "Check rate decreases due to longer interval"); |
142 | 142 | ||
143 | 143 | ||
144 | 144 | ||
@@ -151,7 +151,7 @@ sleep 1; | |||
151 | 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 --rate -l inoctets_per_minute --rate-multiplier=60" ); | 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 --rate -l inoctets_per_minute --rate-multiplier=60" ); |
153 | is($res->return_code, 0, "OK as no thresholds" ); | 153 | is($res->return_code, 0, "OK as no thresholds" ); |
154 | is($res->output, "SNMP RATE OK - inoctets_per_minute 11.1 | inoctets_per_minute-rate=11.1 ", "Checking multiplier"); | 154 | is($res->output, "SNMP RATE OK - inoctets_per_minute 11.1 | inoctets_per_minute=11.1 ", "Checking multiplier"); |
155 | 155 | ||
156 | 156 | ||
157 | $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.11 -s '\"stringtests\"'" ); | 157 | $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.11 -s '\"stringtests\"'" ); |