Module: check_mk
Branch: master
Commit: 03420a9cc34c82df9025da0a001b302f0ed125db
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=03420a9cc34c82…
Author: Bernd Stroessenreuther <bs(a)mathias-kettner.de>
Date: Wed Jul 31 18:45:28 2013 +0200
fully functional version of emcvnx_hwstatus including manpage
---
checkman/emc_storage.hw_status | 49 ----------------------------------------
checkman/emcvnx_hwstatus | 31 +++++++++++++++++++++++++
checks/emcvnx_hwstatus | 33 +++++++++++++++++----------
3 files changed, 52 insertions(+), 61 deletions(-)
diff --git a/checkman/emc_storage.hw_status b/checkman/emc_storage.hw_status
deleted file mode 100644
index 2305b02..0000000
--- a/checkman/emc_storage.hw_status
+++ /dev/null
@@ -1,49 +0,0 @@
-title: EMC Storage: Hardware Status
-agents: emc
-catalog: hw/storage
-license: GPL
-distribution: check_mk
-description:
- Reports the status of Power Supplies, SPS, SPS Cabeling, LCC, CPU Modules,
- SP I/O Modules and DIMM Modules on EMC storage systems.
-
- Returns {OK} if the agent reports "Present" or "Valid" status and
{CRIT}
- on every other status.
-
- Hint for implementation: Look for lines matching
- Bus x Enclosure y Power z State:
- Bus x Enclosure y SPS z State:
- Bus x Enclosure y SPS z Cabling State:
- Bus x Enclosure y CPU Module z State:
- Bus x Enclosure y SP z I/O Module w State:
- Bus x Enclosure y DIMM Module z State:
- Bus x Enclosure y LCC z State:
- in section "Array Information"
-
-item:
- The name of the storage processor as returned by the special agent.
- E. g.
- Bus 0 Enclosure 0 Power A
- Bus 0 Enclosure 0 Power B
- Bus 0 Enclosure 0 SPS A
- Bus 0 Enclosure 0 SPS B
- Bus 0 Enclosure 0 SPS A Cabling
- Bus 0 Enclosure 0 SPS B Cabling
- Bus 0 Enclosure 0 CPU Module A
- Bus 0 Enclosure 0 CPU Module B
- Bus 0 Enclosure 0 SP A I/O Module 0
- Bus 0 Enclosure 0 SP A I/O Module 1
- Bus 0 Enclosure 0 SP B I/O Module 0
- Bus 0 Enclosure 0 SP B I/O Module 1
- Bus 0 Enclosure 0 DIMM Module A
- Bus 0 Enclosure 0 DIMM Module B
- Bus 0 Enclosure 1 LCC A
-
- Hint for implementation: see description
-
-perfdata:
- None
-
-inventory:
- Automatically configures one check for every hardware status entry listed
- in the agent output.
diff --git a/checkman/emcvnx_hwstatus b/checkman/emcvnx_hwstatus
new file mode 100644
index 0000000..8cd77e7
--- /dev/null
+++ b/checkman/emcvnx_hwstatus
@@ -0,0 +1,31 @@
+title: EMC Storage: Hardware Status
+agents: emc
+catalog: hw/storage
+license: GPL
+distribution: check_mk
+description:
+ Reports the status of Power Supplies, SPS, SPS Cabeling, LCC, CPU Modules,
+ SP I/O Modules and DIMM Modules on EMC storage systems.
+
+ Returns {OK} if the agent reports "Present" or "Valid" status and
{CRIT}
+ on every other status.
+
+item:
+ The name of the name of the sensor as returned by the special agent prefixed
+ with Bus ID and Enclosure ID
+
+ E. g.
+
+ 0/0 CPU Module A
+
+ or
+
+ 0/0 SP B I/O Module 0
+
+perfdata:
+ None
+
+inventory:
+ Automatically configures one check for every hardware status entry listed
+ in the agent output and not having status "Empty" (Entries having
"Empty"
+ status when running inventory are considered to be intentionally empty.)
diff --git a/checks/emcvnx_hwstatus b/checks/emcvnx_hwstatus
index 6f1197d..5c14471 100644
--- a/checks/emcvnx_hwstatus
+++ b/checks/emcvnx_hwstatus
@@ -52,11 +52,11 @@
# Parse agent output into a dict of the form:
# parsed = {
-# "0/1" : [
+# "0/1" : {
# "Power A" : "Present",
# "Power B" : "Present",
# # ...
-# ]
+# }
# }
ok_states = ("Present", "Valid")
@@ -73,8 +73,6 @@ def parse_emcvnx_hwstatus(info):
# print "found2: %s" % line
device = line[4] + " " + line[5]
state = line[-1]
- #parsed[encid]{device} = state
- #parsed[encid].append((device, state))
enc[device] = state
elif len(line) > 7 and (line[5] == "Module" or line[6] ==
"Cabling") and line[7] == "State:":
# print "found3: %s" % line
@@ -86,29 +84,40 @@ def parse_emcvnx_hwstatus(info):
device = line[4] + " " + line[5] + " " + line[6] + "
" + line[7] + " " + line[8]
state = line[-1]
enc[device] = state
- else:
+ # else:
# print "ignore: %s" % line
- pass
-
return parsed
-
def inventory_emcvnx_hwstatus(info):
parsed = parse_emcvnx_hwstatus(info)
inventory = []
- #import pprint ; pprint.pprint(parsed)
+ # import pprint ; pprint.pprint(parsed)
for enclosure in parsed:
#print enclosure
#print parsed[enclosure]
for sensor in parsed[enclosure].iterkeys():
- #print "sensor %s vaule %s" % (sensor, parsed[enclosure][sensor])
- if parsed[enclosure][sensor] in ok_states:
+ #print "sensor %s value %s" % (sensor, parsed[enclosure][sensor])
+ if parsed[enclosure][sensor] != "Empty":
inventory.append( (enclosure + " " + sensor, "", None) )
return inventory
def check_emcvnx_hwstatus(item, _no_params, info):
- return 3, "Pech"
+ #print "item: %s" % item
+ parsed = parse_emcvnx_hwstatus(info)
+ for enclosure in parsed:
+ #print enclosure
+ #print parsed[enclosure]
+ for sensor in parsed[enclosure].iterkeys():
+ #print "sensor: %s" % sensor
+ current_item = enclosure + " " + sensor
+ if current_item == item:
+ #print "item %s value %s" % (current_item, parsed[enclosure][sensor])
+ if parsed[enclosure][sensor] in ok_states:
+ return 0, "Enclosure %s is %s" % (current_item,
parsed[enclosure][sensor])
+ else:
+ return 2, "Enclosure %s is %s" % (current_item,
parsed[enclosure][sensor])
+ return 3, "Enclosure %s not found in agent output" % item
check_info['emcvnx_hwstatus'] = {
"inventory_function" : inventory_emcvnx_hwstatus,