Module: check_mk
Branch: master
Commit: a2417078b8caeeb30752e82eddf531a376f597eb
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a2417078b8caeeā¦
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Sun Dec 28 15:57:54 2014 +0100
#1818 FIX dell_poweredge_cpu: Fix exception where BrandName is missing
---
.werks/1818 | 10 ++++++++
ChangeLog | 1 +
checks/dell_poweredge_cpu | 61 ++++++++++++++++++++++-----------------------
3 files changed, 41 insertions(+), 31 deletions(-)
diff --git a/.werks/1818 b/.werks/1818
new file mode 100644
index 0000000..d952968
--- /dev/null
+++ b/.werks/1818
@@ -0,0 +1,10 @@
+Title: dell_poweredge_cpu: Fix exception where BrandName is missing
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1419778658
+
+
diff --git a/ChangeLog b/ChangeLog
index 9520bde..5d7bb3a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -41,6 +41,7 @@
* 1793 FIX: fritz: avoid Exception in inventory function of fritz checks if agent
output is empty
* 1795 FIX: Fix internal exception in WATO rule for filesystems...
* 1522 FIX: quantum_libsmall_door, quantum libsmall_status: Fixed broken scan
function
+ * 1818 FIX: dell_poweredge_cpu: Fix exception where BrandName is missing
Multisite:
* 1758 Improved exception hander: Shows details without additional debug request,
added mailto link for error report...
diff --git a/checks/dell_poweredge_cpu b/checks/dell_poweredge_cpu
index 5c13a34..7886a45 100644
--- a/checks/dell_poweredge_cpu
+++ b/checks/dell_poweredge_cpu
@@ -24,55 +24,54 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+
def inventory_dell_poweredge_cpu(info):
- inventory = []
- for line in info[0]:
- if line[5] != "" and line[2] != "1":
- inventory.append( ( line[5], None ) )
- return inventory
+ for chassisIndex, Index, StateSettings, Status, LocationName in info[0]:
+ if LocationName != "" and StateSettings != "1":
+ yield LocationName, None
+
def check_dell_poweredge_cpu(item, _no_params, info):
- for chassisIndex, Index, StateSettings, Status, Reading, LocationName in info[0]:
+ for chassisIndex, Index, StateSettings, Status, LocationName in info[0]:
if item == LocationName:
+ BrandName = None
for line in info[1]:
if line[0] == chassisIndex and line[1] == Index:
BrandName = line[2]
state_table = {
- "1" : ( "other", 1 ),
- "2" : ( "unknown", 1 ),
- "3" : ( "", 0 ),
- "4" : ( "nonCritical", 1 ),
- "5" : ( "Critical", 2 ),
- "6" : ( "NonRecoverable", 2 ),
+ "1" : ("other", 1),
+ "2" : ("unknown", 1),
+ "3" : ("", 0),
+ "4" : ("non-critical", 1),
+ "5" : ("critical", 2),
+ "6" : ("non-recoverable", 2),
}
- state_txt, state = state_table.get(Status, ( "unknown state", 2 ))
- infotext = "%s %s" % ( BrandName, state_txt )
+
+ infotext, state = state_table.get(Status, ( "unknown state", 2 ))
+ if BrandName:
+ infotext += " " + BrandName
return state, infotext
- return 3, "CPU not found"
check_info["dell_poweredge_cpu"] = {
"check_function" : check_dell_poweredge_cpu,
"inventory_function" : inventory_dell_poweredge_cpu,
"service_description" : "%s",
- "has_perfdata" : False,
- "snmp_info" : [ (
".1.3.6.1.4.1.674.10892.5.4.1100.32.1", [
- "1", # processorDevicechassisIndex
- "2", # processorDeviceIndex
- #"3", # processorDeviceStateCapabilities
- "4", # processorDeviceStateSettings
- "5", # processorDeviceStatus
- "6", # processorDeviceReading
- "7", # processorDeviceLocationName
- ]),
- ( ".1.3.6.1.4.1.674.10892.5.4.1100.30.1", [
- "1", # processorDevicechassisIndex
- "2", # processorDeviceIndex
- "23", # processorDeviceBrandName
- ]),
- ],
+ "snmp_info" : [(
".1.3.6.1.4.1.674.10892.5.4.1100.32.1", [
+ 1, # processorDevicechassisIndex
+ 2, # processorDeviceIndex
+ 4, # processorDeviceStateSettings
+ 5, # processorDeviceStatus
+ 7, # processorDeviceLocationName
+ ]),
+ ( ".1.3.6.1.4.1.674.10892.5.4.1100.30.1", [
+ 1, # processorDevicechassisIndex
+ 2, # processorDeviceIndex
+ 23, # processorDeviceBrandName
+ ])
+ ],
"snmp_scan_function" : lambda oid: oid('.1.3.6.1.2.1.1.2.0') ==
".1.3.6.1.4.1.674.10892.5",
}