Module: check_mk
Branch: master
Commit: 00333ad4d974f4553dbd48a34f0f189d6973cd67
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=00333ad4d974f4…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Feb 2 15:23:20 2012 +0100
Update nexus_temp, renamed to cisco_temp_sensor
---
ChangeLog | 3 +-
checkman/{nexus_temp => cisco_temp_sensor} | 9 +++-
checks/{nexus_temp => cisco_temp_sensor} | 47 ++++++++++---------
...xus_temp.php => check_mk-cisco_temp_sensor.php} | 3 +-
web/plugins/perfometer/check_mk.py | 1 +
5 files changed, 36 insertions(+), 27 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d0a8bc8..4af43e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -44,7 +44,8 @@
"Temperature %s", in order to be consistent with the other checks.
* mounts: exclude changes of the commit option (might change on laptops),
make only switch to ro critical, other changes warning.
- * nexus_temp: new check for Cisco NEXUS temperature sensors (first version)
+ * cisco_temp_sensor: new check for temperature sensors of Cisco NEXUS
+ and other new Cisco devices
* oracle_tablespace: Fixed tablespace size/free space calculations
Multisite:
diff --git a/checkman/nexus_temp b/checkman/cisco_temp_sensor
similarity index 64%
rename from checkman/nexus_temp
rename to checkman/cisco_temp_sensor
index 412a3c8..55b912d 100644
--- a/checkman/nexus_temp
+++ b/checkman/cisco_temp_sensor
@@ -1,11 +1,11 @@
-title: Check temperature sensors on Cisco NEXUS devices
+title: Check temperature sensors on Cisco devices that support CISCO-ENTITY-SENSOR-MIB
agents: snmp
author: Mathias Kettner <mk(a)mathias-kettner.de>
license: GPL
distribution: check_mk
description:
- This check monitors all temperature sensors for Cisco NEXUS
- devices. It uses a combination of data from the standardized
+ This check monitors all temperature sensors for Cisco devices.
+ It uses a combination of data from the standardized
sensors MIB and vendor specific information.
Warning and critical levels are retrieved from the device
@@ -15,6 +15,9 @@ item:
The name of the sensors as found in the OID tree below.
.1.3.6.1.2.1.47.1.1.1.1.2.
+ The sensor is retrived from the OID tree below.
+ .1.3.6.1.4.1.9.9.91
+
perfdata:
One value: the current temperature including warning and critical levels.
diff --git a/checks/nexus_temp b/checks/cisco_temp_sensor
similarity index 86%
rename from checks/nexus_temp
rename to checks/cisco_temp_sensor
index 29eccb2..b816b30 100644
--- a/checks/nexus_temp
+++ b/checks/cisco_temp_sensor
@@ -108,58 +108,60 @@
# Create a dictionary with the information about each
# sensor. The key into the dict is the end OID of the
# sensor.
-def parse_nexus_temp(info):
+def parse_cisco_temp_sensor(info):
description_info, state_info, levels_info = info
# Create dict of sensor descriptions
descriptions = dict(description_info)
-
+
# Create dict with thresholds
thresholds = {}
+ for id, sensortype, value, sensorstate in state_info:
+ thresholds.setdefault(id, [])
+
for endoid, level in levels_info:
# endoid is e.g. 21549.9 or 21459.10
id, subid = endoid.split('.')
thresholds.setdefault(id, []).append(saveint(level))
-
+
# Create main dictionary (only of temperature sensors)
sensors = []
for id, sensortype, value, sensorstate in state_info:
sensors.append( ( id, descriptions.get(id), sensortype,
saveint(value), sensorstate, thresholds[id] ) )
-
return sensors
-def inventory_nexus_temp(info):
- sensors = parse_nexus_temp(info)
- # Use all temperature sensors with a non-empty description
+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 entry[2] == '8'
+ and len(entry[5]) == 2 ]
-def check_nexus_temp(item, _no_params, info):
- sensors = parse_nexus_temp(info)
+def check_cisco_temp_sensor(item, _no_params, info):
+ sensors = parse_cisco_temp_sensor(info)
for id, descr, sensortype, value, sensorstate, levels in sensors:
if item == descr:
warn, crit = levels
if sensorstate == "2":
- return (3, "UNKNOWN - data from sensor currently not available")
+ return (3, "UNKNOWN - data from sensor currently not available")
elif sensorstate == "3":
- return (3, "UNKNOWN - sensor is broken")
+ return (3, "UNKNOWN - sensor is broken")
if value >= crit:
- state = 2
+ state = 2
elif value >= warn:
- state = 1
+ state = 1
else:
- state = 0
+ state = 0
return (state, nagios_state_names[state] + " - %dC (levels at %d/%d)" %
(value, warn, crit), [
- ( "temperature", value, warn, crit ) ])
-
- return (3, "UKNOWN - sensor not found in SNMP data")
+ ( "temperature", value, warn, crit ) ])
+ return (3, "UNKNOWN - sensor not found in SNMP data")
-check_info['nexus_temp'] = (check_nexus_temp, "Temperature %s", 1,
inventory_nexus_temp)
+check_info['cisco_temp_sensor'] = (check_cisco_temp_sensor, "Temperature
%s", 1, inventory_cisco_temp_sensor)
-snmp_info['nexus_temp'] = [
+snmp_info['cisco_temp_sensor'] = [
# Description of sensors
( ".1.3.6.1.2.1.47.1.1.1.1", [
OID_END,
@@ -181,5 +183,6 @@ snmp_info['nexus_temp'] = [
]),
]
-snmp_scan_functions['nexus_temp'] = \
- lambda oid: "nx-os" in oid(".1.3.6.1.2.1.1.1.0").lower()
+snmp_scan_functions['cisco_temp_sensor'] = \
+ 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
diff --git a/pnp-templates/check_mk-nexus_temp.php
b/pnp-templates/check_mk-cisco_temp_sensor.php
similarity index 96%
rename from pnp-templates/check_mk-nexus_temp.php
rename to pnp-templates/check_mk-cisco_temp_sensor.php
index b6e5a84..2ff82a2 100644
--- a/pnp-templates/check_mk-nexus_temp.php
+++ b/pnp-templates/check_mk-cisco_temp_sensor.php
@@ -23,8 +23,9 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+
$title = str_replace("_", " ", $servicedesc);
-$opt[1] = "--vertical-label \"Celsius\" -l 0 -u 40 --title
\"$title\" ";
+$opt[1] = "--vertical-label \"Celsius\" --title \"$title\" -h
140 ";
$def[1] = "DEF:var1=$RRDFILE[1]:$DS[1]:MAX ";
$def[1] .= "AREA:var1#2080ff:\"Temperature\:\" ";
diff --git a/web/plugins/perfometer/check_mk.py b/web/plugins/perfometer/check_mk.py
index ca05468..39bf3d7 100644
--- a/web/plugins/perfometer/check_mk.py
+++ b/web/plugins/perfometer/check_mk.py
@@ -208,6 +208,7 @@ def perfometer_check_mk_ipmi_sensors(row, check_command, perf_data):
# Also all checks dealing with temperature can use this perfometer
perfometers["check_mk-ipmi_sensors"] = perfometer_check_mk_ipmi_sensors
perfometers["check_mk-nvidia.temp"] = perfometer_check_mk_ipmi_sensors
+perfometers["check_mk-cisco_temp_sensor"] = perfometer_check_mk_ipmi_sensors
def perfometer_check_mk_if(row, check_command, perf_data):
txt = []