Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / checks / apc_netbotz_other_sensors
blobd0f9451783be93ae2f5949b84b2e50e5a2f0bf6d
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2016 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 # ails. 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 # Max. eigth sensors
28 # .1.3.6.1.4.1.5528.100.4.2.10.1.4.399845582 Wasserstand_FG1
29 # .1.3.6.1.4.1.5528.100.4.2.10.1.4.3502248167 Ethernet Link Status
30 # .1.3.6.1.4.1.5528.100.4.2.10.1.4.3823829717 A-Link Bus Power
31 # .1.3.6.1.4.1.5528.100.4.2.10.1.3.399845582 0
32 # .1.3.6.1.4.1.5528.100.4.2.10.1.3.3502248167 0
33 # .1.3.6.1.4.1.5528.100.4.2.10.1.3.3823829717 0
34 # .1.3.6.1.4.1.5528.100.4.2.10.1.7.399845582 No Leak
35 # .1.3.6.1.4.1.5528.100.4.2.10.1.7.3502248167 Up
36 # .1.3.6.1.4.1.5528.100.4.2.10.1.7.3823829717 OK
39 # MIB: The sensor reading shown as a string (or empty string
40 # if it is not plugged into a port).
41 def inventory_apc_netbotz_other_sensors(info):
42 for _sensor_label, _error_state, state_readable in info:
43 if state_readable != "":
44 return [(None, None)]
47 def check_apc_netbotz_other_sensors(_no_item, _no_params, info):
48 count_ok_sensors = 0
49 for sensor_label, error_state, state_readable in info:
50 if state_readable != "":
51 if state_readable != "OK":
52 state_readable = state_readable.lower()
54 if error_state == "0":
55 count_ok_sensors += 1
56 else:
57 yield 2, "%s: %s" % (sensor_label, state_readable)
59 if count_ok_sensors > 0:
60 yield 0, "%d sensors are OK" % count_ok_sensors
63 check_info['apc_netbotz_other_sensors'] = {
64 'inventory_function' : inventory_apc_netbotz_other_sensors,
65 'check_function' : check_apc_netbotz_other_sensors,
66 'service_description' : 'Numeric sensors summary',
67 'snmp_info' : (".1.3.6.1.4.1.5528.100.4.2.10.1", [
68 "4", # NETBOTZV2-MIB::otherNumericSensorLabel
69 "3", # NETBOTZV2-MIB::otherNumericSensorErrorStatus
70 "7", # NETBOTZV2-MIB::otherNumericSensorValueStr
71 ]),
72 'snmp_scan_function' : lambda oid: \
73 oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.5528.100.20.10"),