From 3ec5d3b8b2426a9acce2faa23a58e615af62930f Mon Sep 17 00:00:00 2001 From: Ton Voon Date: Tue, 4 Sep 2007 13:17:01 +0000 Subject: Fixed CPAN test failures due to bad MANIFEST. Fixed version numbering Fixed a performance parsing problem where uom=% wasn't being recognised git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/Nagios-Plugin/trunk@1775 f882894a-f735-0410-b71e-b25c423dba1c --- .cvsignore | 5 ----- Changes | 5 +++++ MANIFEST | 22 ++++++++++++---------- META.yml | 2 +- lib/Nagios/Plugin.pm | 3 ++- lib/Nagios/Plugin/Functions.pm | 2 +- lib/Nagios/Plugin/Performance.pm | 2 +- t/Nagios-Plugin-Performance.t | 11 ++++++++++- 8 files changed, 32 insertions(+), 20 deletions(-) delete mode 100644 .cvsignore diff --git a/.cvsignore b/.cvsignore deleted file mode 100644 index 96e6eb3..0000000 --- a/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -Makefile -blib -pm_to_blib -.bzr -.bzrignore diff --git a/Changes b/Changes index c1f17ab..88f8274 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,10 @@ Revision history for Perl module Nagios::Plugin. +0.19 4th September 2007 + - Fix test failures due to bad MANIFEST file + - Fixed performance parsing where uom = % + - Fixed version numbering + 0.18 31st August 2007 - Fix error when parsing performance data where warn or crit are 0 - Optional _use_die flag to force nagios_die to call die instead of exit, so diff --git a/MANIFEST b/MANIFEST index ce5186e..39be2c5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,15 +1,18 @@ Changes -Makefile.PL -MANIFEST -META.yml -README lib/Nagios/Plugin.pm +lib/Nagios/Plugin/Config.pm +lib/Nagios/Plugin/ExitResult.pm +lib/Nagios/Plugin/Functions.pm +lib/Nagios/Plugin/Getopt.pm lib/Nagios/Plugin/Performance.pm lib/Nagios/Plugin/Range.pm lib/Nagios/Plugin/Threshold.pm -lib/Nagios/Plugin/Functions.pm -lib/Nagios/Plugin/Getopt.pm -lib/Nagios/Plugin/ExitResult.pm +Makefile.PL +MANIFEST This list of files +META.yml +README +t/check_stuff.pl +t/check_stuff.t t/Nagios-Plugin-01.t t/Nagios-Plugin-02.t t/Nagios-Plugin-03.t @@ -21,12 +24,10 @@ t/Nagios-Plugin-Getopt-01.t t/Nagios-Plugin-Getopt-02.t t/Nagios-Plugin-Getopt-03.t t/Nagios-Plugin-Getopt-04.t +t/Nagios-Plugin-Performance-02.t t/Nagios-Plugin-Performance.t t/Nagios-Plugin-Range.t t/Nagios-Plugin-Threshold.t -t/check_stuff.pl -t/check_stuff.t -t/npg03/README t/npg03/expected/00_basic t/npg03/expected/00_noextra t/npg03/expected/01_override1 @@ -54,3 +55,4 @@ t/npg03/input/12_nosection_implicit t/npg03/input/13_nosection_explicit_dies t/npg03/input/14_badsection_dies t/npg03/plugins.ini +t/npg03/README diff --git a/META.yml b/META.yml index 8067a7b..f03239e 100644 --- a/META.yml +++ b/META.yml @@ -1,7 +1,7 @@ # http://module-build.sourceforge.net/META-spec.html #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# name: Nagios-Plugin -version: 0.17 +version: 0.19 version_from: lib/Nagios/Plugin/Functions.pm installdirs: site requires: diff --git a/lib/Nagios/Plugin.pm b/lib/Nagios/Plugin.pm index fe83575..cdd3396 100644 --- a/lib/Nagios/Plugin.pm +++ b/lib/Nagios/Plugin.pm @@ -24,7 +24,8 @@ 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 -our $VERSION = 0.17; +# Make sure you update $Nagios::Plugin::Functions::VERSION too +our $VERSION = 0.19; # our $VERSION = $Nagios::Plugin::Functions::VERSION; sub new { diff --git a/lib/Nagios/Plugin/Functions.pm b/lib/Nagios/Plugin/Functions.pm index e8b292e..318b2cb 100644 --- a/lib/Nagios/Plugin/Functions.pm +++ b/lib/Nagios/Plugin/Functions.pm @@ -12,7 +12,7 @@ use Params::Validate qw(validate :types); use Math::Calc::Units; # Remember to update Nagios::Plugins as well -our $VERSION = 0.17; +our $VERSION = 0.19; our @STATUS_CODES = qw(OK WARNING CRITICAL UNKNOWN DEPENDENT); diff --git a/lib/Nagios/Plugin/Performance.pm b/lib/Nagios/Plugin/Performance.pm index 7ce5fa1..55e3ddc 100644 --- a/lib/Nagios/Plugin/Performance.pm +++ b/lib/Nagios/Plugin/Performance.pm @@ -25,7 +25,7 @@ sub import { sub _parse { my $class = shift; my $string = shift; - $string =~ s/^([^=]+)=([\d\.]+)(\w*);?([\d\.]+)?;?([\d\.]+)?;?([\d\.]+)?;?([\d\.]+)?\s*//; + $string =~ s/^([^=]+)=([\d\.]+)([\w%]*);?([\d\.]+)?;?([\d\.]+)?;?([\d\.]+)?;?([\d\.]+)?\s*//; return undef unless ((defined $1 && $1 ne "") && (defined $2 && $2 ne "")); my $p = $class->new( label => $1, value => $2+0, uom => $3, warning => $4, critical => $5, diff --git a/t/Nagios-Plugin-Performance.t b/t/Nagios-Plugin-Performance.t index c4d518c..0574ea0 100644 --- a/t/Nagios-Plugin-Performance.t +++ b/t/Nagios-Plugin-Performance.t @@ -1,6 +1,6 @@ use strict; -use Test::More tests => 84; +use Test::More tests => 91; BEGIN { use_ok('Nagios::Plugin::Performance') }; diag "\nusing Nagios::Plugin::Performance revision ". $Nagios::Plugin::Performance::VERSION . "\n" if $ENV{TEST_VERBOSE}; @@ -133,4 +133,13 @@ cmp_ok( $p[0]->uom, "eq", "s", "uom okay"); cmp_ok( $p[0]->threshold->warning, 'eq', "0", "warn okay"); cmp_ok( $p[0]->threshold->critical, 'eq', "0", "crit okay"); +@p = Nagios::Plugin::Performance->parse_perfstring("pct_used=73.7%;90;95"); +cmp_ok( $p[0]->label, "eq", "pct_used", "label okay"); +cmp_ok( $p[0]->value, "eq", "73.7", "value okay"); +cmp_ok( $p[0]->uom, "eq", "%", "uom okay"); + ok( defined eval { $p[0]->threshold->warning->is_set }, "Warning range has been set"); + ok( defined eval { $p[0]->threshold->critical->is_set }, "Critical range has been set"); +cmp_ok( $p[0]->threshold->warning, 'eq', "90", "warn okay"); +cmp_ok( $p[0]->threshold->critical, 'eq', "95", "crit okay"); + # add_perfdata tests in t/Nagios-Plugin-01.t -- cgit v1.2.3-74-g34f1