Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / emc_isilon_temp
blob3f004c4a2658103f49025e8f8dff76556fa54d42
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 inventory_isilon_temp(info, is_cpu):
29 for sensor_name, _value in info:
30 item_name = isilon_temp_item_name(sensor_name)
31 if is_cpu == item_name.startswith("CPU"):
32 yield item_name, {}
35 def check_isilon_temp(item, params, info):
36 for sensor_name, value in info:
37 if item == isilon_temp_item_name(sensor_name):
38 return check_temperature(float(value), params, "isilon_%s" % item)
41 # Expected sensor names:
42 # "Temp Until CPU Throttle (CPU 0)"
43 # "Temp Until CPU Throttle (CPU 1)"
44 # "Temp Chassis 1 (ISI T1)"
45 # "Temp Front Panel"
46 # "Temp Power Supply 1"
47 # "Temp Power Supply 2"
48 # "Temp System"
49 def isilon_temp_item_name(sensor_name):
50 if "CPU Throttle" in sensor_name:
51 return sensor_name.split("(")[1].split(")")[0] # "CPU 1"
52 return sensor_name[5:] # "Front Panel"
55 # .--Air Temperature-----------------------------------------------------.
56 # | _ _ |
57 # | / \ (_)_ __ |
58 # | / _ \ | | '__| |
59 # | / ___ \| | | |
60 # | /_/ \_\_|_| |
61 # | |
62 # | _____ _ |
63 # | |_ _|__ _ __ ___ _ __ ___ _ __ __ _| |_ _ _ _ __ ___ |
64 # | | |/ _ \ '_ ` _ \| '_ \ / _ \ '__/ _` | __| | | | '__/ _ \ |
65 # | | | __/ | | | | | |_) | __/ | | (_| | |_| |_| | | | __/ |
66 # | |_|\___|_| |_| |_| .__/ \___|_| \__,_|\__|\__,_|_| \___| |
67 # | |_| |
68 # '----------------------------------------------------------------------'
70 factory_settings["emc_isilon_temp_default_levels"] = {
71 "levels": (28, 33), # assumed useful levels for ambient / air temperature
74 check_info['emc_isilon_temp'] = {
75 "inventory_function": lambda info: inventory_isilon_temp(info, is_cpu=False),
76 "check_function": check_isilon_temp,
77 "service_description": "Temperature %s",
78 "has_perfdata": True,
79 "group": "temperature",
80 "snmp_info": (
81 ".1.3.6.1.4.1.12124.2.54.1",
83 "3", # ISILON-MIB::tempSensorDescription
84 "4", # ISILON-MIB::tempSensorValue
85 ]),
86 "snmp_scan_function": lambda oid: "isilon" in oid(".1.3.6.1.2.1.1.1.0").lower(),
87 "includes": ["temperature.include"],
88 "default_levels_variable": "emc_isilon_temp_default_levels",
92 # .--CPU Temperature-----------------------------------------------------.
93 # | ____ ____ _ _ |
94 # | / ___| _ \| | | | |
95 # | | | | |_) | | | | |
96 # | | |___| __/| |_| | |
97 # | \____|_| \___/ |
98 # | |
99 # | _____ _ |
100 # | |_ _|__ _ __ ___ _ __ ___ _ __ __ _| |_ _ _ _ __ ___ |
101 # | | |/ _ \ '_ ` _ \| '_ \ / _ \ '__/ _` | __| | | | '__/ _ \ |
102 # | | | __/ | | | | | |_) | __/ | | (_| | |_| |_| | | | __/ |
103 # | |_|\___|_| |_| |_| .__/ \___|_| \__,_|\__|\__,_|_| \___| |
104 # | |_| |
105 # '----------------------------------------------------------------------'
107 factory_settings["emc_isilon_temp_cpu_default_levels"] = {
108 "levels": (75, 85), # assumed useful levels for ambient / air temperature
111 check_info['emc_isilon_temp.cpu'] = {
112 "inventory_function": lambda info: inventory_isilon_temp(info, is_cpu=True),
113 "check_function": check_isilon_temp,
114 "service_description": "Temperature %s",
115 "has_perfdata": True,
116 "group": "temperature",
117 "includes": ["temperature.include"],
118 "default_levels_variable": "emc_isilon_temp_cpu_default_levels",