Cleanup config.nodes_of
[check_mk.git] / checks / aironet_errors
blobc582d0503d7964ef8d865d26551718314566d035
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 aironet_default_error_levels = (1.0, 10.0) # per second
30 def inventory_aironet_errors(info):
31 return [(int(line[0]), 'aironet_default_error_levels') for line in info]
34 def check_aironet_errors(item, params, info):
35 for line in info:
36 if int(line[0]) == item:
37 value = int(line[1])
38 this_time = time.time()
39 persec = get_rate("aironet_errors.%s" % item, this_time, value)
40 warn, crit = params
41 perfdata = [("errors", persec, None, None, warn, crit)]
42 infotxt = "%.2f errors/s" % persec
43 if persec >= crit:
44 return (2, infotxt, perfdata)
45 elif persec >= warn:
46 return (1, infotxt, perfdata)
47 return (0, infotxt, perfdata)
49 return (3, "No radio %s available" % item)
52 check_info["aironet_errors"] = {
53 'check_function': check_aironet_errors,
54 'inventory_function': inventory_aironet_errors,
55 'service_description': 'MAC CRC errors radio %s',
56 'has_perfdata': True,
57 # CISCO-DOT11-IF-MIB::cd11IfRecFrameMacCrcErrors
58 'snmp_info': ('.1.3.6.1.4.1.9.9.272.1.2.1.1.1', [0, 2]),
59 'snmp_scan_function': lambda oid: oid(".1.3.6.1.2.1.1.2.0") in [
60 ".1.3.6.1.4.1.9.1.525",
61 ".1.3.6.1.4.1.9.1.618",
62 ".1.3.6.1.4.1.9.1.685",
63 ".1.3.6.1.4.1.9.1.758",
64 ".1.3.6.1.4.1.9.1.1034",
65 ".1.3.6.1.4.1.9.1.1247",