Cleanup config.nodes_of
[check_mk.git] / checks / gude_relayport
blob97771ed9608cb800f484be8e2c2ada42c4ce2fd7
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 # 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 # .1.3.6.1.4.1.28507.38.1.3.1.2.1.2.1 TWTA 2 --> GUDEADS-EPC822X-MIB::epc822XPortName.1
28 # .1.3.6.1.4.1.28507.38.1.3.1.2.1.3.1 0 --> GUDEADS-EPC822X-MIB::epc822XPortState.1
29 # .1.3.6.1.4.1.28507.38.1.5.1.2.1.4.1 0 --> GUDEADS-EPC822X-MIB::epc822XPowerActive.1
30 # .1.3.6.1.4.1.28507.38.1.5.1.2.1.5.1 0 --> GUDEADS-EPC822X-MIB::epc822XCurrent.1
31 # .1.3.6.1.4.1.28507.38.1.5.1.2.1.6.1 228 --> GUDEADS-EPC822X-MIB::epc822XVoltage.1
32 # .1.3.6.1.4.1.28507.38.1.5.1.2.1.7.1 4995 --> GUDEADS-EPC822X-MIB::epc822XFrequency.1
33 # .1.3.6.1.4.1.28507.38.1.5.1.2.1.10.1 0 --> GUDEADS-EPC822X-MIB::epc822XPowerApparent.1
35 factory_settings["gude_relayport_default_levels"] = {
36 "voltage": (220, 210),
37 "current": (15, 16),
41 def parse_gude_relayport(info):
42 parsed = {}
43 for portname, portstate, active_power_str, \
44 current_str, volt_str, freq_str, appower_str in info:
46 parsed.setdefault(portname, {
47 "device_state": {
48 "0": (2, "off"),
49 "1": (0, "on")
50 }[portstate],
53 for what, key, factor in [
54 (active_power_str, "power", 1.0),
55 (current_str, "current", 0.001),
56 (volt_str, "voltage", 1.0),
57 (freq_str, "frequency", 0.01),
58 (appower_str, "appower", 1.0),
60 parsed[portname][key] = float(what) * factor
62 return parsed
65 check_info['gude_relayport'] = {
66 'parse_function': parse_gude_relayport,
67 'inventory_function': inventory_elphase,
68 'check_function': check_elphase,
69 'service_description': 'Relay port %s',
70 'has_perfdata': True,
71 'snmp_info': (
72 '.1.3.6.1.4.1.28507.38',
74 "1.3.1.2.1.2", # GUDEADS-EPC822X-MIB::epc822XPortName
75 "1.3.1.2.1.3", # GUDEADS-EPC822X-MIB::epc822XPortState
76 "1.5.5.2.1.4", # GUDEADS-EPC822X-MIB::epc822XPowerActive.1
77 "1.5.5.2.1.5", # GUDEADS-EPC822X-MIB::epc822XCurrent.1
78 "1.5.5.2.1.6", # GUDEADS-EPC822X-MIB::epc822XVoltage.1
79 "1.5.5.2.1.7", # GUDEADS-EPC822X-MIB::epc822XFrequency.1
80 "1.5.5.2.1.10", # GUDEADS-EPC822X-MIB::epc822XPowerApparent.1
81 ]),
82 'snmp_scan_function': lambda oid: oid(".1.3.6.1.2.1.1.2.0").startswith(".1.3.6.1.4.1.28507.38"),
83 'default_levels_variable': 'gude_relayport_default_levels',
84 'group': 'el_inphase',
85 'includes': ['elphase.include'],