Module: check_mk
Branch: master
Commit: a17cc18d28164557d042421671db35b11501a7c2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a17cc18d281645…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Tue Nov 4 11:33:06 2014 +0100
#1201 allnet_ip_sensoric: Detect Temperature Sensors now in more cases
It's possible that the field function is missing in the Output of the allnet device,
so check_mk uses in this case now the field unit to find temperature sensors.
---
.werks/1201 | 10 ++++++++++
ChangeLog | 1 +
checks/allnet_ip_sensoric | 10 ++++++----
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/.werks/1201 b/.werks/1201
new file mode 100644
index 0000000..231381f
--- /dev/null
+++ b/.werks/1201
@@ -0,0 +1,10 @@
+Title: allnet_ip_sensoric: Detect Temperature Sensors now in more cases
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i7
+Date: 1415097074
+Class: feature
+
+It's possible that the field function is missing in the Output of the allnet device,
so check_mk uses in this case now the field unit to find temperature sensors.
+
diff --git a/ChangeLog b/ChangeLog
index 2cc0605..c8b2b6f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,7 @@
NOTE: Please refer to the migration notes!
* 1200 Docsis Checks: Now HW Rev2 of Arris Cable Modems are detected.
* 1486 mk_oracle: completely overhauled ORACLE monitoring...
+ * 1201 allnet_ip_sensoric: Detect Temperature Sensors now in more cases...
* 1478 FIX: kernel.util, statgrab_cpu: fix computation of utilization...
* 1480 FIX: brocade_vdx_status: disable check on some devices that do not support
it...
* 1485 FIX: dell_om_disks, dell_om_esmlog, dell_om_mem, dell_om_processors,
dell_om_sensors: detect more devices...
diff --git a/checks/allnet_ip_sensoric b/checks/allnet_ip_sensoric
index c931794..06a6d1a 100644
--- a/checks/allnet_ip_sensoric
+++ b/checks/allnet_ip_sensoric
@@ -96,9 +96,10 @@ def allnet_ip_sensoric_parse(info):
for key, value in info:
match = re.search('(\w+)\.(\w+)', key)
if match:
- if match.group(1) not in parsed.keys():
- parsed[match.group(1)] = {}
- parsed[match.group(1)][match.group(2)] = value
+ sensor = match.group(1)
+ field = match.group(2)
+ parsed.setdefault(sensor, {})
+ parsed[sensor][field] = value
return parsed
@@ -169,7 +170,8 @@ def inventory_allnet_ip_sensoric_temp(info):
parsed = allnet_ip_sensoric_parse(info)
inventory = []
for sensor in parsed.keys():
- if "function" in parsed[sensor].keys() and
parsed[sensor]["function"] == "1":
+ if (parsed[sensor].get('function') and
parsed[sensor]["function"] == "1") \
+ or (parsed[sensor].get('unit') and parsed[sensor]['unit'] ==
'°C'):
item = allnet_ip_sensoric_compose_item(sensor, parsed[sensor])
inventory.append( (item, "allnet_ip_sensoric_temp_default_levels")
)
return inventory