summaryrefslogtreecommitdiffstats
path: root/web/attachments/213396-check_disk.reverse_perfdata.patch
diff options
context:
space:
mode:
Diffstat (limited to 'web/attachments/213396-check_disk.reverse_perfdata.patch')
-rw-r--r--web/attachments/213396-check_disk.reverse_perfdata.patch69
1 files changed, 69 insertions, 0 deletions
diff --git a/web/attachments/213396-check_disk.reverse_perfdata.patch b/web/attachments/213396-check_disk.reverse_perfdata.patch
new file mode 100644
index 0000000..7f2a94d
--- /dev/null
+++ b/web/attachments/213396-check_disk.reverse_perfdata.patch
@@ -0,0 +1,69 @@
1Index: plugins/check_disk.c
2===================================================================
3RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_disk.c,v
4retrieving revision 1.82
5diff -u -r1.82 check_disk.c
6--- plugins/check_disk.c 7 Jan 2007 07:14:04 -0000 1.82
7+++ plugins/check_disk.c 27 Jan 2007 18:01:18 -0000
8@@ -306,16 +306,16 @@
9 critical_high_tide = UINT_MAX;
10
11 if (path->freespace_units->warning != NULL) {
12- warning_high_tide = dtotal_units - path->freespace_units->warning->end;
13+ warning_high_tide = path->freespace_units->warning->end;
14 }
15 if (path->freespace_percent->warning != NULL) {
16- warning_high_tide = abs( min( (double) warning_high_tide, (double) (1.0 - path->freespace_percent->warning->end/100)*dtotal_units ));
17+ warning_high_tide = abs( min( (double) warning_high_tide, (double) path->freespace_percent->warning->end/100*dtotal_units ));
18 }
19 if (path->freespace_units->critical != NULL) {
20- critical_high_tide = dtotal_units - path->freespace_units->critical->end;
21+ critical_high_tide = path->freespace_units->critical->end;
22 }
23 if (path->freespace_percent->critical != NULL) {
24- critical_high_tide = abs( min( (double) critical_high_tide, (double) (1.0 - path->freespace_percent->critical->end/100)*dtotal_units ));
25+ critical_high_tide = abs( min( (double) critical_high_tide, (double) path->freespace_percent->critical->end/100*dtotal_units ));
26 }
27
28 asprintf (&perf, "%s %s", perf,
29Index: plugins/t/check_disk.t
30===================================================================
31RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/t/check_disk.t,v
32retrieving revision 1.16
33diff -u -r1.16 check_disk.t
34--- plugins/t/check_disk.t 8 Jan 2007 11:05:55 -0000 1.16
35+++ plugins/t/check_disk.t 27 Jan 2007 18:01:18 -0000
36@@ -24,7 +24,7 @@
37 if ($mountpoint_valid eq "" or $mountpoint2_valid eq "") {
38 plan skip_all => "Need 2 mountpoints to test";
39 } else {
40- plan tests => 57;
41+ plan tests => 61;
42 }
43
44 $result = NPTest->testCmd(
45@@ -76,6 +76,24 @@
46 die "Two mountpoints with same inodes free - cannot do rest of test";
47 }
48
49+# Verify performance data
50+# First check absolute thresholds...
51+$result = NPTest->testCmd(
52+ "./check_disk -w 20 -c 10 -p $mountpoint_valid"
53+ );
54+$_ = $result->perf_output;
55+my ($warn_absth_data, $crit_absth_data) = (m/=.[^;]*;(\d+);(\d+);\d+;\d+/);
56+is ($warn_absth_data, 20, "Wrong warning in perf data using absolute thresholds");
57+is ($crit_absth_data, 10, "Wrong critical in perf data using absolute thresholds");
58+
59+# Then check percent thresholds.
60+$result = NPTest->testCmd(
61+ "./check_disk -w 20% -c 10% -p $mountpoint_valid"
62+ );
63+$_ = $result->perf_output;
64+my ($warn_percth_data, $crit_percth_data, $total_percth_data) = (m/=.[^;]*;(\d+);(\d+);\d+;(\d+)/);
65+is ($warn_percth_data, int($total_percth_data/100*20), "Wrong warning in perf data using percent thresholds");
66+is ($crit_percth_data, int($total_percth_data/100*10), "Wrong critical in perf data using percent thresholds");
67
68
69 # Check when order of mount points are reversed, that perf data remains same