2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
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.15983.1.1.4.2.1.1.2.1 AP1
28 # .1.3.6.1.4.1.15983.1.1.4.2.1.1.4.1 1
29 # .1.3.6.1.4.1.15983.1.1.4.2.1.1.8.1
30 # .1.3.6.1.4.1.15983.1.1.4.2.1.1.17.1 990625700
31 # .1.3.6.1.4.1.15983.1.1.4.2.1.1.26.1 1
32 # .1.3.6.1.4.1.15983.1.1.4.2.1.1.27.1 3
33 # .1.3.6.1.4.1.15983.1.1.3.1.7.1.3.1 "00 0C E6 XX XX XX "
34 # .1.3.6.1.4.1.15983.1.1.3.1.7.1.5.1 1
35 # .1.3.6.1.4.1.15983.1.1.3.1.7.1.9.1 1
38 def parse_fortinet_controller_aps(info
):
44 '4': 'enabled WN license',
58 ap_table
, client_table
= info
59 for descr
, id_
, location
, uptime_str
, oper_state
, availability
in ap_table
:
61 uptime
= int(uptime_str
)
69 "operational": map_oper_state
[oper_state
],
70 "availability": map_availability
[availability
],
71 "clients_count_24": 0,
75 for client
, id_
in client_table
:
76 inst
= parsed
.get(id_
)
80 inst
["clients_count_24"] += 1
82 inst
["clients_count_5"] += 1
86 def inventory_fortinet_controller_aps(parsed
):
87 for key
, values
in parsed
.iteritems():
88 if values
["availability"] != "not installed":
92 def check_fortinet_controller_aps(item
, params
, parsed
):
93 data
= parsed
.get(item
)
97 oper_state
= data
["operational"]
99 if oper_state
== 'unknown':
101 elif oper_state
in ['disabled', 'no license', 'power down']:
103 yield state
, "[%s] Operational: %s" % (data
["descr"], oper_state
)
105 avail_state
= data
["availability"]
107 if avail_state
== 'failed':
109 elif avail_state
in ['power off', 'offline', 'in test', 'not installed']:
111 yield state
, "Availability: %s" % avail_state
113 client_count_24
= data
["clients_count_24"]
114 client_count_5
= data
["clients_count_5"]
115 yield 0, "Connected clients (2,4 ghz/5 ghz): %s/%s"\
116 % (client_count_24
, client_count_5
),\
117 [('5ghz_clients', client_count_5
),
118 ('24ghz_clients', client_count_24
)]
120 uptime
= data
['uptime']
122 yield 0, "Up since %s" % get_timestamp_human_readable(uptime
),\
125 location
= data
.get('location')
127 yield 0, "Located at %s" % location
130 check_info
['fortinet_controller_aps'] = {
131 'parse_function': parse_fortinet_controller_aps
,
132 'inventory_function': inventory_fortinet_controller_aps
,
133 'check_function': check_fortinet_controller_aps
,
134 'service_description': 'AP %s',
135 'has_perfdata': True,
138 '.1.3.6.1.4.1.15983.1.1.4.2.1.1',
140 '2', # MERU-CONFIG-AP-MIB::mwApDescr
141 '4', # MERU-CONFIG-AP-MIB::mwApID
142 '8', # MERU-CONFIG-AP-MIB::mwApLocation
143 '17', # MERU-CONFIG-AP-MIB::mwApUpTime
144 '26', # MERU-CONFIG-AP-MIB::mwApOperationalState
145 '27' # MERU-CONFIG-AP-MIB::mwApAvailabilityStatus
148 '.1.3.6.1.4.1.15983.1.1.3.1.7.1',
150 '5', # MERU-GLOBAL-STATISTICS-MIB::mwApStationStatsIfIndex
151 '9', # MERU-GLOBAL-STATISTICS-MIB::mwApStationStatsNmsApNodeId
154 'snmp_scan_function': lambda oid
: '.1.3.6.1.4.1.15983' in oid('.1.3.6.1.2.1.1.2.0').lower(),