Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / checks / stulz_pump
blob27c6cfb02b12456929cf611bbe15156d333fdeb3
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_stulz_pump(info):
29 inventory = []
30 for pump_id, _pump_status in info[0]:
31 pump_id = pump_id.replace('.1', '')
32 inventory.append((pump_id, None))
33 return inventory
36 def check_stulz_pump(item, _no_params, info):
37 for index, (pump_id, pump_status) in enumerate(info[0]):
38 pump_id = pump_id.replace('.1', '')
39 if pump_id == item:
40 pump_rpm = info[1][index][0]
41 perfdata = [('rpm', pump_rpm + "%", None, None, 0, 100)]
42 if pump_status == '1':
43 state = 0
44 infotext = "Pump is running at %s%%" % pump_rpm
45 elif pump_status == '0':
46 state = 2
47 infotext = "Pump is not running"
48 else:
49 state = 3
50 infotext = "Pump reports unidentified status " + pump_status
51 return state, infotext, perfdata
52 return 3, "Pump %s not found" % item
55 check_info["stulz_pump"] = {
56 "check_function": check_stulz_pump,
57 "inventory_function": inventory_stulz_pump,
58 "service_description": "Pump %s",
59 "has_perfdata": True,
60 "snmp_scan_function": lambda oid: oid(".1.3.6.1.2.1.1.2.0") == ".1.3.6.1.4.1.29462.10",
61 "snmp_info": [
62 (".1.3.6.1.4.1.29462.10.2.1.1.2.1.4.1.1.5802", [OID_END, 2]),
63 (".1.3.6.1.4.1.29462.10.2.1.1.2.1.4.1.1.5821", [2]),