Module: check_mk
Branch: master
Commit: 8a154dd8e0377f017614aa50a57151eb12f440f5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8a154dd8e0377f…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Dec 4 12:15:16 2014 +0100
#1627 megaraid_ldisks: Warn if current cache or write policy differs from logical drive
default policy
Thanks to Jukka Santala
---
.werks/1627 | 9 +++++++++
ChangeLog | 1 +
checks/megaraid_ldisks | 35 ++++++++++++++++++++++++++++-------
3 files changed, 38 insertions(+), 7 deletions(-)
diff --git a/.werks/1627 b/.werks/1627
new file mode 100644
index 0000000..ba5da8e
--- /dev/null
+++ b/.werks/1627
@@ -0,0 +1,9 @@
+Title: megaraid_ldisks: Warn if current cache or write policy differs from logical drive
default policy
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i7
+Date: 1417691670
+Class: feature
+
+Thanks to Jukka Santala
diff --git a/ChangeLog b/ChangeLog
index f5794c3..128ace9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -46,6 +46,7 @@
* 1615 qnap_disks: Added support for Fujitsu NAS QR802
* 1616 drbd: Added support for Ahead/Behind cluster states (DRBD >= 8.3.10)
* 1626 Renamed service descriptions of filesystem, process and logwatch checks...
+ * 1627 megaraid_ldisks: Warn if current cache or write policy differs from logical
drive default policy...
* 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/megaraid_ldisks b/checks/megaraid_ldisks
index 097fa40..bb56eb5 100644
--- a/checks/megaraid_ldisks
+++ b/checks/megaraid_ldisks
@@ -47,21 +47,42 @@ def inventory_megaraid_ldisks(info):
def check_megaraid_ldisks(item, _no_params, info):
adapter = None
+ cache = None
+ write = None
found = False
+ result = 0
+ infotext = ''
for line in info:
l = ' '.join(line)
if line[0] == "Adapter" and not l.endswith('No Virtual Drive
Configured.'):
adapter = int(line[1])
elif line[0] == "Virtual" and (line[1] == "Disk:" or line[1]
== "Drive:"):
+ if found:
+ break
disk = int(line[2])
found = "%d/%d" % (adapter, disk) == item
- elif found and line[0].startswith("State"):
- state = " ".join(line[1:]).replace(': ', '')
- infotext = "state is %s" % state
- if state == "Optimal":
- return (0, infotext)
- else:
- return (2, infotext)
+ elif found:
+ if line[0].startswith("State"):
+ state = " ".join(line[1:]).replace(': ', '')
+ infotext += "state is %s" % state
+ if state != "Optimal":
+ result = max(result, 2)
+ elif line[0].startswith("Default") and
line[1].startswith("Cache"):
+ cache = " ".join(line[3:]).replace(': ', '')
+ elif line[0].startswith("Current") and
line[1].startswith("Cache"):
+ state = " ".join(line[3:]).replace(': ', '')
+ if cache != state:
+ infotext += ", cache is %s, expected %s" % (state, cache)
+ result = max(result, 1)
+ elif line[0].startswith("Default") and
line[1].startswith("Write"):
+ write = " ".join(line[3:]).replace(': ', '')
+ elif line[0].startswith("Current") and
line[1].startswith("Write"):
+ state = " ".join(line[3:]).replace(': ', '')
+ if write != state:
+ infotext += ", write is %s, expected %s" % (write, cache)
+ result = max(result, 1)
+ if found:
+ return (result, infotext)
return (3, "no such adapter/logical disk found")