Module: check_mk
Branch: master
Commit: e66849b8e906ad88d84a917220e1c3d0a24c6ec5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=e66849b8e906ad…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Dec 12 15:31:32 2014 +0100
#1755 FIX cisco_vpn_tunnel: fix exception in case tunnel is not OK
---
.werks/1755 | 10 ++++++++++
ChangeLog | 1 +
checks/cisco_vpn_tunnel | 23 +++++++++++++----------
web/plugins/wato/check_parameters.py | 2 +-
4 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/.werks/1755 b/.werks/1755
new file mode 100644
index 0000000..c2bca7c
--- /dev/null
+++ b/.werks/1755
@@ -0,0 +1,10 @@
+Title: cisco_vpn_tunnel: fix exception in case tunnel is not OK
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1418394229
+
+
diff --git a/ChangeLog b/ChangeLog
index 66d5929..cfb6439 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@
NOTE: Please refer to the migration notes!
* 1762 FIX: lnx_thermal: Now ignoring trip points with level 0...
* 1763 FIX: diskstat: Fixed error in config example of manpage
+ * 1755 FIX: cisco_vpn_tunnel: fix exception in case tunnel is not OK
Multisite:
* 1758 Improved exception hander: Shows details without additional debug request,
added mailto link for error report...
diff --git a/checks/cisco_vpn_tunnel b/checks/cisco_vpn_tunnel
index fb551b9..ce3e997 100644
--- a/checks/cisco_vpn_tunnel
+++ b/checks/cisco_vpn_tunnel
@@ -34,27 +34,30 @@
# this is the host name used to identify the
# remote peer."
+def inventory_cisco_vpn_tunnel(info):
+ return [(item[0], {}) for item in info]
+
+
def check_cisco_vpn_tunnel(item, params, info):
tunnel_not_found_state = params.get('state', 2) # default error state
# Try to find individual error states by tunnel IP/name
- tunnel_alias = ""
- for tunnel in params.get('tunnels', []):
- if item == tunnel[0]:
- if tunnel[1]:
- tunnel_alias = "[%s] " % tunnel[1]
- tunnel_not_found_state = tunnel[2]
+ alias = ""
+ for tunnel_ip, tunnel_alias, not_found_state in params.get('tunnels', []):
+ if item == tunnel_ip:
+ alias = "[%s] " % tunnel_alias
+ tunnel_not_found_state = not_found_state
if [item] not in info:
- return tunnel_not_found_state, "%sTunnel is missing" % tunnel_alias
+ return tunnel_not_found_state, "%sTunnel is missing" % alias
else:
- return state, "%sTunnel is OK" % tunnel_alias
+ return 0, "%sTunnel is OK" % alias
+
check_info["cisco_vpn_tunnel"] = {
"check_function" : check_cisco_vpn_tunnel,
- "inventory_function" : lambda info: [(item[0], {}) for item in info],
+ "inventory_function" : inventory_cisco_vpn_tunnel,
"service_description" : "VPN Tunnel %s",
- "has_perfdata" : False,
"group" : "vpn_tunnel",
"snmp_scan_function" : lambda oid:
oid(".1.3.6.1.2.1.1.1.0").lower().startswith("cisco adaptive
security") \
or "vpn 3000 concentrator" in
oid(".1.3.6.1.2.1.1.1.0").lower(),
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index ce93a8d..23585cd 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -1602,7 +1602,7 @@ register_check_parameters(
"device."),
allow_empty = False,
),
- TextAscii(
+ TextUnicode(
title = _("Tunnel Alias"),
help = _("You can configure an individual alias here for
the tunnel matching "
"the IP-Address or Name configured in the field
above."),