diff options
-rw-r--r-- | Changes | 4 | ||||
-rw-r--r-- | lib/Nagios/Plugin/Performance.pm | 2 | ||||
-rw-r--r-- | t/Nagios-Plugin-01.t | 10 | ||||
-rw-r--r-- | t/Nagios-Plugin-Performance.t | 2 |
4 files changed, 16 insertions, 2 deletions
@@ -1,5 +1,9 @@ | |||
1 | Revision history for Perl module Nagios::Plugin. | 1 | Revision history for Perl module Nagios::Plugin. |
2 | 2 | ||
3 | ??? ?? | ||
4 | - fixed warnings when no uom specified for add_perfdata | ||
5 | - added max_state function in N::P::Functions | ||
6 | |||
3 | 0.15 19th December 2006 | 7 | 0.15 19th December 2006 |
4 | - exposed Getopt and Threshold functionality from top level Nagios::Plugin | 8 | - exposed Getopt and Threshold functionality from top level Nagios::Plugin |
5 | - exchanged Class::Struct for Class::Accessor | 9 | - exchanged Class::Struct for Class::Accessor |
diff --git a/lib/Nagios/Plugin/Performance.pm b/lib/Nagios/Plugin/Performance.pm index 6e4cd03..fc1c0bc 100644 --- a/lib/Nagios/Plugin/Performance.pm +++ b/lib/Nagios/Plugin/Performance.pm | |||
@@ -22,7 +22,7 @@ struct "Nagios::Plugin::Performance" => { | |||
22 | 22 | ||
23 | sub perfoutput { | 23 | sub perfoutput { |
24 | my $self = shift; | 24 | my $self = shift; |
25 | my $output = $self->label."=".$self->value.$self->uom.";".$self->threshold->warning.";".$self->threshold->critical; | 25 | my $output = $self->label."=".$self->value. ($self->uom || "") .";".$self->threshold->warning.";".$self->threshold->critical; |
26 | return $output; | 26 | return $output; |
27 | } | 27 | } |
28 | 28 | ||
diff --git a/t/Nagios-Plugin-01.t b/t/Nagios-Plugin-01.t index db12c35..3ada472 100644 --- a/t/Nagios-Plugin-01.t +++ b/t/Nagios-Plugin-01.t | |||
@@ -1,7 +1,7 @@ | |||
1 | # Nagios::Plugin original test cases | 1 | # Nagios::Plugin original test cases |
2 | 2 | ||
3 | use strict; | 3 | use strict; |
4 | use Test::More tests => 12; | 4 | use Test::More tests => 13; |
5 | 5 | ||
6 | BEGIN { use_ok('Nagios::Plugin') }; | 6 | BEGIN { use_ok('Nagios::Plugin') }; |
7 | 7 | ||
@@ -41,6 +41,14 @@ $p->add_perfdata( | |||
41 | cmp_ok( $p->all_perfoutput, 'eq', "size=1kB;10:25;~:25", "Perfdata correct"); | 41 | cmp_ok( $p->all_perfoutput, 'eq', "size=1kB;10:25;~:25", "Perfdata correct"); |
42 | #diag "dumping perfdata: ". Dumper ($p->perfdata); | 42 | #diag "dumping perfdata: ". Dumper ($p->perfdata); |
43 | 43 | ||
44 | $p->add_perfdata( | ||
45 | label => "time", | ||
46 | value => "3.52", | ||
47 | threshold => $t, | ||
48 | ); | ||
49 | |||
50 | is( $p->all_perfoutput, "size=1kB;10:25;~:25 time=3.52;10:25;~:25", "Perfdata correct when no uom specified"); | ||
51 | |||
44 | my $expected = {qw( | 52 | my $expected = {qw( |
45 | -1 WARNING | 53 | -1 WARNING |
46 | 1 WARNING | 54 | 1 WARNING |
diff --git a/t/Nagios-Plugin-Performance.t b/t/Nagios-Plugin-Performance.t index e0eb2f6..1ae330a 100644 --- a/t/Nagios-Plugin-Performance.t +++ b/t/Nagios-Plugin-Performance.t | |||
@@ -80,3 +80,5 @@ cmp_ok( $p[0]->rrdlabel, "eq", "home_a_m", "changing / to _"); | |||
80 | cmp_ok( $p[1]->rrdlabel, "eq", "shared_folder_big", "replacing bad characters"); | 80 | cmp_ok( $p[1]->rrdlabel, "eq", "shared_folder_big", "replacing bad characters"); |
81 | cmp_ok( $p[2]->rrdlabel, "eq", "1234567890123456789", "shortening rrd label"); | 81 | cmp_ok( $p[2]->rrdlabel, "eq", "1234567890123456789", "shortening rrd label"); |
82 | 82 | ||
83 | |||
84 | # add_perfdata tests in t/Nagios-Plugin-01.t | ||