summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8a96ee4)
raw | patch | inline | side by side (parent: 8a96ee4)
author | Thomas Guyot-Sionnest <dermoth@aei.ca> | |
Fri, 31 Jul 2009 07:50:42 +0000 (03:50 -0400) | ||
committer | Thomas Guyot-Sionnest <dermoth@aei.ca> | |
Fri, 31 Jul 2009 07:52:10 +0000 (03:52 -0400) |
plugins/check_snmp.c | patch | blob | history | |
plugins/t/check_snmp.t | patch | blob | history |
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c
index dff5bccd06bd5b11995bc609adafd6f04774d0f5..9096cdadcadaad29ffc7574cfb706ad61963d670 100644 (file)
--- a/plugins/check_snmp.c
+++ b/plugins/check_snmp.c
size_t unitv_size = 8;
int numoids = 0;
int numauthpriv = 0;
-int verbose = FALSE;
+int verbose = 0;
int usesnmpgetnext = FALSE;
char *warning_thresholds = NULL;
char *critical_thresholds = NULL;
ptr = chld_out.line[i];
oidname = strpcpy (oidname, ptr, delimiter);
response = strstr (ptr, delimiter);
+ if (verbose > 2) {
+ printf("Processing line %i\n line: %s\n oidname: %s\n response: %s\n", i+1, ptr, oidname, response);
+ }
/* We strip out the datatype indicator for PHBs */
print_revision (progname, NP_VERSION);
exit (STATE_OK);
case 'v': /* verbose */
- verbose = TRUE;
+ verbose++;
break;
/* Connection info */
diff --git a/plugins/t/check_snmp.t b/plugins/t/check_snmp.t
index e0138e6b93ceb5a19174e8491b11859cd140dbb4..2ce0858598d5dbfc411e8d2c7902dc543864822d 100644 (file)
--- a/plugins/t/check_snmp.t
+++ b/plugins/t/check_snmp.t
use Test::More;
use NPTest;
-my $tests = 44;
+my $tests = 46;
plan tests => $tests;
my $res;
cmp_ok( $value, ">", 0, "Got a time value" );
like($res->perf_output, "/sysUpTime.*$1/", "Got perfdata with value '$1' in it");
+ $res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o .1.3.6.1.2.1.1.3.0 -w 1: -c 1:");
+ cmp_ok( $res->return_code, '==', 0, "Test with numeric OID (no mibs loaded)" );
+ like($res->output, '/^SNMP OK - \d+/', "String contains SNMP OK");
+
$res = NPTest->testCmd( "./check_snmp -H $host_snmp -C $snmp_community -o system.sysDescr.0");
cmp_ok( $res->return_code, '==', 0, "Exit OK when querying sysDescr" );
unlike($res->perf_output, '/sysDescr/', "Perfdata doesn't contain string values");