Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / checks / aruba_wlc_aps
blob038a167bacc124a6d978b1b32f8c02e6ec97670e
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.14823.2.2.1.5.2.1.4.1.3.0.36.108.194.147.166 AP-NAME --> WLSX-WLAN-MIB::wlanAPName.'.$l...'
28 # .1.3.6.1.4.1.14823.2.2.1.5.2.1.4.1.19.0.36.108.194.147.166 2 --> WLSX-WLAN-MIB::wlanAPStatus.'.$l...'
29 # .1.3.6.1.4.1.14823.2.2.1.5.2.1.4.1.2.0.36.108.194.147.166 iii.jjj.kkk.lll --> WLSX-WLAN-MIB::wlanAPIpAddress.'.$l...'
30 # .1.3.6.1.4.1.14823.2.2.1.5.2.1.4.1.4.0.36.108.194.147.166 GROUP --> WLSX-WLAN-MIB::wlanAPGroupName.'.$l...'
31 # .1.3.6.1.4.1.14823.2.2.1.5.2.1.4.1.5.0.36.108.194.147.166 .1.3.6.1.4.1.14823.1.2.34 --> WLSX-WLAN-MIB::wlanAPModel.'.$l...'
32 # .1.3.6.1.4.1.14823.2.2.1.5.2.1.4.1.6.0.36.108.194.147.166 XYZ --> WLSX-WLAN-MIB::wlanAPSerialNumber.'.$l...'
33 # .1.3.6.1.4.1.14823.2.2.1.5.2.1.4.1.22.0.36.108.194.147.166 2 --> WLSX-WLAN-MIB::wlanAPUnprovisioned.'.$l...'
34 # .1.3.6.1.4.1.14823.2.2.1.5.2.1.4.1.32.0.36.108.194.147.166 --> WLSX-WLAN-MIB::wlanAPSysLocation.'.$l...'
37 def inventory_aruba_wlc_aps(info):
38 # Here we discover only provisioned aps which are up
39 return [ (line[0], None) for line in info \
40 if line[1] == "1" and line[2] != "1" ]
43 def check_aruba_wlc_aps(item, params, info):
44 map_state = {
45 "1": (0, "up"),
46 "2": (2, "down"),
48 for ap_name, ap_status, ap_unprovisioned, _ap_ip, ap_group, \
49 _ap_model, _ap_serial, ap_sysloc in info:
50 if item == ap_name:
51 state, state_readable = map_state[ap_status]
52 infotext = "Status: %s" % state_readable
53 if ap_group:
54 infotext += ", Group: %s" % ap_group
55 if ap_sysloc:
56 infotext += ", System location: %s" % ap_sysloc
57 yield state, infotext
58 if ap_unprovisioned == "1":
59 yield 1, "Unprovisioned: yes"
62 check_info["aruba_wlc_aps"] = {
63 "inventory_function": inventory_aruba_wlc_aps,
64 "check_function": check_aruba_wlc_aps,
65 "service_description": "AP %s",
66 "has_perfdata": True,
67 # If you make changes here in snmp_info, don't forget to make
68 # these changes in the related inventory plugin, too.
69 "snmp_info": (
70 ".1.3.6.1.4.1.14823.2.2.1.5.2.1.4.1",
72 "3", # wlanAPName
73 "19", # wlanAPStatus
74 "22", # wlanAPUnprovisioned
75 "2", # wlanAPIpAddress
76 "4", # wlanAPGroupName
77 "5", # wlanAPModel
78 "6", # wlanAPSerialNumber
79 "32", # wlanAPSysLocation
80 ]),
81 "snmp_scan_function":
82 lambda oid: oid('.1.3.6.1.2.1.1.2.0').startswith(".1.3.6.1.4.1.14823.1.1"),