diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2006-06-15 08:38:18 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2006-06-15 08:38:18 +0000 |
commit | e736a3c2b0a62707f12cf66fbb65ef23eeb01dd6 (patch) | |
tree | f8e4dd361b74480752ff7dda173f1fd7ced1868b /t | |
parent | 3e4062f33b9d0ab7c02053400281eb9a26d54003 (diff) | |
download | monitoring-plugin-perl-e736a3c2b0a62707f12cf66fbb65ef23eeb01dd6.tar.gz |
Added rrdlabel method. Fixed parse_perfstring if value=0
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/Nagios-Plugin/trunk@1428 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 't')
-rw-r--r-- | t/Nagios-Plugin-Performance.t | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/t/Nagios-Plugin-Performance.t b/t/Nagios-Plugin-Performance.t index a00b2db..aa0ab64 100644 --- a/t/Nagios-Plugin-Performance.t +++ b/t/Nagios-Plugin-Performance.t | |||
@@ -8,6 +8,7 @@ Nagios::Plugin::Base->exit_on_die(0); | |||
8 | 8 | ||
9 | my @p = Nagios::Plugin::Performance->parse_perfstring("/=382MB;15264;15269;; /var=218MB;9443;9448"); | 9 | my @p = Nagios::Plugin::Performance->parse_perfstring("/=382MB;15264;15269;; /var=218MB;9443;9448"); |
10 | cmp_ok( $p[0]->label, 'eq', "/", "label okay"); | 10 | cmp_ok( $p[0]->label, 'eq', "/", "label okay"); |
11 | cmp_ok( $p[0]->rrdlabel, 'eq', "root", "rrd label okay"); | ||
11 | cmp_ok( $p[0]->value, '==', 382, "value okay"); | 12 | cmp_ok( $p[0]->value, '==', 382, "value okay"); |
12 | cmp_ok( $p[0]->uom, 'eq', "MB", "uom okay"); | 13 | cmp_ok( $p[0]->uom, 'eq', "MB", "uom okay"); |
13 | cmp_ok( $p[0]->threshold->warning->end, "==", 15264, "warn okay"); | 14 | cmp_ok( $p[0]->threshold->warning->end, "==", 15264, "warn okay"); |
@@ -16,6 +17,7 @@ ok( ! defined $p[0]->min, "min okay"); | |||
16 | ok( ! defined $p[0]->max, "max okay"); | 17 | ok( ! defined $p[0]->max, "max okay"); |
17 | 18 | ||
18 | cmp_ok( $p[1]->label, 'eq', "/var", "label okay"); | 19 | cmp_ok( $p[1]->label, 'eq', "/var", "label okay"); |
20 | cmp_ok( $p[1]->rrdlabel, 'eq', "var", "rrd label okay"); | ||
19 | cmp_ok( $p[1]->value, '==', 218, "value okay"); | 21 | cmp_ok( $p[1]->value, '==', 218, "value okay"); |
20 | cmp_ok( $p[1]->uom, 'eq', "MB", "uom okay"); | 22 | cmp_ok( $p[1]->uom, 'eq', "MB", "uom okay"); |
21 | cmp_ok( $p[1]->threshold->warning->end, "==", 9443, "warn okay"); | 23 | cmp_ok( $p[1]->threshold->warning->end, "==", 9443, "warn okay"); |
@@ -65,3 +67,10 @@ cmp_ok( $p[1]->value, "==", 426, "value okay"); | |||
65 | cmp_ok( $p[1]->uom, "eq", "B", "uom okay"); | 67 | cmp_ok( $p[1]->uom, "eq", "B", "uom okay"); |
66 | ok( ! defined $p[1]->threshold->warning, "warn okay"); | 68 | ok( ! defined $p[1]->threshold->warning, "warn okay"); |
67 | ok( ! defined $p[1]->threshold->critical, "crit okay"); | 69 | ok( ! defined $p[1]->threshold->critical, "crit okay"); |
70 | |||
71 | # RRDlabel testing | ||
72 | @p = Nagios::Plugin::Performance->parse_perfstring("/home/a-m=0 shared-folder:big=20 12345678901234567890=20"); | ||
73 | cmp_ok( $p[0]->rrdlabel, "eq", "home_a_m", "changing / to _"); | ||
74 | cmp_ok( $p[1]->rrdlabel, "eq", "shared_folder_big", "replacing bad characters"); | ||
75 | cmp_ok( $p[2]->rrdlabel, "eq", "1234567890123456789", "shortening rrd label"); | ||
76 | |||