Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / apc_inrow_airflow
blobde7fb76f8872d889abaf83b1ceeceec166fdf5b1
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.
27 apc_inrow_airflow_default_levels = {
28 "level_low": (500.0, 200.0),
29 "level_high": (1000.0, 1100.0),
33 def inventory_apc_inrow_airflow(info):
34 if info:
35 return [(None, "apc_inrow_airflow_default_levels")]
38 def check_apc_inrow_airflow(_no_item, params, info):
39 # The MIB states that this value is given in hundredths of liters per second.
40 # However, it appears that the device actually returns l/s, as the oom should
41 # be closer to 1000 l/s. (cf. https://www.apc.com/salestools/DRON-AAAR53/DRON-AAAR53_R1_EN.pdf)
42 try:
43 flow = float(info[0][0])
44 except:
45 return
47 state = 0
48 message = ""
50 warn, crit = params['level_low']
51 if flow < crit:
52 state = 2
53 message = "too low"
54 elif flow < warn:
55 state = 1
56 message = "too low"
58 warn, crit = params['level_high']
59 if flow >= crit:
60 state = 2
61 message = "too high"
62 elif flow >= warn:
63 state = 1
64 message = "too high"
66 perf = [("flow", flow, warn, crit)]
67 return state, "Current: %.0f l/s %s" % (flow, message), perf
70 check_info["apc_inrow_airflow"] = {
71 "check_function": check_apc_inrow_airflow,
72 "inventory_function": inventory_apc_inrow_airflow,
73 "service_description": "Airflow",
74 "snmp_info": (".1.3.6.1.4.1.318.1.1.13.3.2.2.2", ["5"]),
75 "snmp_scan_function": lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.318.1.3"),
76 "group": "airflow",
77 "has_perfdata": True,