Code

check_snmp: Add some verbose output and tests
[nagiosplug.git] / plugins / t / check_snmp.t
index e0138e6b93ceb5a19174e8491b11859cd140dbb4..2ce0858598d5dbfc411e8d2c7902dc543864822d 100644 (file)
@@ -8,7 +8,7 @@ use strict;
 use Test::More;
 use NPTest;
 
-my $tests = 44;
+my $tests = 46;
 plan tests => $tests;
 my $res;
 
@@ -54,6 +54,10 @@ SKIP: {
                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");