diff options
author | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2009-09-17 00:49:56 -0400 |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@aei.ca> | 2010-04-21 22:04:28 -0400 |
commit | 582034478b3ac7995f01a5f639c8d0604f3f432b (patch) | |
tree | 717463adef3d030cc79319ae1f76611d9311937d /plugins/tests | |
parent | b63e92f8baa014bb5c54563a65e3aebaec40e5fa (diff) | |
download | monitoring-plugins-582034478b3ac7995f01a5f639c8d0604f3f432b.tar.gz |
Attempt at fixing check_snmp multiline output:
This patch tries to detect and output nicely multi-line strings. This
method is broken by design; only a count of double-quotes and escapes
could work in every situation.
Diffstat (limited to 'plugins/tests')
-rw-r--r-- | plugins/tests/check_snmp_agent.pl | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/plugins/tests/check_snmp_agent.pl b/plugins/tests/check_snmp_agent.pl index d1ff6d00..302ba6e7 100644 --- a/plugins/tests/check_snmp_agent.pl +++ b/plugins/tests/check_snmp_agent.pl | |||
@@ -18,15 +18,24 @@ if (!$agent) { | |||
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) | 19 | # Next are arrays of indexes (Type, initial value and increments) |
20 | # Undef miltipliers are randomized | 20 | # Undef miltipliers are randomized |
21 | my $multiline = "Cisco Internetwork Operating System Software | 21 | my $multiline = 'Cisco Internetwork Operating System Software |
22 | IOS (tm) Catalyst 4000 L3 Switch Software (cat4000-I9K91S-M), Version | 22 | IOS (tm) Catalyst 4000 "L3" Switch Software (cat4000-I9K91S-M), Version |
23 | 12.2(20)EWA, RELEASE SOFTWARE (fc1) | 23 | 12.2(20)EWA, RELEASE SOFTWARE (fc1) |
24 | Technical Support: http://www.cisco.com/techsupport | 24 | Technical Support: http://www.cisco.com/techsupport |
25 | Copyright (c) 1986-2004 by cisco Systems, Inc. | 25 | Copyright (c) 1986-2004 by cisco Systems, Inc. |
26 | "; | 26 | '; |
27 | my @fields = (ASN_OCTET_STR, ASN_UNSIGNED, ASN_UNSIGNED, ASN_COUNTER, ASN_COUNTER64, ASN_UNSIGNED); | 27 | my $multilin2 = "Kisco Outernetwork Oserating Gystem Totware |
28 | my @values = ($multiline, 4294965296, 1000, 4294965296, uint64("18446744073709351616"), int(rand(2**32))); | 28 | Copyleft (c) 2400-2689 by kisco Systrems, Inc."; |
29 | my @incrts = (undef, 1000, -500, 1000, 100000, undef); | 29 | my $multilin3 = 'This should not confuse check_snmp "parser" |
30 | into thinking there is no 2nd line'; | ||
31 | my $multilin4 = 'It\'s getting even harder if the line | ||
32 | ends with with this: C:\\'; | ||
33 | my $multilin5 = 'And now have fun with with this: "C:\\" | ||
34 | because we\'re not done yet!'; | ||
35 | |||
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); | ||
37 | my @values = ($multiline, $multilin2, $multilin3, $multilin4, $multilin5, 4294965296, 1000, 4294965296, uint64("18446744073709351616"), int(rand(2**32))); | ||
38 | my @incrts = (undef, undef, undef, undef, undef, 1000, -500, 1000, 100000, undef); | ||
30 | 39 | ||
31 | # Number of elements in our OID | 40 | # Number of elements in our OID |
32 | my $oidelts; | 41 | my $oidelts; |