Refactored snapin server_time to new snapin API
[check_mk.git] / checks / aruba_wlc_aps
blob14f70e465b2962a50e4e136919fe781b1d143e40
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 # .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...'
29 # .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...'
30 # .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...'
31 # .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...'
32 # .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...'
33 # .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...'
34 # .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...'
35 # .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...'
38 def inventory_aruba_wlc_aps(info):
39 # Here we discover only provisioned aps which are up
40 return [ (line[0], None) for line in info \
41 if line[1] == "1" and line[2] != "1" ]
44 def check_aruba_wlc_aps(item, params, info):
45 map_state = {
46 "1" : (0, "up"),
47 "2" : (2, "down"),
49 for ap_name, ap_status, ap_unprovisioned, _ap_ip, ap_group, \
50 _ap_model, _ap_serial, ap_sysloc in info:
51 if item == ap_name:
52 state, state_readable = map_state[ap_status]
53 infotext = "Status: %s" % state_readable
54 if ap_group:
55 infotext += ", Group: %s" % ap_group
56 if ap_sysloc:
57 infotext += ", System location: %s" % ap_sysloc
58 yield state, infotext
59 if ap_unprovisioned == "1":
60 yield 1, "Unprovisioned: yes"
63 check_info["aruba_wlc_aps"] = {
64 "inventory_function" : inventory_aruba_wlc_aps,
65 "check_function" : check_aruba_wlc_aps,
66 "service_description" : "AP %s",
67 "has_perfdata" : True,
68 # If you make changes here in snmp_info, don't forget to make
69 # these changes in the related inventory plugin, too.
70 "snmp_info" : ( ".1.3.6.1.4.1.14823.2.2.1.5.2.1.4.1",[
71 "3", # wlanAPName
72 "19", # wlanAPStatus
73 "22", # wlanAPUnprovisioned
74 "2", # wlanAPIpAddress
75 "4", # wlanAPGroupName
76 "5", # wlanAPModel
77 "6", # wlanAPSerialNumber
78 "32", # wlanAPSysLocation
79 ]),
80 "snmp_scan_function" : lambda oid: oid('.1.3.6.1.2.1.1.2.0').startswith(".1.3.6.1.4.1.14823.1.1"),