Module: check_mk
Branch: master
Commit: daede5c8f149bde65051d9633abab664b4c5fe41
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=daede5c8f149bd…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Aug 28 16:02:03 2018 +0200
6457 FIX IPMI Management board: Improved error handling when sensors can not be read
When the IPMI sensors can not be read because of an incompatible device, the
error is now handled more gracefully. The other IPMI data, like firmware information,
is fetched even when the sensors can not be read and the exceptions are visible on
the command line when executing e.g. cmk -vd [hostname] or cmk -vvd [hostname].
FEED-931
Change-Id: Id67ab4e70749a6ce8d9f6b71877b0238eaaaf472
---
.werks/6457 | 14 ++++++++++++++
cmk_base/data_sources/ipmi.py | 13 +++++++++++--
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/.werks/6457 b/.werks/6457
new file mode 100644
index 0000000..d40d4ff
--- /dev/null
+++ b/.werks/6457
@@ -0,0 +1,14 @@
+Title: IPMI Management board: Improved error handling when sensors can not be read
+Level: 1
+Component: core
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1535464665
+
+When the IPMI sensors can not be read because of an incompatible device, the
+error is now handled more gracefully. The other IPMI data, like firmware information,
+is fetched even when the sensors can not be read and the exceptions are visible on
+the command line when executing e.g. cmk -vd [hostname] or cmk -vvd [hostname].
diff --git a/cmk_base/data_sources/ipmi.py b/cmk_base/data_sources/ipmi.py
index 2ebfee3..c3a1b29 100644
--- a/cmk_base/data_sources/ipmi.py
+++ b/cmk_base/data_sources/ipmi.py
@@ -78,7 +78,7 @@ class IPMIManagementBoardDataSource(ManagementBoardDataSource,
CheckMKAgentDataS
# Improve bad exceptions thrown by pyghmi e.g. in case of connection issues
if type(e) == IpmiException and "%s" % e == "None":
- raise MKAgentError("IPMI communication failed")
+ raise MKAgentError("IPMI communication failed: %r" % e)
else:
raise
@@ -88,6 +88,8 @@ class IPMIManagementBoardDataSource(ManagementBoardDataSource,
CheckMKAgentDataS
# address instead
credentials = self._credentials
+ self._logger.debug("Connecting to %s:623 (User: %s, Privlevel: 2)" %
+ (self._ipaddress, credentials["username"]))
return ipmi_cmd.Command(bmc=self._ipaddress,
userid=credentials["username"],
password=credentials["password"])
@@ -95,7 +97,14 @@ class IPMIManagementBoardDataSource(ManagementBoardDataSource,
CheckMKAgentDataS
def _fetch_ipmi_sensors_section(self, connection):
self._logger.debug("Fetching sensor data via UDP from %s:623" %
(self._ipaddress))
- sdr = ipmi_sdr.SDR(connection)
+
+ try:
+ sdr = ipmi_sdr.SDR(connection)
+ except NotImplementedError, e:
+ self._logger.verbose("Failed to fetch sensor data: %r" % e)
+ self._logger.debug("Exception", exc_info=e)
+ return ""
+
sensors = []
for number in sdr.get_sensor_numbers():
rsp = connection.raw_command(command=0x2d, netfn=4, data=(number,))