Module: check_mk
Branch: master
Commit: 6bf408c051f43dbd731c8e561346798ce309c73a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6bf408c051f43d…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Dec 20 10:40:14 2017 +0100
5601 fortinet_controller_aps: New check which monitors the number of WiFi access points
for Fortinet WLAN controller
Change-Id: I50499069419651283ae609430b38e048c43aa786
---
.werks/5601 | 10 ++++
checkman/fortinet_controller_aps | 17 ++++++
checks/fortinet_controller_aps | 117 +++++++++++++++++++++++++++++++++++++++
web/plugins/metrics/check_mk.py | 12 ++++
4 files changed, 156 insertions(+)
diff --git a/.werks/5601 b/.werks/5601
new file mode 100644
index 0000000..1a82e5f
--- /dev/null
+++ b/.werks/5601
@@ -0,0 +1,10 @@
+Title: fortinet_controller_aps: New check which monitors the number of WiFi access points
for Fortinet WLAN controller
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i3
+Date: 1513762766
+Class: feature
+
+
diff --git a/checkman/fortinet_controller_aps b/checkman/fortinet_controller_aps
new file mode 100644
index 0000000..1b1c621
--- /dev/null
+++ b/checkman/fortinet_controller_aps
@@ -0,0 +1,17 @@
+title: Fortinet WLAN Controller APs: Number of Wifi Access Points
+agents: snmp
+catalog: hw/network/fortinet
+license: GPL
+distribution: check_mk
+description:
+ This checks displays the amount of connected access points on the controller.
+ Per default the check only displays the information for each Access Point.
+ Levels are fixed and the service goes CRIT if an inventorized Access Point is down
+ or not availible.
+
+item:
+ The name of the access point.
+
+inventory:
+ One check for each access point which is successfully connected.
+
diff --git a/checks/fortinet_controller_aps b/checks/fortinet_controller_aps
new file mode 100644
index 0000000..da76475
--- /dev/null
+++ b/checks/fortinet_controller_aps
@@ -0,0 +1,117 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2014 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at
http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# tails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+#
+# .1.3.6.1.4.1.15983.1.1.4.2.1.1.2.1 AP1
+# .1.3.6.1.4.1.15983.1.1.4.2.1.1.4.1 1
+# .1.3.6.1.4.1.15983.1.1.4.2.1.1.8.1
+# .1.3.6.1.4.1.15983.1.1.4.2.1.1.17.1 990625700
+# .1.3.6.1.4.1.15983.1.1.4.2.1.1.26.1 1
+# .1.3.6.1.4.1.15983.1.1.4.2.1.1.27.1 3
+# .1.3.6.1.4.1.15983.1.1.3.1.7.1.3.1 "00 0C E6 XX XX XX "
+# .1.3.6.1.4.1.15983.1.1.3.1.7.1.5.1 1
+# .1.3.6.1.4.1.15983.1.1.3.1.7.1.9.1 1
+
+ap_state = {
+ '1' : ( 0, 'AP is up' ),
+ '2' : ( 1, 'AP is down' ),
+ }
+
+ap_avail = {
+ '1' : ( 3, 'availibility status unknown' ),
+ '2' : ( 2, 'availibility status is disabled' ),
+ '3' : ( 0, 'availibility status is enabled' ),
+ }
+
+def parse_fortinet_controller_aps(info):
+ new_info = []
+ for ap_table in info[0]:
+ new_element = []
+ for client_table in info[1]:
+ if ap_table[1] == client_table[2]:
+ if new_element == []:
+ new_element = [ ap_table, client_table ]
+ else:
+ new_element.append(client_table)
+ if new_element != []:
+ new_info.append(new_element)
+ return new_info
+
+
+def inventory_fortinet_controller_aps(info):
+ for element in info:
+ yield element[0][1], {}
+
+
+def check_fortinet_controller_aps(item, params, info):
+ for element in info:
+ if item == element[0][1]:
+ client_count_24 = 0
+ client_count_5 = 0
+ for client in element[1:]:
+ if client[1] == '1':
+ client_count_24 += 1
+ elif client[1] == '2':
+ client_count_5 += 1
+ else:
+ continue
+ perfdata = [
+ ( 'uptime', element[0][3] ),
+ ( '5ghz_clients', client_count_5 ),
+ ( '24ghz_clients', client_count_24 ),
+ ]
+ yield 0, 'AP %s' % element[0][1], perfdata
+ if element[0][4] == '1' and element[0][5] == '3':
+ yield 0, 'Status: online'
+ else:
+ yield ap_state[element[0][4]]
+ yield ap_avail[element[0][5]]
+ yield 0, 'connected Clients (2,4 ghz / 5 Ghz): %s/%s' % (
client_count_24, client_count_5 )
+ if element[0][2] != '':
+ yield 0, 'located at %s' % element[0][2]
+
+
+check_info['fortinet_controller_aps'] = {
+ 'parse_function' : parse_fortinet_controller_aps,
+ 'inventory_function' : inventory_fortinet_controller_aps,
+ 'check_function' : check_fortinet_controller_aps,
+ 'service_description' : 'AP %s',
+ 'has_perfdata' : True,
+ 'snmp_info' : [('.1.3.6.1.4.1.15983.1.1.4.2.1.1', [
+ '2', # mwApDescr
+ '4', # mwApID
+ '8', # mwApLocation
+ '17', # mwApUpTime
+ '26', # mwApOperationalState
+ '27' # mwApAvailabilityStatus
+ ] ),
+ ( '.1.3.6.1.4.1.15983.1.1.3.1.7.1', [
+ '3', # Client Mac
+ '5', # Iface Name
+ '9' # AP_ID
+ ]
+ )],
+ 'snmp_scan_function' : lambda oid : '.1.3.6.1.4.1.15983' in
oid('.1.3.6.1.2.1.1.2.0').lower(),
+}
diff --git a/web/plugins/metrics/check_mk.py b/web/plugins/metrics/check_mk.py
index e321a98..a51c979 100644
--- a/web/plugins/metrics/check_mk.py
+++ b/web/plugins/metrics/check_mk.py
@@ -1093,6 +1093,18 @@ metric_info["threads_busy"] = {
"color" : "34/a",
}
+metric_info["5ghz_clients"] = {
+ "title" : _("Client connects for 5 Ghz Band"),
+ "unit" : "count",
+ "color" : "13/a",
+}
+
+metric_info["24ghz_clients"] = {
+ "title" : _("Client connects for 2,4 Ghz Band"),
+ "unit" : "count",
+ "color" : "14/a",
+}
+
for what, color in [ ("msg", "12"), ("rollovers",
"13"), ("regular", "14"),
("warning", "15"), ("user",
"16") ]:
metric_info["assert_%s" % what] = {