Module: check_mk
Branch: master
Commit: fcff1db8f108f1040191881977ba8d209b7c4e7b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fcff1db8f108f1…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Nov 6 15:07:40 2015 +0100
#2731 FIX smart.temp: Handles case of missing temperature values correctly
---
.werks/2731 | 10 ++++++++++
ChangeLog | 1 +
checks/smart | 8 +++++---
3 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/.werks/2731 b/.werks/2731
new file mode 100644
index 0000000..2f6a277
--- /dev/null
+++ b/.werks/2731
@@ -0,0 +1,10 @@
+Title: smart.temp: Handles case of missing temperature values correctly
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i4
+Date: 1446818837
+
+
diff --git a/ChangeLog b/ChangeLog
index ffebbb0..07e548c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -55,6 +55,7 @@
* 2727 FIX: ibm_imm_health: Fixed unhandled exception when SNMP info is missing
* 2730 FIX: if64: Grouping of interfaces resulted in an exception...
* 2741 FIX: isc_dhcpd: Fix problem where outdated leases where counted as active
+ * 2731 FIX: smart.temp: Handles case of missing temperature values correctly
Multisite:
* 2684 Added icons for downloading agent data / walks of hosts...
diff --git a/checks/smart b/checks/smart
index 1dfde49..21e598c 100644
--- a/checks/smart
+++ b/checks/smart
@@ -148,11 +148,13 @@ def inventory_smart_temp(info):
def check_smart_temp(item, params, info):
disks = parse_smart(info)
- if item not in disks:
+
+ try:
+ temperature = disks[item]["Temperature_Celsius"]
+ except KeyError:
return
- disk = disks[item]
- return check_temperature(disk["Temperature_Celsius"], params)
+ return check_temperature(temperature, params)
check_info["smart.temp"] = {
'check_function': check_smart_temp,