diff options
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2007-01-27 21:49:21 +0000 |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2007-01-27 21:49:21 +0000 |
commit | 381715a2bd1f9163b791dc2a12ef8c60bac2c19a (patch) | |
tree | 969f519bf33e6b016260805149a7471638b7d6fc /plugins/t/check_disk.t | |
parent | 35fcc425a67d39ad9485e1a542325d4afeddfdc6 (diff) | |
download | monitoring-plugins-381715a2bd1f9163b791dc2a12ef8c60bac2c19a.tar.gz |
Fix #1643463: Miscalculating thresholds check_disk
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1589 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/t/check_disk.t')
-rw-r--r-- | plugins/t/check_disk.t | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/plugins/t/check_disk.t b/plugins/t/check_disk.t index 50d2e6d5..7235d70e 100644 --- a/plugins/t/check_disk.t +++ b/plugins/t/check_disk.t | |||
@@ -24,7 +24,7 @@ my $mountpoint2_valid = getTestParameter( "NP_MOUNTPOINT2_VALID", "Path to anoth | |||
24 | if ($mountpoint_valid eq "" or $mountpoint2_valid eq "") { | 24 | if ($mountpoint_valid eq "" or $mountpoint2_valid eq "") { |
25 | plan skip_all => "Need 2 mountpoints to test"; | 25 | plan skip_all => "Need 2 mountpoints to test"; |
26 | } else { | 26 | } else { |
27 | plan tests => 57; | 27 | plan tests => 61; |
28 | } | 28 | } |
29 | 29 | ||
30 | $result = NPTest->testCmd( | 30 | $result = NPTest->testCmd( |
@@ -76,6 +76,24 @@ if ($free_inode_on_mp1 > $free_inode_on_mp2) { | |||
76 | die "Two mountpoints with same inodes free - cannot do rest of test"; | 76 | die "Two mountpoints with same inodes free - cannot do rest of test"; |
77 | } | 77 | } |
78 | 78 | ||
79 | # Verify performance data | ||
80 | # First check absolute thresholds... | ||
81 | $result = NPTest->testCmd( | ||
82 | "./check_disk -w 20 -c 10 -p $mountpoint_valid" | ||
83 | ); | ||
84 | $_ = $result->perf_output; | ||
85 | my ($warn_absth_data, $crit_absth_data) = (m/=.[^;]*;(\d+);(\d+);\d+;\d+/); | ||
86 | is ($warn_absth_data, 20, "Wrong warning in perf data using absolute thresholds"); | ||
87 | is ($crit_absth_data, 10, "Wrong critical in perf data using absolute thresholds"); | ||
88 | |||
89 | # Then check percent thresholds. | ||
90 | $result = NPTest->testCmd( | ||
91 | "./check_disk -w 20% -c 10% -p $mountpoint_valid" | ||
92 | ); | ||
93 | $_ = $result->perf_output; | ||
94 | my ($warn_percth_data, $crit_percth_data, $total_percth_data) = (m/=.[^;]*;(\d+);(\d+);\d+;(\d+)/); | ||
95 | is ($warn_percth_data, int($total_percth_data/100*20), "Wrong warning in perf data using percent thresholds"); | ||
96 | is ($crit_percth_data, int($total_percth_data/100*10), "Wrong critical in perf data using percent thresholds"); | ||
79 | 97 | ||
80 | 98 | ||
81 | # Check when order of mount points are reversed, that perf data remains same | 99 | # Check when order of mount points are reversed, that perf data remains same |