Module: check_mk
Branch: master
Commit: 9f1c963d2c9741c18d137af370f776402ebac838
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9f1c963d2c9741…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Mon Mar 7 11:22:40 2016 +0100
3258: dell_idrac_disks: fixed disk and component status handling
---
.werks/3258 | 10 ++++
ChangeLog | 1 +
checks/dell_idrac_disks | 140 ++++++++++++++++++++++-------------------------
3 files changed, 75 insertions(+), 76 deletions(-)
diff --git a/.werks/3258 b/.werks/3258
new file mode 100644
index 0000000..c09fdba
--- /dev/null
+++ b/.werks/3258
@@ -0,0 +1,10 @@
+Title: dell_idrac_disks: fixed disk and component status handling
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1457345843
+
+
diff --git a/ChangeLog b/ChangeLog
index f468ae3..3df0ae7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -56,6 +56,7 @@
* 3254 FIX: haproxy: fixed wrong type handling
* 3255 FIX: apc_inrow_temp: fixed wrong discovery handling of available sensors
* 3256 FIX: blade_bx_powerfan: fixed wrong levels handling and minor cleanup
+ * 3258 FIX: dell_idrac_disks: fixed disk and component status handling
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/checks/dell_idrac_disks b/checks/dell_idrac_disks
index 25cf09b..27879f1 100644
--- a/checks/dell_idrac_disks
+++ b/checks/dell_idrac_disks
@@ -24,86 +24,75 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+
+# .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.2.1 Physical Disk 0:1:0 -->
IDRAC-MIB::physicalDiskName.1
+# .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.2.2 Physical Disk 0:1:1 -->
IDRAC-MIB::physicalDiskName.2
+# .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.4.1 8 --> IDRAC-MIB::physicalDiskState.1
+# .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.4.2 8 --> IDRAC-MIB::physicalDiskState.2
+# .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.11.1 1144064 -->
IDRAC-MIB::physicalDiskCapacityInMB.1
+# .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.11.2 1144064 -->
IDRAC-MIB::physicalDiskCapacityInMB.2
+# .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.22.1 1 -->
IDRAC-MIB::physicalDiskSpareState.1
+# .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.22.2 1 -->
IDRAC-MIB::physicalDiskSpareState.2
+# .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.24.1 3 -->
IDRAC-MIB::physicalDiskComponentStatus.1
+# .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.24.2 3 -->
IDRAC-MIB::physicalDiskComponentStatus.2
+# .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.31.1 0 -->
IDRAC-MIB::physicalDiskSmartAlertIndication.1
+# .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.31.2 0 -->
IDRAC-MIB::physicalDiskSmartAlertIndication.2
+# .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.55.1 Disk 0 in Backplane 1 of Integrated RAID
Controller 1 --> IDRAC-MIB::physicalDiskDisplayName.1
+# .1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1.55.2 Disk 1 in Backplane 1 of Integrated RAID
Controller 1 --> IDRAC-MIB::physicalDiskDisplayName.2
+
+
def inventory_dell_idrac_disks(info):
inventory = []
for line in info:
inventory.append(( line[0], None ))
return inventory
+
def check_dell_idrac_disks(item, _no_params, info):
- diskStates = {
- 1 : "unknown",
- 2 : "ready",
- 3 : "online",
- 4 : "foreign",
- 5 : "offline",
- 6 : "blocked",
- 7 : "failed",
- 8 : "non-raid",
- 9 : "removed",
+ map_states = {
+ "disk_states" : {
+ "1" : (1, "unknown"),
+ "2" : (0, "ready"),
+ "3" : (0, "online"),
+ "4" : (1, "foreign"),
+ "5" : (2, "offline"),
+ "6" : (2, "blocked"),
+ "7" : (2, "failed"),
+ "8" : (0, "non-raid"),
+ "9" : (0, "removed"),
+ },
+ "component_states" : {
+ "1" : (0, "other"),
+ "2" : (1, "unknown"),
+ "3" : (0, "OK"),
+ "4" : (0, "non-critical"),
+ "5" : (2, "critical"),
+ "6" : (1, "non-recoverable"),
+ },
}
-
- componentStates = {
- 1 : "Other",
- 2 : "Unknown",
- 3 : "OK",
- 4 : "Non-critical",
- 5 : "Critical",
- 6 : "Non-recoverable"
+ map_spare_state_info = {
+ "1" : "not a spare",
+ "2" : "dedicated hotspare",
+ "3" : "global hotspare",
}
+ for disk_name, disk_state, capacity_MB, spare_state, \
+ component_state, smart_alert, display_name in info:
+ if disk_name == item:
+ yield 0, "[%s] Size: %s" % \
+ (display_name, get_bytes_human_readable(int(capacity_MB) * 1024 * 1024))
- sparestates = {
- 1 : "not a Spare",
- 2 : "dedicated Hotspare",
- 3 : "global Hotspare",
- }
- for diskname, diskState, capacityMB, spareState, componentState, smartAlert,
displayName in info:
- if diskname == item:
- state = 0
- infotexts = []
+ for what, what_key, what_text in [
+ (disk_state, "disk_states", "Disk state"),
+ (component_state, "component_states", "Component
state")]:
+ state, state_readable = map_states[what_key][what]
+ yield state, "%s: %s" % (what_text, state_readable)
- # Component State
- componentState = int(componentState)
- infotext = "State: " + componentStates[componentState]
- if componentState in [ 5, 6 ]:
- state = 2
- infotexts.append(infotext+"(!!)")
- elif componentState in [ 1, 2, 4 ]:
- state = max(state, 1)
- infotexts.append(infotext+"(!)")
+ if smart_alert != "0":
+ yield 2, "Smart alert on disk"
- # Smart Alert
- if smartAlert != '0':
- infotexts.append("Smart Alert on Disk(!!)")
+ if spare_state != "1":
+ yield 0, map_spare_state_info[spare_state]
- # Disk State
- diskState = int(diskState)
- infotext = "Disk State: " + diskStates[diskState]
- label = ""
- show = False
- if diskState in [ 1, 5, 6, 7, 9 ]:
- state = 2
- label = "(!!)"
- show = True
- elif diskState in [ 4, 8 ]:
- state = max(state, 1)
- label = "(!)"
- show = True
- if show:
- infotexts.append(infotext+label)
-
- spareState = int(spareState)
- if spareState != 1:
- infotexts.append('Spare State: ' + sparestates[spareState] )
-
- # Capacity
- infotexts.append("Size: " +
get_bytes_human_readable(int(capacityMB) * 1024 * 1024 ))
-
- # Display Name
- infotexts.append(displayName)
-
- return state, ", ".join(infotexts)
- return 3, "Disk not found in SNMP Output"
check_info["dell_idrac_disks"] = {
"check_function" : check_dell_idrac_disks,
@@ -111,13 +100,12 @@ check_info["dell_idrac_disks"] = {
"service_description" : "Disk %s",
"snmp_scan_function" : lambda oid: oid('.1.3.6.1.2.1.1.2.0') ==
".1.3.6.1.4.1.674.10892.5",
"snmp_info" :
(".1.3.6.1.4.1.674.10892.5.5.1.20.130.4.1", [
- 2, #
physicalDiskName
- 4, #
physicalDiskState
- 11, #
physicalDiskCapacityInMB
- 22, #
physicalDiskSpareState
- 24, #
physicalDiskComponentStatus
- 31, #
physicalDiskSmartAlertIndication
- 55, #
physicalDiskDisplayName
- ]),
+ "2", # physicalDiskName
+ "4", # physicalDiskState
+ "11", # physicalDiskCapacityInMB
+ "22", # physicalDiskSpareState
+ "24", # physicalDiskComponentStatus
+ "31", # physicalDiskSmartAlertIndication
+ "55", # physicalDiskDisplayName
+ ]),
}
-