Module: check_mk
Branch: master
Commit: b96005263dddc1e5ab488aa7883c8c837bde9ce7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b96005263dddc1…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Oct 11 12:41:56 2018 +0200
6801 fortigate_ipsecvpn: Tunnels which are down or ignored are listed in the long output
Change-Id: I184807c7e3fa9444747e8408829e4ef6fa6ac133
---
.werks/6801 | 10 ++++++++++
checks/fortigate_ipsecvpn | 23 ++++++++++++++---------
2 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/.werks/6801 b/.werks/6801
new file mode 100644
index 0000000..1b7a766
--- /dev/null
+++ b/.werks/6801
@@ -0,0 +1,10 @@
+Title: fortigate_ipsecvpn: Tunnels which are down or ignored are listed in the long
output
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1539254475
+Class: feature
+
+
diff --git a/checks/fortigate_ipsecvpn b/checks/fortigate_ipsecvpn
index cd892df..2be2bee 100644
--- a/checks/fortigate_ipsecvpn
+++ b/checks/fortigate_ipsecvpn
@@ -56,14 +56,8 @@ def check_fortigate_ipsecvpn(item, params, info):
num_ignored = len(tunnels_ignored)
num_down_and_not_ignored = num_down - num_ignored
- infotext = "Total: %d, Up: %d, Down: %d" % \
- (num_total, num_up, num_down)
-
- if tunnels_down:
- infotext += " (%s)" % ", ".join(tunnels_down)
-
- if num_ignored:
- infotext += ", Ignored: %d (%s)" % (num_ignored, ",
".join(tunnels_ignored))
+ infotext = "Total: %d, Up: %d, Down: %d, Ignored: %s"\
+ % (num_total, num_up, num_down, num_ignored)
warn, crit = params.get("levels", (None, None))
status = 0
@@ -74,7 +68,18 @@ def check_fortigate_ipsecvpn(item, params, info):
if status:
infotext += " (warn/crit at %s/%s)" % (warn, crit)
- return status, infotext, [('active_vpn_tunnels', num_up, '',
'', 0, num_total)]
+ yield status, infotext, [('active_vpn_tunnels', num_up, '',
'', 0, num_total)]
+
+ long_output = []
+ for title, tunnels in [
+ ("Down", tunnels_down),
+ ("Ignored", tunnels_ignored),
+ ]:
+ if tunnels:
+ long_output.append("%s:" % title)
+ long_output.append(", ".join(tunnels))
+ if long_output:
+ yield 0, "\n%s" % "\n".join(long_output)
check_info["fortigate_ipsecvpn"] = {