Module: check_mk
Branch: master
Commit: a39873faab193095a27297cb0f370bbd8d699654
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a39873faab1930…
Author: Konstantin Büttner <kb(a)mathias-kettner.de>
Date: Wed Mar 22 13:42:54 2017 +0100
8625 fortigate_ipsecvpn: Now configurable via WATO
Change-Id: I67a04067fe40cae217b859ccf5b408257250bc2f
---
.werks/8625 | 11 +++++++++++
checks/fortigate_ipsecvpn | 22 ++++++++++++++--------
web/plugins/wato/check_parameters.py | 22 ++++++++++++++++++++++
3 files changed, 47 insertions(+), 8 deletions(-)
diff --git a/.werks/8625 b/.werks/8625
new file mode 100644
index 0000000..8a075e2
--- /dev/null
+++ b/.werks/8625
@@ -0,0 +1,11 @@
+Title: fortigate_ipsecvpn: Now configurable via WATO
+Level: 1
+Component: checks
+Class: feature
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1490186539
+
+
diff --git a/checks/fortigate_ipsecvpn b/checks/fortigate_ipsecvpn
index 81baaf8..7019ffa 100644
--- a/checks/fortigate_ipsecvpn
+++ b/checks/fortigate_ipsecvpn
@@ -30,16 +30,20 @@ fortigate_ipsecvpn_default_levels = (1, 2)
def inventory_fortigate_ipsecvpn(info):
if len(info) > 0:
- return [(None, "fortigate_ipsecvpn_default_levels")]
+ return [(None, {})]
def check_fortigate_ipsecvpn(item, params, info):
+
+ if type(params) == tuple:
+ params = { "levels" : params }
+
ent_status_map = {
"1": "down",
"2": "up"
}
- warn, crit = params
+ warn, crit = params["levels"]
tunnels_down = [p2name for p2name, ent_status in info
if ent_status_map[ent_status] == "down"]
@@ -63,12 +67,14 @@ def check_fortigate_ipsecvpn(item, params, info):
check_info["fortigate_ipsecvpn"] = {
- "inventory_function" : inventory_fortigate_ipsecvpn,
- "check_function" : check_fortigate_ipsecvpn,
- "service_description" : "VPN IPSec Tunnels",
- "has_perfdata" : True,
- "snmp_scan_function" : lambda oid: ".1.3.6.1.4.1.12356.101.1" in
oid(".1.3.6.1.2.1.1.2.0"),
- "snmp_info" : (".1.3.6.1.4.1.12356.101.12.2.2.1", [3,
# fgVpnTunEntPhase2Name
+ "default_levels_variable" : "fortigate_ipsecvpn",
+ "inventory_function" : inventory_fortigate_ipsecvpn,
+ "check_function" : check_fortigate_ipsecvpn,
+ "service_description" : "VPN IPSec Tunnels",
+ "has_perfdata" : True,
+ "snmp_scan_function" : lambda oid:
".1.3.6.1.4.1.12356.101.1" in oid(".1.3.6.1.2.1.1.2.0"),
+ "snmp_info" : (".1.3.6.1.4.1.12356.101.12.2.2.1",
[3, # fgVpnTunEntPhase2Name
20]), #
fgVpnTunEntStatus
+ "group" : "ipsecvpn",
}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index a3192fa..40c4f59 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -623,6 +623,28 @@ register_check_parameters(
"dict",
)
+register_check_parameters(
+ subgroup_networking,
+ "ipsecvpn",
+ _(u"Fortigate IPSec VPN Tunnels"),
+ Transform(
+ Dictionary(
+ elements=[
+ ("levels", Tuple(
+ title=_("Levels for number of down channels"),
+ elements=[
+ Integer(title=_("Warning at"), default_value=1),
+ Integer(title=_("Critical at"), default_value=2),
+ ])),
+ ],
+ optional_keys = []
+ ),
+ forth=lambda params: type(params) == dict and params or { "levels" :
params },
+ ),
+ None,
+ "dict",
+)
+
#.
# .--Inventory-----------------------------------------------------------.