diff options
author | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2014-01-31 00:04:50 -0500 |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2014-01-31 00:48:49 -0500 |
commit | c4e3cd6efd5aef8665db103a66996e619526ab3b (patch) | |
tree | 5b19b9085a84c2d7fb666c8e33d42f3ab0694b79 /plugins/tests/check_snmp_agent.pl | |
parent | bc92b9392009766441c67b06398e6925cc45c2aa (diff) | |
download | monitoring-plugins-c4e3cd6efd5aef8665db103a66996e619526ab3b.tar.gz |
Add tests for negative thresholds in check_snmp
Next commit will work on fixing these!
Diffstat (limited to 'plugins/tests/check_snmp_agent.pl')
-rw-r--r-- | plugins/tests/check_snmp_agent.pl | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/plugins/tests/check_snmp_agent.pl b/plugins/tests/check_snmp_agent.pl index 8cacd527..0e41d575 100644 --- a/plugins/tests/check_snmp_agent.pl +++ b/plugins/tests/check_snmp_agent.pl | |||
@@ -7,7 +7,7 @@ | |||
7 | use NetSNMP::OID qw(:all); | 7 | use NetSNMP::OID qw(:all); |
8 | use NetSNMP::agent; | 8 | use NetSNMP::agent; |
9 | use NetSNMP::ASN qw(ASN_OCTET_STR ASN_COUNTER ASN_COUNTER64 ASN_INTEGER ASN_INTEGER64 ASN_UNSIGNED ASN_UNSIGNED64); | 9 | use NetSNMP::ASN qw(ASN_OCTET_STR ASN_COUNTER ASN_COUNTER64 ASN_INTEGER ASN_INTEGER64 ASN_UNSIGNED ASN_UNSIGNED64); |
10 | #use Math::Int64 qw(uint64); # Skip that module whie we don't need it | 10 | #use Math::Int64 qw(uint64); # Skip that module while we don't need it |
11 | sub uint64 { return $_ } | 11 | sub uint64 { return $_ } |
12 | 12 | ||
13 | if (!$agent) { | 13 | if (!$agent) { |
@@ -16,8 +16,6 @@ if (!$agent) { | |||
16 | } | 16 | } |
17 | 17 | ||
18 | my $baseoid = '.1.3.6.1.4.1.8072.3.2.67'; | 18 | my $baseoid = '.1.3.6.1.4.1.8072.3.2.67'; |
19 | # Next are arrays of indexes (Type, initial value and increments) | ||
20 | # Undef miltipliers are randomized | ||
21 | my $multiline = 'Cisco Internetwork Operating System Software | 19 | my $multiline = 'Cisco Internetwork Operating System Software |
22 | IOS (tm) Catalyst 4000 "L3" Switch Software (cat4000-I9K91S-M), Version | 20 | IOS (tm) Catalyst 4000 "L3" Switch Software (cat4000-I9K91S-M), Version |
23 | 12.2(20)EWA, RELEASE SOFTWARE (fc1) | 21 | 12.2(20)EWA, RELEASE SOFTWARE (fc1) |
@@ -33,10 +31,12 @@ ends with with this: C:\\'; | |||
33 | my $multilin5 = 'And now have fun with with this: "C:\\" | 31 | my $multilin5 = 'And now have fun with with this: "C:\\" |
34 | because we\'re not done yet!'; | 32 | because we\'re not done yet!'; |
35 | 33 | ||
36 | # 0..15 <---- please update comment when adding/removing fields | 34 | # Next are arrays of indexes (Type, initial value and increments) |
37 | my @fields = (ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_UNSIGNED, ASN_UNSIGNED, ASN_COUNTER, ASN_COUNTER64, ASN_UNSIGNED, ASN_COUNTER, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR ); | 35 | # 0..16 <---- please update comment when adding/removing fields |
38 | my @values = ($multiline, $multilin2, $multilin3, $multilin4, $multilin5, 4294965296, 1000, 4294965296, uint64("18446744073709351616"), int(rand(2**32)), 64000, "stringtests", "3.5", "87.4startswithnumberbutshouldbestring", '555"I said"', 'CUSTOM CHECK OK: foo is 12345' ); | 36 | my @fields = (ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_UNSIGNED, ASN_UNSIGNED, ASN_COUNTER, ASN_COUNTER64, ASN_UNSIGNED, ASN_COUNTER, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_OCTET_STR, ASN_INTEGER, ASN_OCTET_STR, ASN_OCTET_STR ); |
39 | my @incrts = (undef, undef, undef, undef, undef, 1000, -500, 1000, 100000, undef, 666, undef, undef, undef, undef, undef ); | 37 | my @values = ($multiline, $multilin2, $multilin3, $multilin4, $multilin5, 4294965296, 1000, 4294965296, uint64("18446744073709351616"), int(rand(2**32)), 64000, "stringtests", "3.5", "87.4startswithnumberbutshouldbestring", '555"I said"', 'CUSTOM CHECK OK: foo is 12345', -2, '-4', '-6.6' ); |
38 | # undef increments are randomized | ||
39 | my @incrts = (undef, undef, undef, undef, undef, 1000, -500, 1000, 100000, undef, 666, undef, undef, undef, undef, undef, -1, undef, undef ); | ||
40 | 40 | ||
41 | # Number of elements in our OID | 41 | # Number of elements in our OID |
42 | my $oidelts; | 42 | my $oidelts; |