summaryrefslogtreecommitdiffstats
path: root/lib/Nagios/Plugin/Performance.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Nagios/Plugin/Performance.pm')
-rw-r--r--lib/Nagios/Plugin/Performance.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Nagios/Plugin/Performance.pm b/lib/Nagios/Plugin/Performance.pm
index 55e3ddc..403492c 100644
--- a/lib/Nagios/Plugin/Performance.pm
+++ b/lib/Nagios/Plugin/Performance.pm
@@ -22,10 +22,12 @@ sub import {
22 Nagios::Plugin::Functions::_use_die($_); 22 Nagios::Plugin::Functions::_use_die($_);
23} 23}
24 24
25my $value_re = qr/[-+]?[\d\.]+/;
26my $value_re_with_negative_infinity = qr/$value_re|~/;
25sub _parse { 27sub _parse {
26 my $class = shift; 28 my $class = shift;
27 my $string = shift; 29 my $string = shift;
28 $string =~ s/^([^=]+)=([\d\.]+)([\w%]*);?([\d\.]+)?;?([\d\.]+)?;?([\d\.]+)?;?([\d\.]+)?\s*//; 30 $string =~ s/^([^=]+)=($value_re)([\w%]*);?($value_re_with_negative_infinity\:?$value_re?)?;?($value_re_with_negative_infinity\:?$value_re?)?;?($value_re)?;?($value_re)?\s*//o;
29 return undef unless ((defined $1 && $1 ne "") && (defined $2 && $2 ne "")); 31 return undef unless ((defined $1 && $1 ne "") && (defined $2 && $2 ne ""));
30 my $p = $class->new( 32 my $p = $class->new(
31 label => $1, value => $2+0, uom => $3, warning => $4, critical => $5, 33 label => $1, value => $2+0, uom => $3, warning => $4, critical => $5,