diff options
-rw-r--r-- | Changes | 3 | ||||
-rw-r--r-- | lib/Nagios/Plugin.pm | 2 | ||||
-rw-r--r-- | lib/Nagios/Plugin/Functions.pm | 2 | ||||
-rw-r--r-- | lib/Nagios/Plugin/Performance.pm | 9 | ||||
-rw-r--r-- | t/Nagios-Plugin-Performance.t | 6 |
5 files changed, 18 insertions, 4 deletions
@@ -1,5 +1,8 @@ | |||
1 | Revision history for Perl module Nagios::Plugin. | 1 | Revision history for Perl module Nagios::Plugin. |
2 | 2 | ||
3 | 0.33 5th June 2009 | ||
4 | - Fixed infinite loop when invalid performance data with multiple = were present | ||
5 | |||
3 | 0.32 3rd March 2009 | 6 | 0.32 3rd March 2009 |
4 | - Handle performance data with quotes in the label (thanks to Kang) | 7 | - Handle performance data with quotes in the label (thanks to Kang) |
5 | - Die if default config file is not available and --extra-opts is set | 8 | - Die if default config file is not available and --extra-opts is set |
diff --git a/lib/Nagios/Plugin.pm b/lib/Nagios/Plugin.pm index bd0d483..98c2896 100644 --- a/lib/Nagios/Plugin.pm +++ b/lib/Nagios/Plugin.pm | |||
@@ -25,7 +25,7 @@ our @EXPORT_OK = qw(%ERRORS); | |||
25 | # CPAN stupidly won't index this module without a literal $VERSION here, | 25 | # CPAN stupidly won't index this module without a literal $VERSION here, |
26 | # so we're forced to duplicate it explicitly | 26 | # so we're forced to duplicate it explicitly |
27 | # Make sure you update $Nagios::Plugin::Functions::VERSION too | 27 | # Make sure you update $Nagios::Plugin::Functions::VERSION too |
28 | our $VERSION = "0.32"; | 28 | our $VERSION = "0.33"; |
29 | 29 | ||
30 | sub new { | 30 | sub new { |
31 | my $class = shift; | 31 | my $class = shift; |
diff --git a/lib/Nagios/Plugin/Functions.pm b/lib/Nagios/Plugin/Functions.pm index 165aafa..9a8272a 100644 --- a/lib/Nagios/Plugin/Functions.pm +++ b/lib/Nagios/Plugin/Functions.pm | |||
@@ -12,7 +12,7 @@ use Params::Validate qw(:types validate); | |||
12 | use Math::Calc::Units; | 12 | use Math::Calc::Units; |
13 | 13 | ||
14 | # Remember to update Nagios::Plugins as well | 14 | # Remember to update Nagios::Plugins as well |
15 | our $VERSION = "0.32"; | 15 | our $VERSION = "0.33"; |
16 | 16 | ||
17 | our @STATUS_CODES = qw(OK WARNING CRITICAL UNKNOWN DEPENDENT); | 17 | our @STATUS_CODES = qw(OK WARNING CRITICAL UNKNOWN DEPENDENT); |
18 | 18 | ||
diff --git a/lib/Nagios/Plugin/Performance.pm b/lib/Nagios/Plugin/Performance.pm index 6b85dc0..9248fea 100644 --- a/lib/Nagios/Plugin/Performance.pm +++ b/lib/Nagios/Plugin/Performance.pm | |||
@@ -87,7 +87,14 @@ sub parse_perfstring { | |||
87 | # If there is more than 1 equals sign, split it out and parse individually | 87 | # If there is more than 1 equals sign, split it out and parse individually |
88 | if (@{[$perfstring =~ /=/g]} > 1) { | 88 | if (@{[$perfstring =~ /=/g]} > 1) { |
89 | $perfstring =~ s/^(.*?=.*?)\s//; | 89 | $perfstring =~ s/^(.*?=.*?)\s//; |
90 | $obj = $class->_parse($1); | 90 | if (defined $1) { |
91 | $obj = $class->_parse($1); | ||
92 | } else { | ||
93 | # This could occur if perfdata was soemthing=value= | ||
94 | # Since this is invalid, we reset the string and continue | ||
95 | $perfstring = ""; | ||
96 | $obj = $class->_parse($perfstring); | ||
97 | } | ||
91 | } else { | 98 | } else { |
92 | $obj = $class->_parse($perfstring); | 99 | $obj = $class->_parse($perfstring); |
93 | $perfstring = ""; | 100 | $perfstring = ""; |
diff --git a/t/Nagios-Plugin-Performance.t b/t/Nagios-Plugin-Performance.t index bbf0b20..6904f4c 100644 --- a/t/Nagios-Plugin-Performance.t +++ b/t/Nagios-Plugin-Performance.t | |||
@@ -1,4 +1,5 @@ | |||
1 | 1 | ||
2 | use warnings; | ||
2 | use strict; | 3 | use strict; |
3 | use Test::More; | 4 | use Test::More; |
4 | use Nagios::Plugin::Functions; | 5 | use Nagios::Plugin::Functions; |
@@ -40,7 +41,7 @@ my @test = ( | |||
40 | }, | 41 | }, |
41 | ); | 42 | ); |
42 | 43 | ||
43 | plan tests => (11 * scalar @test) + 175; | 44 | plan tests => (11 * scalar @test) + 176; |
44 | 45 | ||
45 | use_ok('Nagios::Plugin::Performance'); | 46 | use_ok('Nagios::Plugin::Performance'); |
46 | diag "\nusing Nagios::Plugin::Performance revision ". $Nagios::Plugin::Performance::VERSION . "\n" if $ENV{TEST_VERBOSE}; | 47 | diag "\nusing Nagios::Plugin::Performance revision ". $Nagios::Plugin::Performance::VERSION . "\n" if $ENV{TEST_VERBOSE}; |
@@ -349,4 +350,7 @@ is( $p[2]->min, undef, "min ok"); | |||
349 | is( $p[2]->max, undef, "max ok"); | 350 | is( $p[2]->max, undef, "max ok"); |
350 | 351 | ||
351 | 352 | ||
353 | @p = Nagios::Plugin::Performance->parse_perfstring("processes=9;WKFLSV32.exe;9="); | ||
354 | is_deeply( \@p, [], "Fails parsing correctly"); | ||
355 | |||
352 | # add_perfdata tests in t/Nagios-Plugin-01.t | 356 | # add_perfdata tests in t/Nagios-Plugin-01.t |