Cleanup config.nodes_of
[check_mk.git] / checks / bvip_link
blob65c007b8ccd9e5250111f33eca623211d74cab6c
1 #!/usr/bin/python
2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
9 # | |
10 # | Copyright Mathias Kettner 2013 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 factory_settings["bvip_link_default_levels"] = {
28 'ok_states': [0, 4, 5],
29 'warn_states': [7],
30 'crit_states': [1, 2, 3],
34 def inventory_bvip_link(info):
35 if info:
36 return [(None, {})]
37 return []
40 def check_bvip_link(_no_item, params, info):
41 count = 0
42 states = {
43 0: "No Link",
44 1: "10 MBit - HalfDuplex",
45 2: "10 MBit - FullDuplex",
46 3: "100 Mbit - HalfDuplex",
47 4: "100 Mbit - FullDuplex",
48 5: "1 Gbit - FullDuplex",
49 7: "Wifi",
51 for line in info:
52 count += 1
53 link_status = int(line[0])
54 if link_status in params['ok_states']:
55 state = 0
56 elif link_status in params['crit_states']:
57 state = 2
58 elif link_status in params['warn_states']:
59 state = 1
60 else:
61 state = 3
62 yield state, "%s: State: %s" % \
63 (count, states.get(link_status, "Not Implemented (%s)" % link_status))
66 check_info["bvip_link"] = {
67 "check_function": check_bvip_link,
68 "inventory_function": inventory_bvip_link,
69 "service_description": "Network Link",
70 "snmp_scan_function": bvip_scan_function,
71 "snmp_info": (".1.3.6.1.4.1.3967.1.5.1.8", [1]),
72 "includes": ['bvip.include'],
73 "default_levels_variable": "bvip_link_default_levels",
74 "group": "bvip_link",