Refactoring: Moved check parameters from unsorted.py to dedicated modules (CMK-1393)
[check_mk.git] / checks / windows_os_bonding
blobe2e0d8e70f8e3494e6e1d3105d9c98c967183bbc
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.
27 # <<<windows_os_bonding:sep(58)>>>
28 # Team Name: LAN
29 # Bonding Mode: Dynamic
30 # Status: Up
31 # Speed: 20 Gbps
33 # Slave Name: NIC1
34 # Slave Interface: Ethernet_14
35 # Slave Description: Intel(R) Ethernet 10G 2P X520-k bNDC #2
36 # Slave Status: Up
37 # Slave Speed: 10 Gbps
38 # Slave MAC address: 18-A9-9B-9F-AD-28
40 # Slave Name: NIC2
41 # Slave Interface: Ethernet_10
42 # Slave Description: Intel(R) Ethernet 10G 2P X520-k bNDC
43 # Slave Status: Up
44 # Slave Speed: 10 Gbps
45 # Slave MAC address: 18-A9-9B-9F-AD-2A
48 def parse_windows_os_bonding(info):
49 bonds = {}
51 for line in info:
52 if len(line) > 1:
53 item = line[1].lstrip()
54 if line[0] == "Team Name":
55 bond = item
56 bonds[bond] = {}
57 bonds[bond]["interfaces"] = {}
58 elif line[0] == "Bonding Mode":
59 bonds[bond]["mode"] = item
60 elif line[0] == "Status":
61 bonds[bond]["status"] = item.lower()
62 elif line[0] == "Speed":
63 bonds[bond]["speed"] = item
64 elif line[0] == "Slave Name":
65 slave = item
66 bonds[bond]["interfaces"][slave] = {}
67 elif line[0] == "Slave Status":
68 bonds[bond]["interfaces"][slave]["status"] = item.lower()
69 elif line[0] == "Slave MAC address":
70 bonds[bond]["interfaces"][slave]["hwaddr"] = item.lower().replace("-", ":")
71 return bonds
74 check_info['windows_os_bonding'] = {
75 "parse_function": parse_windows_os_bonding,
76 "check_function": check_bonding,
77 "inventory_function": inventory_bonding,
78 "service_description": "Bonding Interface %s",
79 "default_levels_variable": "bonding_default_levels",
80 "group": "bonding",
81 "includes": ["bonding.include"],