diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2007-09-04 13:17:01 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2007-09-04 13:17:01 +0000 |
commit | 3ec5d3b8b2426a9acce2faa23a58e615af62930f (patch) | |
tree | 544b1c26587ced6c82b992fc151c66981dc35e81 | |
parent | 819c55cfdd0c26069229ec27a02576d4169defdb (diff) | |
download | monitoring-plugin-perl-3ec5d3b8b2426a9acce2faa23a58e615af62930f.tar.gz |
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
-rw-r--r-- | .cvsignore | 5 | ||||
-rw-r--r-- | Changes | 5 | ||||
-rw-r--r-- | MANIFEST | 22 | ||||
-rw-r--r-- | META.yml | 2 | ||||
-rw-r--r-- | lib/Nagios/Plugin.pm | 3 | ||||
-rw-r--r-- | lib/Nagios/Plugin/Functions.pm | 2 | ||||
-rw-r--r-- | lib/Nagios/Plugin/Performance.pm | 2 | ||||
-rw-r--r-- | t/Nagios-Plugin-Performance.t | 11 |
8 files changed, 32 insertions, 20 deletions
diff --git a/.cvsignore b/.cvsignore deleted file mode 100644 index 96e6eb3..0000000 --- a/.cvsignore +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | Makefile | ||
2 | blib | ||
3 | pm_to_blib | ||
4 | .bzr | ||
5 | .bzrignore | ||
@@ -1,5 +1,10 @@ | |||
1 | Revision history for Perl module Nagios::Plugin. | 1 | Revision history for Perl module Nagios::Plugin. |
2 | 2 | ||
3 | 0.19 4th September 2007 | ||
4 | - Fix test failures due to bad MANIFEST file | ||
5 | - Fixed performance parsing where uom = % | ||
6 | - Fixed version numbering | ||
7 | |||
3 | 0.18 31st August 2007 | 8 | 0.18 31st August 2007 |
4 | - Fix error when parsing performance data where warn or crit are 0 | 9 | - Fix error when parsing performance data where warn or crit are 0 |
5 | - Optional _use_die flag to force nagios_die to call die instead of exit, so | 10 | - Optional _use_die flag to force nagios_die to call die instead of exit, so |
@@ -1,15 +1,18 @@ | |||
1 | Changes | 1 | Changes |
2 | Makefile.PL | ||
3 | MANIFEST | ||
4 | META.yml | ||
5 | README | ||
6 | lib/Nagios/Plugin.pm | 2 | lib/Nagios/Plugin.pm |
3 | lib/Nagios/Plugin/Config.pm | ||
4 | lib/Nagios/Plugin/ExitResult.pm | ||
5 | lib/Nagios/Plugin/Functions.pm | ||
6 | lib/Nagios/Plugin/Getopt.pm | ||
7 | lib/Nagios/Plugin/Performance.pm | 7 | lib/Nagios/Plugin/Performance.pm |
8 | lib/Nagios/Plugin/Range.pm | 8 | lib/Nagios/Plugin/Range.pm |
9 | lib/Nagios/Plugin/Threshold.pm | 9 | lib/Nagios/Plugin/Threshold.pm |
10 | lib/Nagios/Plugin/Functions.pm | 10 | Makefile.PL |
11 | lib/Nagios/Plugin/Getopt.pm | 11 | MANIFEST This list of files |
12 | lib/Nagios/Plugin/ExitResult.pm | 12 | META.yml |
13 | README | ||
14 | t/check_stuff.pl | ||
15 | t/check_stuff.t | ||
13 | t/Nagios-Plugin-01.t | 16 | t/Nagios-Plugin-01.t |
14 | t/Nagios-Plugin-02.t | 17 | t/Nagios-Plugin-02.t |
15 | t/Nagios-Plugin-03.t | 18 | t/Nagios-Plugin-03.t |
@@ -21,12 +24,10 @@ t/Nagios-Plugin-Getopt-01.t | |||
21 | t/Nagios-Plugin-Getopt-02.t | 24 | t/Nagios-Plugin-Getopt-02.t |
22 | t/Nagios-Plugin-Getopt-03.t | 25 | t/Nagios-Plugin-Getopt-03.t |
23 | t/Nagios-Plugin-Getopt-04.t | 26 | t/Nagios-Plugin-Getopt-04.t |
27 | t/Nagios-Plugin-Performance-02.t | ||
24 | t/Nagios-Plugin-Performance.t | 28 | t/Nagios-Plugin-Performance.t |
25 | t/Nagios-Plugin-Range.t | 29 | t/Nagios-Plugin-Range.t |
26 | t/Nagios-Plugin-Threshold.t | 30 | t/Nagios-Plugin-Threshold.t |
27 | t/check_stuff.pl | ||
28 | t/check_stuff.t | ||
29 | t/npg03/README | ||
30 | t/npg03/expected/00_basic | 31 | t/npg03/expected/00_basic |
31 | t/npg03/expected/00_noextra | 32 | t/npg03/expected/00_noextra |
32 | t/npg03/expected/01_override1 | 33 | t/npg03/expected/01_override1 |
@@ -54,3 +55,4 @@ t/npg03/input/12_nosection_implicit | |||
54 | t/npg03/input/13_nosection_explicit_dies | 55 | t/npg03/input/13_nosection_explicit_dies |
55 | t/npg03/input/14_badsection_dies | 56 | t/npg03/input/14_badsection_dies |
56 | t/npg03/plugins.ini | 57 | t/npg03/plugins.ini |
58 | t/npg03/README | ||
@@ -1,7 +1,7 @@ | |||
1 | # http://module-build.sourceforge.net/META-spec.html | 1 | # http://module-build.sourceforge.net/META-spec.html |
2 | #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# | 2 | #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# |
3 | name: Nagios-Plugin | 3 | name: Nagios-Plugin |
4 | version: 0.17 | 4 | version: 0.19 |
5 | version_from: lib/Nagios/Plugin/Functions.pm | 5 | version_from: lib/Nagios/Plugin/Functions.pm |
6 | installdirs: site | 6 | installdirs: site |
7 | requires: | 7 | 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); | |||
24 | 24 | ||
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 | our $VERSION = 0.17; | 27 | # Make sure you update $Nagios::Plugin::Functions::VERSION too |
28 | our $VERSION = 0.19; | ||
28 | # our $VERSION = $Nagios::Plugin::Functions::VERSION; | 29 | # our $VERSION = $Nagios::Plugin::Functions::VERSION; |
29 | 30 | ||
30 | sub new { | 31 | 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); | |||
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.17; | 15 | our $VERSION = 0.19; |
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 7ce5fa1..55e3ddc 100644 --- a/lib/Nagios/Plugin/Performance.pm +++ b/lib/Nagios/Plugin/Performance.pm | |||
@@ -25,7 +25,7 @@ sub import { | |||
25 | sub _parse { | 25 | sub _parse { |
26 | my $class = shift; | 26 | my $class = shift; |
27 | my $string = shift; | 27 | my $string = shift; |
28 | $string =~ s/^([^=]+)=([\d\.]+)(\w*);?([\d\.]+)?;?([\d\.]+)?;?([\d\.]+)?;?([\d\.]+)?\s*//; | 28 | $string =~ s/^([^=]+)=([\d\.]+)([\w%]*);?([\d\.]+)?;?([\d\.]+)?;?([\d\.]+)?;?([\d\.]+)?\s*//; |
29 | return undef unless ((defined $1 && $1 ne "") && (defined $2 && $2 ne "")); | 29 | return undef unless ((defined $1 && $1 ne "") && (defined $2 && $2 ne "")); |
30 | my $p = $class->new( | 30 | my $p = $class->new( |
31 | label => $1, value => $2+0, uom => $3, warning => $4, critical => $5, | 31 | 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 @@ | |||
1 | 1 | ||
2 | use strict; | 2 | use strict; |
3 | use Test::More tests => 84; | 3 | use Test::More tests => 91; |
4 | BEGIN { use_ok('Nagios::Plugin::Performance') }; | 4 | BEGIN { use_ok('Nagios::Plugin::Performance') }; |
5 | 5 | ||
6 | diag "\nusing Nagios::Plugin::Performance revision ". $Nagios::Plugin::Performance::VERSION . "\n" if $ENV{TEST_VERBOSE}; | 6 | 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"); | |||
133 | cmp_ok( $p[0]->threshold->warning, 'eq', "0", "warn okay"); | 133 | cmp_ok( $p[0]->threshold->warning, 'eq', "0", "warn okay"); |
134 | cmp_ok( $p[0]->threshold->critical, 'eq', "0", "crit okay"); | 134 | cmp_ok( $p[0]->threshold->critical, 'eq', "0", "crit okay"); |
135 | 135 | ||
136 | @p = Nagios::Plugin::Performance->parse_perfstring("pct_used=73.7%;90;95"); | ||
137 | cmp_ok( $p[0]->label, "eq", "pct_used", "label okay"); | ||
138 | cmp_ok( $p[0]->value, "eq", "73.7", "value okay"); | ||
139 | cmp_ok( $p[0]->uom, "eq", "%", "uom okay"); | ||
140 | ok( defined eval { $p[0]->threshold->warning->is_set }, "Warning range has been set"); | ||
141 | ok( defined eval { $p[0]->threshold->critical->is_set }, "Critical range has been set"); | ||
142 | cmp_ok( $p[0]->threshold->warning, 'eq', "90", "warn okay"); | ||
143 | cmp_ok( $p[0]->threshold->critical, 'eq', "95", "crit okay"); | ||
144 | |||
136 | # add_perfdata tests in t/Nagios-Plugin-01.t | 145 | # add_perfdata tests in t/Nagios-Plugin-01.t |