Module: check_mk
Branch: master
Commit: ffd664f68acc28fba26879cb73f56d4a2e2dc8c8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ffd664f68acc28…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Fri Aug 8 14:44:03 2014 +0200
#0202 cisco_temp_sensor: It is now possible to configure this check in WATO.
If you want to configure existing services ( created by this check), please do a
reinventory first.
Otherwhise no action is required.
---
.werks/202 | 11 +++++++++
ChangeLog | 1 +
checkman/cisco_temp_sensor | 2 +-
checks/cisco_temp_sensor | 55 +++++++++++++++++++++++++-------------------
4 files changed, 44 insertions(+), 25 deletions(-)
diff --git a/.werks/202 b/.werks/202
new file mode 100644
index 0000000..f7511ab
--- /dev/null
+++ b/.werks/202
@@ -0,0 +1,11 @@
+Title: cisco_temp_sensor: It is now possible to configure this check in WATO.
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i6
+Date: 1407501717
+Class: feature
+
+If you want to configure existing services ( created by this check), please do a
reinventory first.
+Otherwhise no action is required.
+
diff --git a/ChangeLog b/ChangeLog
index d54ee8e..b373406 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,7 @@
* 0197 check_uniserv: New Check for Uniserv Data Management Services...
* 0199 veeam_client: Check rewritten to get a nicer output
* 0200 arris_cmts_cpu,arris_cmts_temp: New Checks for Arris CMTS Devices (
Temperature and CPU Utilization)
+ * 0202 cisco_temp_sensor: It is now possible to configure this check in WATO....
* 1051 FIX: tcp_conn_stats: fix missing performance data...
* 1142 FIX: winperf_ts_sessions: fix computation, check has never really worked
* 1090 FIX: zfsget: fixed exception which happened on incomplete zfs entries
diff --git a/checkman/cisco_temp_sensor b/checkman/cisco_temp_sensor
index 40fa03d..34dcaab 100644
--- a/checkman/cisco_temp_sensor
+++ b/checkman/cisco_temp_sensor
@@ -10,7 +10,7 @@ description:
sensors MIB and vendor specific information.
Upper warning and critical levels are retrieved from the device
- via SNMP and thus need not to be configured.
+ via SNMP or can be set in WATO.
item:
The name of the sensors as found in the OID tree below.
diff --git a/checks/cisco_temp_sensor b/checks/cisco_temp_sensor
index 4a0affa..f41cdaf 100644
--- a/checks/cisco_temp_sensor
+++ b/checks/cisco_temp_sensor
@@ -127,43 +127,50 @@ def parse_cisco_temp_sensor(info):
# Create main dictionary (only of temperature sensors)
sensors = []
for id, sensortype, value, sensorstate in state_info:
+ # poor try to find temperature values
+ # who are given in tens of degress.
+ # Seems that some new firmware show this behavier.
+ # A normal Temperature Sensor has only a range up to
+ # 60 degree, so i choiced 70.
+ value = saveint(value)
+ if value > 70:
+ value = value / 10
sensors.append( ( id, descriptions.get(id), sensortype,
- saveint(value), sensorstate, thresholds[id] ) )
+ value, sensorstate, thresholds[id] ) )
return sensors
-
def inventory_cisco_temp_sensor(info):
sensors = parse_cisco_temp_sensor(info)
- # Use all temperature sensors with a non-empty description and valid threshold
- return [ (entry[1], None) for entry
- in sensors if entry[1] != None
- and entry[2] == '8'
- and ( len(entry[5]) == 2 or len(entry[5]) == 4 ) ]
+ for id, descr, sensortype, value, sensorstate, levels in sensors:
+ # Use all temperature sensors with a non-empty description and valid threshold
+ if descr != None and sensortype == '8' and len(levels) in [ 2, 4 ]:
+ yield descr, levels[0:2]
-def check_cisco_temp_sensor(item, _no_params, info):
+def check_cisco_temp_sensor(item, params, info):
sensors = parse_cisco_temp_sensor(info)
- for id, descr, sensortype, value, sensorstate, levels in sensors:
+ for id, descr, sensortype, temp, sensorstate, levels in sensors:
if item == descr:
- warn, crit = levels[0:2]
- # poor try to find temperature values
- # who are given in tens of degress.
- # Seems that some new firmware show this behavier.
- # A normal Temperature Sensor has only a range up to
- # 60 degree, so i choiced 70.
- if value > 70:
- value = value / 10
+ # Use build in levels if no lavels are configured
+ if params:
+ warn, crit = params
+ else:
+ warn, crit = levels[0:2]
+
+ infotext = "Temperature is: %.1f °C " % temp
+ levels = " (warn/crit at %.1f/%.1f °C)" % (warn, crit)
+ perfdata = [ ( "temperature", temp, warn, crit ) ]
+ state = 0
if sensorstate == "2":
return (3, "data from sensor currently not available")
elif sensorstate == "3":
return (3, "sensor is broken")
- if value >= crit:
+ if temp >= crit:
state = 2
- elif value >= warn:
+ infotext += levels
+ elif temp >= warn:
state = 1
- else:
- state = 0
- return (state, "%.1fC (levels at %.1f/%.1f)" % (value, warn, crit), [
- ( "temperature", value, warn, crit ) ])
+ infotext += levels
+ return state, infotext, perfdata
return (3, "sensor not found in SNMP data")
@@ -171,6 +178,7 @@ check_info['cisco_temp_sensor'] = {
"check_function" : check_cisco_temp_sensor,
"inventory_function" : inventory_cisco_temp_sensor,
"service_description": "Temperature %s",
+ "group" : "hw_temperature",
"has_perfdata" : True,
"snmp_scan_function" : lambda oid: "cisco" in
oid(".1.3.6.1.2.1.1.1.0").lower() and \
oid(".1.3.6.1.4.1.9.9.91.1.1.1.1.*") !=
None,
@@ -194,6 +202,5 @@ check_info['cisco_temp_sensor'] = {
4, # Thresholds
]),
],
- "group" : "temperature_auto"
}