Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / emerson_temp
bloba753bd3cc8cadeb5cc3189eb38d425fcb8f6bcf3
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
11 # +------------------------------------------------------------------+
13 # This file is part of Check_MK.
14 # The official homepage is at http://mathias-kettner.de/check_mk.
16 # check_mk is free software; you can redistribute it and/or modify it
17 # under the terms of the GNU General Public License as published by
18 # the Free Software Foundation in version 2. check_mk is distributed
19 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
20 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
21 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
22 # tails. You should have received a copy of the GNU General Public
23 # License along with GNU Make; see the file COPYING. If not, write
24 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
25 # Boston, MA 02110-1301 USA.
28 # during inventory we are looking for all temperatures available,
29 # in this example there are two (index 1 & 2):
31 # EES-POWER-MIB::psTemperature1.0 .1.3.6.1.4.1.6302.2.1.2.7.1
32 # EES-POWER-MIB::psTemperature2.0 .1.3.6.1.4.1.6302.2.1.2.7.2
34 # the mib is the NetSure_ESNA.mib, which we have received from directly
35 # from a customer, its named "Emerson Energy Systems (EES) Power MIB"
37 factory_settings["emerson_temp_default"] = {"levels": (40, 50)}
40 def inventory_emerson_temp(info):
41 for nr, line in enumerate(info):
42 # Device appears to mark missing sensors by temperature value -999999
43 if int(line[0]) >= -273000:
44 yield nr, {}
47 def check_emerson_temp(item, params, info):
48 if len(info) > item:
49 if int(info[item][0]) < -273000:
50 return 3, "Sensor offline"
52 temp = float(info[item][0]) / 1000.0
53 return check_temperature(temp, params, "emerson_temp_%s" % item)
55 return 3, "Sensor not found in SNMP data"
58 check_info['emerson_temp'] = {
59 "inventory_function": inventory_emerson_temp,
60 "check_function": check_emerson_temp,
61 "service_description": "Temperature %s",
62 "has_perfdata": True,
63 "group": "temperature",
64 "snmp_info": (".1.3.6.1.4.1.6302.2.1.2", ["7"]),
65 "snmp_scan_function":
66 lambda oid: oid('.1.3.6.1.4.1.6302.2.1.1.1.0', "").startswith('Emerson Network Power'),
67 "includes": ["temperature.include"],
68 "default_levels_variable": "emerson_temp_default"