From 673108c6cd8c84f72db0ddb2997b96cbe28ba5ea Mon Sep 17 00:00:00 2001 From: "tonvoon@users.sourceforge.net" Date: Fri, 5 Jun 2009 17:01:22 +0000 Subject: Fixed parsing when two = signs within the performance data portion --- lib/Nagios/Plugin.pm | 2 +- lib/Nagios/Plugin/Functions.pm | 2 +- lib/Nagios/Plugin/Performance.pm | 9 ++++++++- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'lib/Nagios') 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); # CPAN stupidly won't index this module without a literal $VERSION here, # so we're forced to duplicate it explicitly # Make sure you update $Nagios::Plugin::Functions::VERSION too -our $VERSION = "0.32"; +our $VERSION = "0.33"; sub new { 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); use Math::Calc::Units; # Remember to update Nagios::Plugins as well -our $VERSION = "0.32"; +our $VERSION = "0.33"; our @STATUS_CODES = qw(OK WARNING CRITICAL UNKNOWN DEPENDENT); 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 { # If there is more than 1 equals sign, split it out and parse individually if (@{[$perfstring =~ /=/g]} > 1) { $perfstring =~ s/^(.*?=.*?)\s//; - $obj = $class->_parse($1); + if (defined $1) { + $obj = $class->_parse($1); + } else { + # This could occur if perfdata was soemthing=value= + # Since this is invalid, we reset the string and continue + $perfstring = ""; + $obj = $class->_parse($perfstring); + } } else { $obj = $class->_parse($perfstring); $perfstring = ""; -- cgit v1.2.3-74-g34f1