Module: check_mk
Branch: master
Commit: dd198d266f83dd2f98b6e168dcf733c22177948e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=dd198d266f83dd…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Jan 2 10:31:35 2012 +0100
Filesystem checks: normalize trend perfdata to MB/24h
---
ChangeLog | 5 ++++-
checks/df.include | 12 ++++++++++--
pnp-templates/check_mk-df.php | 22 ++++++++++++----------
3 files changed, 26 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 01e4823..e83dba2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,7 +13,10 @@
existing RRDs of these checks. Sorry, but these have been that last
checks still using counters...
* ibm_imm_health: added last missing scan function
-
+ * Filesystem checks: trend performance data is now normalized to MB/24h.
+ If you have changed the trend range, then your historic values will
+ be displayed in a wrong scale. On the other hand - from now on changes
+ in the range-setting will not affect the graph anymore.
1.1.13i2:
Core, Setup, etc.:
diff --git a/checks/df.include b/checks/df.include
index 6882248..10ff062 100644
--- a/checks/df.include
+++ b/checks/df.include
@@ -155,6 +155,7 @@ def df_check_filesystem(hostname, mountpoint, size_mb, avail_mb,
params):
problems = []
MB = 1024 * 1024.0
+ H24 = 60 * 60 * 24
if levels.get("trend_range"):
try:
@@ -165,7 +166,9 @@ def df_check_filesystem(hostname, mountpoint, size_mb, avail_mb,
params):
# first compute current rate in MB/s by computing delta since last check
timedif, rate = get_counter("df.%s.delta" % mountpoint, this_time,
used_mb, True)
if levels.get("trend_perfdata"):
- perfdata.append(("growth", rate * range_sec))
+ # Change in 1.1.13i3: The trend perfdata always outputs
+ # the growth in MB/24h, not any longer in MB/trendrange
+ perfdata.append(("growth", rate * H24))
# average trend, initialize with zero, rate_avg is in MB/s
timedif, rate_avg = get_average("df.%s.trend" % mountpoint,
@@ -215,7 +218,12 @@ def df_check_filesystem(hostname, mountpoint, size_mb, avail_mb,
params):
problems[-1] += "!"
if levels.get("trend_perfdata"):
- perfdata.append(("trend", trend, warn_perf, crit_perf, 0,
size_mb / range))
+ # New in 1.1.13i3: output trend not as MB / trend_range, but as
+ # MB / 24 hours. The same holds for the warn and crit information.
+ # It is configured in MB / trend range but in the performance data
+ # it's sent as MB / 24h.
+ perfdata.append(("trend", rate_avg * H24, warn_perf / range_sec
* H24,
+ crit_perf / range_sec * H24, 0, size_mb / range))
# compute time until filesystem is full (only for positive trend, of course)
if trend > 0:
diff --git a/pnp-templates/check_mk-df.php b/pnp-templates/check_mk-df.php
index 6bf079c..73818f2 100644
--- a/pnp-templates/check_mk-df.php
+++ b/pnp-templates/check_mk-df.php
@@ -58,15 +58,18 @@ $def[1] .= "GPRINT:var1:LAST:\"current\: %6.2lf GB\"
";
$def[1] .= "GPRINT:var1:MAX:\"max\: %6.2lf GB \" ";
$def[1] .= "GPRINT:var1:AVERAGE:\"avg\: %6.2lf GB\" ";
-# Second graph is optional and shows trend
+# Second graph is optional and shows trend. The MAX field
+# of the third variable contains (size of the filesystem in MB
+# / range in hours). From that we can compute the configured range.
if (isset($DS[2])) {
$size_mb_per_hours = floatval($MAX[3]); // this is size_mb / range(hours)
$size_mb = floatval($MAX[1]);
$hours = 1.0 / ($size_mb_per_hours / $size_mb);
$range = sprintf("%.0fh", $hours);
- // Current growth / shrinking
- $opt[2] = "--vertical-label '+/- MB / $range' -l -1 -u 1 -X0 --title
'$hostname: Growth of $fstitle' ";
+ // Current growth / shrinking. This value is give as MB / 24 hours.
+ // Note: This has changed in 1.1.13i3. Prior it was MB / trend_range!
+ $opt[2] = "--vertical-label '+/- MB / 24h' -l -1 -u 1 -X0 --title
'$hostname: Growth of $fstitle' ";
$def[2] = "DEF:growth_max=$RRDFILE[2]:$DS[2]:MAX ";
$def[2] .= "DEF:growth_min=$RRDFILE[2]:$DS[2]:MIN ";
$def[2] .= "DEF:trend=$RRDFILE[3]:$DS[3]:AVERAGE ";
@@ -77,25 +80,24 @@ if (isset($DS[2])) {
$def[2] .= "HRULE:0#c0c0c0 ";
$def[2] .= "AREA:growth_pos#3060f0:\"Grow\" ";
$def[2] .= "AREA:growth_neg#30f060:\"Shrink \" ";
- $def[2] .= "GPRINT:growth:LAST:\"Current\: %+9.2lfMB / $range\"
";
- $def[2] .= "GPRINT:growth:MAX:\"Max\: %+9.2lfMB / $range\\n\" ";
+ $def[2] .= "GPRINT:growth:LAST:\"Current\: %+9.2lfMB / 24h\" ";
+ $def[2] .= "GPRINT:growth:MAX:\"Max\: %+9.2lfMB / 24h\\n\" ";
// Trend
- $opt[3] = "--vertical-label '+/- MB / $range' -l -1 -u 1 -X0 --title
'$hostname: Trend for $fstitle' ";
+ $opt[3] = "--vertical-label '+/- MB / 24h' -l -1 -u 1 -X0 --title
'$hostname: Trend for $fstitle' ";
$def[3] = "DEF:trend=$RRDFILE[3]:$DS[3]:AVERAGE ";
$def[3] .= "HRULE:0#c0c0c0 ";
$def[3] .= "LINE1:trend#000000:\"Trend\:\" ";
- $def[3] .= "GPRINT:trend:LAST:\"%+7.2lf MB/$range\" ";
+ $def[3] .= "GPRINT:trend:LAST:\"%+7.2lf MB/24h\" ";
if ($WARN[3]) {
- $warn_mb = sprintf("%.2fMB", $WARN[3]);
+ $warn_mb = sprintf("%.2fMB", $WARN[3] * $hours / 24.0);
$def[3] .= "LINE1:$WARN[3]#ffff00:\"Warn\: $warn_mb / $range\"
";
}
if ($CRIT[3]) {
- $crit_mb = sprintf("%.2fMB", $CRIT[3]);
+ $crit_mb = sprintf("%.2fMB", $CRIT[3] * $hours / 24.0);
$def[3] .= "LINE1:$CRIT[3]#ff0000:\"Crit\: $crit_mb / $range\"
";
}
$def[3] .= "COMMENT:\"\\n\" ";
}
-
?>