Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / cisco_wlc_clients
blob3f55b4a5d1f427c81f8f01acbecda2094ea5f48d
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 # .1.3.6.1.4.1.14179.2.1.1.1.2.1 FOO
28 # .1.3.6.1.4.1.14179.2.1.1.1.2.2 BAR
29 # .1.3.6.1.4.1.14179.2.1.1.1.2.3 Hans
30 # .1.3.6.1.4.1.14179.2.1.1.1.2.4 PETER
31 # .1.3.6.1.4.1.14179.2.1.1.1.2.16 Huhu
32 # .1.3.6.1.4.1.14179.2.1.1.1.42.1 foo
33 # .1.3.6.1.4.1.14179.2.1.1.1.42.2 bar
34 # .1.3.6.1.4.1.14179.2.1.1.1.42.3 hans
35 # .1.3.6.1.4.1.14179.2.1.1.1.42.4 gastzugang
36 # .1.3.6.1.4.1.14179.2.1.1.1.42.16 gastzugang
37 # .1.3.6.1.4.1.14179.2.1.1.1.38.1 6
38 # .1.3.6.1.4.1.14179.2.1.1.1.38.2 12
39 # .1.3.6.1.4.1.14179.2.1.1.1.38.3 0
40 # .1.3.6.1.4.1.14179.2.1.1.1.38.4 6
41 # .1.3.6.1.4.1.14179.2.1.1.1.38.16 6
44 def parse_cisco_wlc_clients(info):
45 parsed = {}
46 sum_clients = 0
47 for name, interface, num_clients in info:
48 sum_clients_name = int(num_clients)
49 sum_clients += sum_clients_name
51 if name in parsed:
52 sum_clients_name += parsed[name][0]
53 interface = parsed[name][1] + ", " + interface
55 parsed[name] = (sum_clients_name, "%s: %s" % (interface, num_clients))
57 parsed["Summary"] = (sum_clients, "")
58 return parsed
61 check_info["cisco_wlc_clients"] = {
62 "parse_function": parse_cisco_wlc_clients,
63 "inventory_function": inventory_wlc_clients,
64 "check_function": check_wlc_clients,
65 "service_description": "Clients %s",
66 "group": "wlc_clients",
67 "has_perfdata": True,
68 "snmp_scan_function": lambda oid: oid('.1.3.6.1.2.1.1.2.0') in [
69 ".1.3.6.1.4.1.14179.1.1.4.3",
70 ".1.3.6.1.4.1.9.1.1069",
71 ".1.3.6.1.4.1.9.1.1615",
72 ".1.3.6.1.4.1.9.1.1645",
73 ".1.3.6.1.4.1.9.1.1631",
74 ".1.3.6.1.4.1.9.1.1279",
75 ".1.3.6.1.4.1.9.1.1293",
76 ".1.3.6.1.4.1.9.1.2170",
77 ".1.3.6.1.4.1.9.1.2371",
78 ".1.3.6.1.4.1.9.1.2250",],
79 "snmp_info": (".1.3.6.1.4.1.14179.2.1.1.1", [
80 "2",
81 "42",
82 "38",
83 ]),
84 "includes": ["wlc_clients.include"],