Module: check_mk
Branch: master
Commit: 74733a4aa927ceb1f4263c8b2192df71e4a9c883
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=74733a4aa927ce…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Thu Jan 23 13:49:52 2014 +0100
mikrotik_signal: Check for mikrotik wifi bridges
---
.werks/126 | 8 +++++
ChangeLog | 3 +-
checkman/mikrotik_signal | 17 +++++++++
checks/mikrotik_signal | 63 ++++++++++++++++++++++++++++++++++
web/plugins/wato/check_parameters.py | 14 ++++++++
5 files changed, 104 insertions(+), 1 deletion(-)
diff --git a/.werks/126 b/.werks/126
new file mode 100644
index 0000000..d976105
--- /dev/null
+++ b/.werks/126
@@ -0,0 +1,8 @@
+Title: mikrotik_signal: Check for mikrotik wifi bridges
+Level: 1
+Component: checks
+Version: 1.2.5i1
+Date: 1390481352
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index e5c4651..0a38083 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -60,7 +60,8 @@
* 0463 emcvnx_raidgroups.capacity, emcvnx_raidgroups.capacity_contiguous: New Checks
for EMC VNX Storage systems...
* 0570 fileinfo.groups: file groups now allow exclude patterns as well
* 0464 stulz_pump: new check for the status of pumps of Stulz clima units
- * 0125 Unitrends Backup...
+ * 0125 unitrends_backup:Unitrends Backup...
+ * 0126 mikrotik_signal: Check for mikrotik wifi bridges
* 0103 FIX: services: Fixed bug with service inventory defined in main.mk...
* 0299 FIX: borcade_mlx_fan: Prettified output, handling "other" state now
* 0300 FIX: cisco_fru_power: Trying not to inventorize not plugged in FRUs...
diff --git a/checkman/mikrotik_signal b/checkman/mikrotik_signal
new file mode 100644
index 0000000..4ccac37
--- /dev/null
+++ b/checkman/mikrotik_signal
@@ -0,0 +1,17 @@
+title: Check Mikrotik Wlan Bridge Signal Strenght`
+agents: linux
+catalog: hw/network/mikrotik
+license: GPL
+distribution: check_mk
+description:
+ This check is for Mikrotik wlan devices who e.g. used to
+ etablish a wireless network connection between two buildings.
+ It reads the current singnal strenght in decibel and calculates
+ the quality in a scale up to 100. 100 means optimal signal quality.
+
+
+inventory:
+ One service for each network will be created.
+
+[parameters]
+ Tuple, levels for warn/ crit
diff --git a/checks/mikrotik_signal b/checks/mikrotik_signal
new file mode 100644
index 0000000..8890634
--- /dev/null
+++ b/checks/mikrotik_signal
@@ -0,0 +1,63 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 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-
+# ails. 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.
+mikrotik_signal_default_levels = ( 80, 70 )
+
+def inventory_mikrotik_signal(info):
+ inventory = []
+ for network, strenght, mode in info:
+ inventory.append((network, "mikrotik_signal_default_levels"))
+ return inventory
+
+def check_mikrotik_signal(item, params, info):
+ warn, crit = params
+ for network, strenght, mode in info:
+ if network == item:
+ strenght = saveint(strenght)
+ quality = "0"
+ if strenght <= -50 or strenght >= -100:
+ quality = 2 * ( strenght + 100 )
+ if quality > 100:
+ quality = 100
+
+ infotext = "Signal quality %d%% (%ddBm). Mode is: %s" % ( quality,
strenght, mode )
+ perf = [ ("quality", quality, warn, crit) ]
+ if quality <= crit:
+ return 2, infotext, perf
+ if quality <= warn:
+ return 1, infotext, perf
+ return 0, infotext, perf
+
+ return 3, "Network not found"
+
+check_info["mikrotik_signal"] = {
+ "group" : "signal_quality",
+ "check_function" : check_mikrotik_signal,
+ "inventory_function" : inventory_mikrotik_signal,
+ "service_description" : "Signal %s",
+ "has_perfdata" : True,
+ "snmp_info" : ( ".1.3.6.1.4.1.14988.1.1.1.1.1", [
"5.2", "4.2", "8.2" ] ),
+ "snmp_scan_function" : lambda oid: ".1.3.6.1.4.1.14988.1" in
oid(".1.3.6.1.2.1.1.2.0")
+}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 5ee83ba..75f496c 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -1873,6 +1873,20 @@ register_check_parameters(
allow_empty = False),
"dict",
)
+register_check_parameters(
+ subgroup_networking,
+ "signal_quality",
+ _("Signal quality of Wireless device"),
+ Tuple(
+ elements=[
+ Percentage( title = _( "Warning if under"), maxvalue=100 ),
+ Percentage( title = _( "Critical if under"), maxvalue=100 ),
+ ]),
+ TextAscii(
+ title = _("Network specification"),
+ allow_empty = True),
+ "first",
+)
register_check_parameters(
subgroup_networking,