Module: check_mk
Branch: master
Commit: 7635f2357570ff4a6c2cc8fbb6cd90ac50e5898a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7635f2357570ff…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Dec 3 15:36:46 2014 +0100
#1608 zpool_status: Add an overall state check (thx to Craig Cook)
This change adds a check on the reported overall state. Patch can
be found here
http://lists.mathias-kettner.de/pipermail/checkmk-en/2014-May/012174.html
---
.werks/1608 | 11 +++++++++++
ChangeLog | 1 +
checks/zpool_status | 27 ++++++++++++++++++++++++++-
3 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/.werks/1608 b/.werks/1608
new file mode 100644
index 0000000..ff9ac9b
--- /dev/null
+++ b/.werks/1608
@@ -0,0 +1,11 @@
+Title: zpool_status: Add an overall state check (thx to Craig Cook)
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i7
+Date: 1417617359
+Class: feature
+
+This change adds a check on the reported overall state. Patch can
+be found here
http://lists.mathias-kettner.de/pipermail/checkmk-en/2014-May/012174.html
+
diff --git a/ChangeLog b/ChangeLog
index f35b1ec..4d9f8be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -32,6 +32,7 @@
* 1518 raritan_pdu_inlet, raritan_pdu_inlet_summary: Modified existing check to give
one item per phase and support setting levels....
NOTE: Please refer to the migration notes!
* 1592 AIX: New Plugin to monitor errpt in logwatch style...
+ * 1608 zpool_status: Add an overall state check (thx to Craig Cook)...
* 1478 FIX: kernel.util, statgrab_cpu: fix computation of utilization...
* 1480 FIX: brocade_vdx_status: disable check on some devices that do not support
it...
* 1485 FIX: dell_om_disks, dell_om_esmlog, dell_om_mem, dell_om_processors,
dell_om_sensors: detect more devices...
diff --git a/checks/zpool_status b/checks/zpool_status
index fa75269..f84b651 100644
--- a/checks/zpool_status
+++ b/checks/zpool_status
@@ -77,10 +77,34 @@ def check_zpool_status(_no_item, _no_params, info):
warning_pools = {}
pool_messages = {}
state = 0
+ message = []
+
for line in info:
if line[0] == "pool:":
last_pool = line[1]
+ if line[0] == "state:":
+ if line[1] == "ONLINE":
+ state = 0
+ elif line[1] == "DEGRADED":
+ state = 1
+ message.append("DEGRADED State")
+ elif line[1] == "FAULTED":
+ state = 2
+ message.append("FAULTED State")
+ elif line[1] == "UNAVIL":
+ state = 2
+ message.append("UNAVIL State")
+ elif line[1] == "REMOVED":
+ state = 2
+ message.append("REMOVED State")
+ elif line[1] == "OFFLINE":
+ state = 0
+ else:
+ message.append("Unknown State")
+ state = 1
+ continue
+
if line[0] == "NAME":
start_pool = True
continue
@@ -103,7 +127,7 @@ def check_zpool_status(_no_item, _no_params, info):
if saveint(line[4]) != 0:
warning_pools[line[0]] = tuple(line[1:])
- message = []
+
for pool in pool_messages.keys():
state = 1
message.append("%s: %s" % (pool, pool_messages[pool]))
@@ -115,6 +139,7 @@ def check_zpool_status(_no_item, _no_params, info):
for pool in error_pools.keys():
state = 2
message.append("%s State:%s(!!)" % (pool, error_pools[pool][0]))
+
if len(message) == 0:
message = ['No critical errors']
return (state, ", ".join(message))