diff options
Diffstat (limited to 'lib/Nagios/Plugin/Performance.pm')
-rw-r--r-- | lib/Nagios/Plugin/Performance.pm | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Nagios/Plugin/Performance.pm b/lib/Nagios/Plugin/Performance.pm index 403492c..a7655fc 100644 --- a/lib/Nagios/Plugin/Performance.pm +++ b/lib/Nagios/Plugin/Performance.pm | |||
@@ -11,7 +11,7 @@ __PACKAGE__->mk_ro_accessors( | |||
11 | qw(label value uom warning critical min max) | 11 | qw(label value uom warning critical min max) |
12 | ); | 12 | ); |
13 | 13 | ||
14 | use Nagios::Plugin::Functions; | 14 | use Nagios::Plugin::Functions qw($value_re); |
15 | use Nagios::Plugin::Threshold; | 15 | use Nagios::Plugin::Threshold; |
16 | use Nagios::Plugin::Range; | 16 | use Nagios::Plugin::Range; |
17 | our ($VERSION) = $Nagios::Plugin::Functions::VERSION; | 17 | our ($VERSION) = $Nagios::Plugin::Functions::VERSION; |
@@ -22,12 +22,11 @@ sub import { | |||
22 | Nagios::Plugin::Functions::_use_die($_); | 22 | Nagios::Plugin::Functions::_use_die($_); |
23 | } | 23 | } |
24 | 24 | ||
25 | my $value_re = qr/[-+]?[\d\.]+/; | 25 | my $value_with_negative_infinity = qr/$value_re|~/; |
26 | my $value_re_with_negative_infinity = qr/$value_re|~/; | ||
27 | sub _parse { | 26 | sub _parse { |
28 | my $class = shift; | 27 | my $class = shift; |
29 | my $string = shift; | 28 | my $string = shift; |
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 | $string =~ s/^([^=]+)=($value_re)([\w%]*);?($value_with_negative_infinity\:?$value_re?)?;?($value_with_negative_infinity\:?$value_re?)?;?($value_re)?;?($value_re)?\s*//o; |
31 | return undef unless ((defined $1 && $1 ne "") && (defined $2 && $2 ne "")); | 30 | return undef unless ((defined $1 && $1 ne "") && (defined $2 && $2 ne "")); |
32 | my $p = $class->new( | 31 | my $p = $class->new( |
33 | label => $1, value => $2+0, uom => $3, warning => $4, critical => $5, | 32 | label => $1, value => $2+0, uom => $3, warning => $4, critical => $5, |