diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_snmp.c | 6 | ||||
-rwxr-xr-x | plugins/tests/check_snmp.t | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 51ad6f4e..a5a88d25 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
@@ -494,10 +494,10 @@ main (int argc, char **argv) | |||
494 | if (strpbrk (temp_string, " ='\"") == NULL) { | 494 | if (strpbrk (temp_string, " ='\"") == NULL) { |
495 | strncat(perfstr, temp_string, sizeof(perfstr)-strlen(perfstr)-1); | 495 | strncat(perfstr, temp_string, sizeof(perfstr)-strlen(perfstr)-1); |
496 | } else { | 496 | } else { |
497 | if (strpbrk (temp_string, "\"") == NULL) { | 497 | if (strpbrk (temp_string, "'") == NULL) { |
498 | quote_string="\""; | ||
499 | } else { | ||
500 | quote_string="'"; | 498 | quote_string="'"; |
499 | } else { | ||
500 | quote_string="\""; | ||
501 | } | 501 | } |
502 | strncat(perfstr, quote_string, sizeof(perfstr)-strlen(perfstr)-1); | 502 | strncat(perfstr, quote_string, sizeof(perfstr)-strlen(perfstr)-1); |
503 | strncat(perfstr, temp_string, sizeof(perfstr)-strlen(perfstr)-1); | 503 | strncat(perfstr, temp_string, sizeof(perfstr)-strlen(perfstr)-1); |
diff --git a/plugins/tests/check_snmp.t b/plugins/tests/check_snmp.t index 7a5a8b3f..1ef0b209 100755 --- a/plugins/tests/check_snmp.t +++ b/plugins/tests/check_snmp.t | |||
@@ -8,7 +8,7 @@ use Test::More; | |||
8 | use NPTest; | 8 | use NPTest; |
9 | use FindBin qw($Bin); | 9 | use FindBin qw($Bin); |
10 | 10 | ||
11 | my $tests = 51; | 11 | my $tests = 53; |
12 | # Check that all dependent modules are available | 12 | # Check that all dependent modules are available |
13 | eval { | 13 | eval { |
14 | require NetSNMP::OID; | 14 | require NetSNMP::OID; |
@@ -165,6 +165,10 @@ $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1 | |||
165 | is($res->return_code, 0, "OK as no thresholds" ); | 165 | is($res->return_code, 0, "OK as no thresholds" ); |
166 | is($res->output, "SNMP OK - 70660 | iso.3.6.1.4.1.8072.3.2.67.10=70660c ", "Check label"); | 166 | is($res->output, "SNMP OK - 70660 | iso.3.6.1.4.1.8072.3.2.67.10=70660c ", "Check label"); |
167 | 167 | ||
168 | $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'" ); | ||
169 | is($res->return_code, 0, "OK as no thresholds" ); | ||
170 | is($res->output, "SNMP OK - test test 71326 | 'test test'=71326c ", "Check label"); | ||
171 | |||
168 | 172 | ||
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" ); | 173 | $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" ); |
170 | is($res->return_code, 0, "OK for first call" ); | 174 | is($res->return_code, 0, "OK for first call" ); |