Module: check_mk
Branch: master
Commit: 438daff35357fef70715913ff09f675269ac854a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=438daff35357fe…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Dec 11 08:24:48 2012 +0100
FIX: zfsget: fix exception on snapshot volumes
---
ChangeLog | 1 +
checks/zfsget | 27 +++++++++++++++------------
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 30c344a..4a96c08 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,7 @@
* Add: check to monitor the summary status of HP EML tape libraries
* Add: apc_rackpdu_status - monitor the power consumption on APC rack PDUs
* Add: sym_brightmail_queues - monitor the queue levels on Symantec Brightmail mail
scanners.
+ * FIX: zfsget: fix exception on snapshot volumes (where available is '-')
Multisite:
* Implemented LDAP integration of Multisite. You can now authenticate your
diff --git a/checks/zfsget b/checks/zfsget
index fa5f8c2..0ed6f93 100644
--- a/checks/zfsget
+++ b/checks/zfsget
@@ -41,16 +41,16 @@
def parse_zfsget(info):
def mb(x):
- return int(x) / (1024.0 * 1024)
+ return saveint(x) / (1024.0 * 1024)
- entries = {}
+ entries = []
entry = None
last_name = None
for line in info:
name, what, value = line[:3]
if last_name != name:
if entry:
- entries[entry["mountpoint"]] = entry
+ entries.append(entry)
entry = {}
last_name = name
if what in ["used", "available"]:
@@ -58,25 +58,28 @@ def parse_zfsget(info):
elif what == "quota":
if value not in [ '0', '-' ]:
entry[what] = mb(value)
- elif what in [ 'mountpoint', 'type' ]:
+ elif what in [ 'mountpoint', 'type', 'name' ]:
entry[what] = value
if entry:
- entries[entry["mountpoint"]] = entry
+ entries.append(entry)
- for mountpoint, entry in entries.items():
- if entry["type"] == 'volume':
- del entries[mountpoint]
- entry["is_pool"] = '/' not in name
- return entries
+ parsed = {}
+ for entry in entries:
+ if entry["mountpoint"] != '-':
+ entry["is_pool"] = '/' not in name
+ parsed[entry["mountpoint"]] = entry
+ return parsed
def inventory_zfsget(info):
mplist = []
- for mountpoint in parse_zfsget(info):
+ parsed = parse_zfsget(info)
+ for mountpoint, properties in parsed.items():
if mountpoint not in inventory_df_exclude_mountpoints:
- mplist.append(mountpoint)
+ if True or properties["available"] != 0:
+ mplist.append(mountpoint)
return df_inventory(mplist)