Module: check_mk
Branch: master
Commit: 4913ec566a415d1d73beb0b0b25eb81fb086a8f1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4913ec566a415d…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Dec 17 18:59:56 2013 +0100
FIX df*: Negative filesystem space levels get a more clear text in check output
Instead of just displaying negative values, the text "levels at free space below
XX.XX/YY.YY)
is displayed in plugin output.
---
.bugs/1083 | 7 +++++--
.werks/387 | 11 +++++++++++
ChangeLog | 1 +
checks/df.include | 16 ++++++++++++++--
4 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/.bugs/1083 b/.bugs/1083
index 8017ae1..99a68c0 100644
--- a/.bugs/1083
+++ b/.bugs/1083
@@ -1,10 +1,13 @@
Title: df: do not display negative levels
Component: checks
-State: open
+Class: nastiness
+State: done
Date: 2013-11-13 15:20:04
Targetversion: future
-Class: nastiness
The df check can now use negative levels. This means *free* spac.
But in the check output this should be made clear and not just
printed negative values.
+
+2013-12-17 18:58:31: changed state open -> done
+Added some text instead of the negative values.
diff --git a/.werks/387 b/.werks/387
new file mode 100644
index 0000000..d4712c5
--- /dev/null
+++ b/.werks/387
@@ -0,0 +1,11 @@
+Title: df*: Negative filesystem space levels get a more clear text in check output
+Level: 1
+Component: checks
+Class: fix
+State: unknown
+Version: 1.2.5i1
+Date: 1387303116
+Targetversion: future
+
+Instead of just displaying negative values, the text "levels at free space below
XX.XX/YY.YY)
+is displayed in plugin output.
diff --git a/ChangeLog b/ChangeLog
index 10f03c4..56b1574 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -58,6 +58,7 @@
* 0109 FIX: cisco_fantray: Prevent inventory for not available fans
* 0110 FIX: cisco_fru_power: Prevent inventory for not available FRUs
* 0350 FIX: nfsmounts: correctly handle mount points with spaces...
+ * 0387 FIX: df*: Negative filesystem space levels get a more clear text in check
output...
Multisite:
* 0371 Added log class filter to hostsvcevents view
diff --git a/checks/df.include b/checks/df.include
index 7c4290c..d39ac93 100644
--- a/checks/df.include
+++ b/checks/df.include
@@ -197,11 +197,23 @@ def get_filesystem_levels(host, mountpoint, size_gb, params):
crit_mb = savefloat(size_mb * crit_scaled / 100)
levels["levels_mb"] = (warn_mb, crit_mb)
if type(warn) == float:
- levels["levels_text"] = "(levels at %.2f/%.2f%%)" %
(warn_scaled, crit_scaled)
+ if warn_scaled < 0 and crit_scaled < 0:
+ label = 'levels at free space below'
+ warn_scaled *= -1
+ crit_scaled *= -1
+ else:
+ label = 'levels at'
+ levels["levels_text"] = "(%s %.2f/%.2f%%)" % (label,
warn_scaled, crit_scaled)
else:
+ if warn * mega < 0 and crit * mega < 0:
+ label = 'levels at free space below'
+ warn *= -1
+ crit *= -1
+ else:
+ label = 'levels at'
warn_hr = get_bytes_human_readable(warn * mega)
crit_hr = get_bytes_human_readable(crit * mega)
- levels["levels_text"] = "(levels at %s/%s)" % ( warn_hr,
crit_hr )
+ levels["levels_text"] = "(%s %s/%s)" % (label, warn_hr,
crit_hr)
return levels