Module: check_mk
Branch: master
Commit: a8afaa76495e5e26b92931e8658adde6d51f442b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a8afaa76495e5e…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Jan 4 17:24:03 2011 +0100
megaraid_ldisks: Fixed item detection to be compatible with different versions of
megaraid
---
ChangeLog | 1 +
checks/megaraid_ldisks | 11 +++++++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9a66338..4ffece7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -49,6 +49,7 @@
* cups_queues: fixed plugin error due to invalid import of datetime,
converted other checks from 'from datetime import...' to 'import
datetime'.
* printer_supply: handle the case where the current value is missing
+ * megaraid_ldisks: Fixed item detection to be compatible with different versions of
megaraid
Livestatus:
* new column pnpgraph_present in table host and service. In order for this
diff --git a/checks/megaraid_ldisks b/checks/megaraid_ldisks
index 8e9c360..8a023fd 100644
--- a/checks/megaraid_ldisks
+++ b/checks/megaraid_ldisks
@@ -34,23 +34,26 @@
def inventory_megaraid_ldisks(checkname, info):
inventory = []
+ adapter = None
for line in info:
if line[0] == "Adapter":
adapter = int(line[1])
- elif line[0] == "Virtual" and line[1] == "Disk:":
+ elif line[0] == "Virtual" and (line[1] == "Disk:" or line[1]
== "Drive:"):
disk = int(line[2])
inventory.append( ("%d/%d" % (adapter, disk), "", None)
)
return inventory
def check_megaraid_ldisks(item, _no_params, info):
+ adapter = None
for line in info:
+ print line
if line[0] == "Adapter":
adapter = int(line[1])
- elif line[0] == "Virtual" and line[1] == "Disk:":
+ elif line[0] == "Virtual" and (line[1] == "Disk:" or line[1]
== "Drive:"):
disk = int(line[2])
found = "%d/%d" % (adapter, disk) == item
- elif found and line[0] == "State:":
- state = " ".join(line[1:])
+ elif found and line[0].startswith("State"):
+ state = " ".join(line[1:]).replace(': ', '')
infotext = "state is %s" % state
if state == "Optimal":
return (0, "OK - " + infotext)