Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / checks / emc_datadomain_temps
blob4bde236f249ffc2dd3705d8108fa70f09b8be4fd
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 def format_emc_datadomain_temp(descr, encid, index, new_format):
29 if new_format:
30 return descr + " Enclosure " + encid
31 return encid + "-" + index
34 def inventory_emc_datadomain_temps(info):
35 for encid, index, descr, _reading, _status in info:
36 yield format_emc_datadomain_temp(descr, encid, index, True), {}
39 def check_emc_datadomain_temps(item, params, info):
40 state_table = {
41 "0": (2, "Failed"),
42 "1": (0, "OK"),
43 "2": (2, "Not found"),
44 "3": (1, "Overheat Warning"),
45 "4": (2, "Overheat Critical"),
47 for encid, index, descr, reading, status in info:
48 name = format_emc_datadomain_temp(descr, encid, index, "Enclosure" in item)
49 if item == name:
50 dev_status, state_name = state_table[status]
51 return check_temperature(
52 float(reading),
53 params,
54 "emc_datadomain_temps_%s" % item,
55 dev_status=int(dev_status),
56 dev_status_name=state_name)
59 check_info["emc_datadomain_temps"] = {
60 "check_function": check_emc_datadomain_temps,
61 "inventory_function": inventory_emc_datadomain_temps,
62 "service_description": "Temperature %s",
63 "has_perfdata": True,
64 "group": "temperature",
65 "snmp_info": (
66 ".1.3.6.1.4.1.19746.1.1.2.1.1.1",
68 1, # tempEnclosureID
69 2, # tempSensorIndex
70 4, # tempSensorDescription
71 5, # tempSensorCurrentValue
72 6, # tempSensorStatus
73 ]),
74 "snmp_scan_function": lambda oid: oid(".1.3.6.1.2.1.1.1.0").startswith("Data Domain OS"),
75 "includes": ["temperature.include"]