Module: check_mk
Branch: master
Commit: 2aa0c2d97c0c8af704d21a42c1d001d3a973d9f3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2aa0c2d97c0c8a…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Dec 4 13:49:14 2014 +0100
#1632 FIX hr_fs: remove ugly "mounted on:" information appearing on Juniper
devices
---
.werks/1632 | 9 +++++++++
ChangeLog | 1 +
checks/hr_fs | 17 ++++++++++++++---
3 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/.werks/1632 b/.werks/1632
new file mode 100644
index 0000000..6a165f2
--- /dev/null
+++ b/.werks/1632
@@ -0,0 +1,9 @@
+Title: hr_fs: remove ugly "mounted on:" information appearing on Juniper
devices
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i7
+Date: 1417697323
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 1491ad2..d791ba6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -94,6 +94,7 @@
* 1618 FIX: ad_replication: Output of timeLastSuccess and timeLastFailure was
inverted...
* 1623 FIX: hp_proliant_mem: support for some yet unhandled status situations
* 1640 FIX: check_jolokia_metrics_serv_req: Fixed wrong levels shown for upper
thresholds
+ * 1632 FIX: hr_fs: remove ugly "mounted on:" information appearing on
Juniper devices
Multisite:
* 1508 Allow input of plugin output and perfdata when faking check results...
diff --git a/checks/hr_fs b/checks/hr_fs
index 0e9a0f5..63dc752 100644
--- a/checks/hr_fs
+++ b/checks/hr_fs
@@ -24,22 +24,31 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-check_includes['hr_fs'] = [ "df.include" ]
+# Juniper devices put information about the device into the
+# field where we expect the mount point. Ugly. Remove that crap.
+def fix_hr_fs_mountpoint(mp):
+ mp = snmp_decode_string(mp)
+ if "mounted on:" in mp:
+ return mp.rsplit(":",1)[-1].strip()
+ else:
+ return mp
+
def inventory_hr_fs(info):
mplist = []
for hrtype, hrdescr, hrunits, hrsize, hrused in info:
- hrdescr = snmp_decode_string(hrdescr)
+ hrdescr = fix_hr_fs_mountpoint(hrdescr)
if hrtype in [ ".1.3.6.1.2.1.25.2.1.4" ] and \
hrdescr not in inventory_df_exclude_mountpoints and \
saveint(hrsize) != 0:
mplist.append(hrdescr)
return df_inventory(mplist)
+
def check_hr_fs(item, params, info):
fslist = []
for hrtype, hrdescr, hrunits, hrsize, hrused in info:
- hrdescr = snmp_decode_string(hrdescr)
+ hrdescr = fix_hr_fs_mountpoint(hrdescr)
if "patterns" in params or item == hrdescr:
unit_size = saveint(hrunits)
hrsize = saveint(hrsize)
@@ -57,6 +66,7 @@ def check_hr_fs(item, params, info):
return df_check_filesystem_list(item, params, fslist)
+
check_info["hr_fs"] = {
'check_function': check_hr_fs,
'inventory_function': inventory_hr_fs,
@@ -74,4 +84,5 @@ check_info["hr_fs"] = {
not not oid('.1.3.6.1.2.1.25.1.1.0'),
'group': 'filesystem',
'default_levels_variable': 'filesystem_default_levels',
+ 'includes': [ "df.include" ],
}