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 aironet_default_strength_levels
= (-25, -20)
28 aironet_default_quality_levels
= (40, 35)
30 # Note: this check uses three different items in order
31 # to distinguish three independent aspects. This should rather
32 # be converted to subchecks, because:
33 # - Subchecks can ship separate PNP templates.
34 # - Perf-O-Meters need separate checks, as well.
35 # - WATO configuration is done on a per-check basis and
36 # the parameters for the three aspects are not of the same
40 def inventory_aironet_clients(info
):
42 return [("strength", "aironet_default_strength_levels"),
43 ("quality", "aironet_default_quality_levels"), ("clients", None)]
46 def check_aironet_clients(item
, params
, info
):
47 info
= [line
for line
in info
if line
[0] != '']
50 return (0, "No clients currently logged in")
53 return (0, "%d clients currently logged in" % len(info
), [("clients", len(info
), None, None,
56 # item = "quality" or "strength"
70 avg
= sum([saveint(line
[index
]) for line
in info
]) / float(len(info
))
72 perfdata
= [(item
, avg
, warn
, crit
, mmin
, mmax
)]
73 infotxt
= "signal %s at %.1f%s (warn/crit at %s%s/%s%s)" % \
74 (item
, avg
, unit
, warn
, unit
, crit
, unit
)
76 if neg
* avg
<= neg
* crit
:
77 return (2, infotxt
, perfdata
)
78 elif neg
* avg
<= neg
* warn
:
79 return (1, infotxt
, perfdata
)
80 return (0, infotxt
, perfdata
)
83 check_info
["aironet_clients"] = {
84 'check_function': check_aironet_clients
,
85 'inventory_function': inventory_aironet_clients
,
86 'service_description': 'Average client signal %s',
89 '.1.3.6.1.4.1.9.9.273.1.3.1.1',
91 3, # CISCO-DOT11-ASSOCIATION-MIB::cDot11ClientSignalStrength
92 4, # CISCO-DOT11-ASSOCIATION-MIB::cDot11ClientSigQuality
94 'snmp_scan_function': lambda oid
: oid(".1.3.6.1.2.1.1.2.0") in [
95 ".1.3.6.1.4.1.9.1.525",
96 ".1.3.6.1.4.1.9.1.618",
97 ".1.3.6.1.4.1.9.1.685",
98 ".1.3.6.1.4.1.9.1.758",
99 ".1.3.6.1.4.1.9.1.1034",
100 ".1.3.6.1.4.1.9.1.1247",
101 ".1.3.6.1.4.1.9.1.1873",
102 ".1.3.6.1.4.1.9.1.1661",
103 ".1.3.6.1.4.1.9.1.2240",],