Cleanup config.nodes_of
[check_mk.git] / checks / if_lancom
blob976d2e061359704ee15fadb5d8f5649c4d343a6f
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 @network_interface_scan_registry.register
29 def snmp_scan_function_if_lancom(oid):
30 sys_description = oid(".1.3.6.1.2.1.1.1.0")
31 for name in ("LANCOM", "ELSA", "T-Systems"):
32 if name in sys_description:
33 return True
35 if "LAN R800V" not in sys_description or if64_disabled(host_name()):
36 return False
38 return has_ifHCInOctets(oid)
41 def if_lancom_convert(info):
42 iftab, ssidtab = info
43 ssid_dict = dict(ssidtab)
44 new_info = []
45 for line in iftab:
46 if line[20].startswith("P2P") or line[20].startswith("Point-2-Point"):
47 continue
48 else:
49 ifName = line[1]
51 new_line = line[:-1]
52 if line[20].startswith("Logical Network"):
53 new_line[1] += " Logical"
54 ssid = ssid_dict.get(ifName, "")
55 if ssid:
56 new_line[1] += " " + ssid
57 new_line[1] = new_line[1].strip()
58 new_info.append(new_line)
59 return new_info
62 def inventory_if_lancom(info):
63 info = if_lancom_convert(info)
64 fix_if_64_highspeed(info)
65 return inventory_if_common(info)
68 def check_if_lancom(item, params, info):
69 info = if_lancom_convert(info)
70 fix_if_64_highspeed(info)
71 return check_if_common(item, params, info)
74 check_includes['if_lancom'] = ["if.include"]
75 check_info["if_lancom"] = {
76 'check_function': check_if_lancom,
77 'inventory_function': inventory_if_lancom,
78 'service_description': 'Interface %s',
79 'has_perfdata': True,
80 'snmp_info': [
82 ".1.3.6.1.2.1",
84 "2.2.1.1", # ifIndex 0
85 "31.1.1.1.1", # ifName (LANCOM has no useful information if Descr)
86 "2.2.1.3", # ifType 2
87 "31.1.1.1.15", # ifHighSpeed .. 1000 means 1Gbit
88 "2.2.1.8", # ifOperStatus 4
89 "31.1.1.1.6", # ifHCInOctets 5
90 "31.1.1.1.7", # ifHCInUcastPkts 6
91 "31.1.1.1.8", # ifHCInMulticastPkts 7
92 "31.1.1.1.9", # ifHCInBroadcastPkts 8
93 "2.2.1.13", # ifInDiscards 9
94 "2.2.1.14", # ifInErrors 10
95 "31.1.1.1.10", # ifHCOutOctets 11
96 "31.1.1.1.11", # ifHCOutUcastPkts 12
97 "31.1.1.1.12", # ifHCOutMulticastPkts 13
98 "31.1.1.1.13", # ifHCOutBroadcastPkts 14
99 "2.2.1.19", # ifOutDiscards 15
100 "2.2.1.20", # ifOutErrors 16
101 "2.2.1.21", # ifOutQLen 17
102 "31.1.1.1.18", # ifAlias 18
103 BINARY("2.2.1.6"), # ifPhysAddress 19
104 # Used in order to ignore some logical NICs
105 "2.2.1.2", # ifDescr 20
107 (".1.3.6.1.4.1.2356.11.1.3.56.1", [1, 3]) # LANCOM: SSID 21
109 # check if number of network interfaces (IF-MIB::ifNumber.0) is at least 2
110 'snmp_scan_function': snmp_scan_function_if_lancom,
111 'group': 'if',
112 'default_levels_variable': 'if_default_levels',