Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / cisco_wlc
blob48e9f80bcb820fe7dbe1ed1d067c521f6b6469ae
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 def inventory_cisco_wlc(info):
29 return [(name, {}) for _node, name, _status in info]
32 def check_cisco_wlc(item, params, info):
33 map_states = {
34 "1": (0, "online"),
35 "2": (2, "critical"),
36 "3": (1, "warning"),
39 for node, name, status in info:
40 if name == item:
41 if node is None:
42 nodeinfo = ''
43 else:
44 nodeinfo = ' (connected to %s)' % node
46 state, state_readable = map_states.get(status, ("3", "unknown[%s]" % status))
47 return state, "Accesspoint: %s%s" % (state_readable, nodeinfo)
49 # Special treatment if this device is missing
50 if params:
51 for ap_name, ap_state in params.get("ap_name", []):
52 if item.startswith(ap_name):
53 return ap_state, "Accesspoint 1 not found (State set to %s by rule)" % core_state_names[
54 ap_state]
56 return 2, "Accesspoint not found"
59 check_info["cisco_wlc"] = {
60 "check_function": check_cisco_wlc,
61 "inventory_function": inventory_cisco_wlc,
62 "group": "cisco_wlc",
63 "service_description": "AP %s",
64 "node_info": True,
65 "snmp_scan_function": lambda oid: oid('.1.3.6.1.2.1.1.2.0') in [
66 ".1.3.6.1.4.1.14179.1.1.4.3",
67 ".1.3.6.1.4.1.9.1.1069",
68 ".1.3.6.1.4.1.9.1.1615",
69 ".1.3.6.1.4.1.9.1.1645",
70 ".1.3.6.1.4.1.9.1.1631",
71 ".1.3.6.1.4.1.9.1.1279",
72 ".1.3.6.1.4.1.9.1.1293",
73 ".1.3.6.1.4.1.9.1.2170",
74 ".1.3.6.1.4.1.9.1.2371",
75 ".1.3.6.1.4.1.9.1.2250",
76 ".1.3.6.1.4.1.9.1.2427",],
77 "snmp_info": (".1.3.6.1.4.1.14179.2.2.1.1", [
78 "3",
79 "6",
80 ]),