Module: check_mk
Branch: master
Commit: 86e809f634796852f669f49ca132dbc289f8141d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=86e809f6347968…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Dec 4 18:42:00 2014 +0100
#1656 FIX cisco_vpn_tunnel: Refactored complete check, fixed threshold bugs
Improved check in different ways:
- When configuring OK as failed tunnel state, this was not handled correctly by the
check.
- Clarified the valuespec titles and help texts.
- Check did not process multiple VPN tunnel configurations defined in a single rule.
- Cleaned up check code
Sadly had no data for testing here... Let's hope for the best.
---
.werks/1656 | 16 ++++++++++++++++
ChangeLog | 1 +
checks/cisco_vpn_tunnel | 31 +++++++++++--------------------
web/plugins/wato/check_parameters.py | 24 ++++++++++++++----------
4 files changed, 42 insertions(+), 30 deletions(-)
diff --git a/.werks/1656 b/.werks/1656
new file mode 100644
index 0000000..09422b3
--- /dev/null
+++ b/.werks/1656
@@ -0,0 +1,16 @@
+Title: cisco_vpn_tunnel: Refactored complete check, fixed threshold bugs
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i7
+Date: 1417714529
+Class: fix
+
+Improved check in different ways:
+
+- When configuring OK as failed tunnel state, this was not handled correctly by the
check.
+- Clarified the valuespec titles and help texts.
+- Check did not process multiple VPN tunnel configurations defined in a single rule.
+- Cleaned up check code
+
+Sadly had no data for testing here... Let's hope for the best.
diff --git a/ChangeLog b/ChangeLog
index 6f34768..d323b6f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -108,6 +108,7 @@
* 1653 FIX: megaraid_pdisks: Resulting states are now hard coded within the check...
* 1654 FIX: statgrab_disk: Fixed scaling of values shown in PNP graphs...
* 1655 FIX: AIX Agent: Fixed broken filesystem checks when having PowerHA
installed...
+ * 1656 FIX: cisco_vpn_tunnel: Refactored complete check, fixed threshold bugs...
Multisite:
* 1508 Allow input of plugin output and perfdata when faking check results...
diff --git a/checks/cisco_vpn_tunnel b/checks/cisco_vpn_tunnel
index ebc1fed..3b2e573 100644
--- a/checks/cisco_vpn_tunnel
+++ b/checks/cisco_vpn_tunnel
@@ -35,28 +35,20 @@
# remote peer."
def check_cisco_vpn_tunnel(item, params, info):
- if not info:
- return 3, "SNMP Data for VPN Tunnel Missing"
+ tunnel_not_found_state = params.get('state', 2) # default error state
- tunnels = params.get('tunnels',[])
- tunnel_alias = ""
- if not params.get('state'):
- tunnel_worst_state = 2
- else:
- tunnel_worst_state = params.get('state')
- if item in [tunnel[0] for tunnel in tunnels]:
- if tunnel[1]:
- tunnel_alias = " (%s)" % tunnel[1]
- tunnel_worst_state = tunnel[2]
+ # 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]
- extra_info = ""
- state = 0
if [item] not in info:
- extra_info = " - Tunnel is missing"
- state = tunnel_worst_state
-
- result = "%s%s%s" % (item, tunnel_alias, extra_info)
- return state, result
+ return tunnel_not_found_state, "%sTunnel is missing" % tunnel_alias
+ else:
+ return state, "%sTunnel is OK" % tunnel_alias
check_info["cisco_vpn_tunnel"] = {
"check_function" : check_cisco_vpn_tunnel,
@@ -67,4 +59,3 @@ check_info["cisco_vpn_tunnel"] = {
"snmp_scan_function" : lambda oid:
oid(".1.3.6.1.2.1.1.1.0").lower().startswith("cisco adaptive
security"),
"snmp_info" : ( ".1.3.6.1.4.1.9.9.171.1.2.3.1", [ 7 ]
),
}
-
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index c357cb9..860c29a 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -1596,25 +1596,29 @@ register_check_parameters(
title = ("VPN Tunnel Endpoints"),
elements = [
IPv4Address(
- title = _("IP-Address of Tunnel Endpoint"),
+ title = _("IP-Address or Name of Tunnel Endpoint"),
+ help = _("The configured value must match a tunnel
reported by the monitored "
+ "device."),
allow_empty = False,
- ),
+ ),
TextAscii(
- title = _("Name of Tunnel"),
- ),
+ 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."),
+ ),
MonitoringState(
default_value = 2,
- title = _("State if this tunnel is not found"),
+ title = _("State if tunnel is not found"),
)]),
- add_label = _("Add another Tunnel"),
+ add_label = _("Add tunnel"),
movable = False,
- title = _("VPN Tunnel"),
+ title = _("VPN tunnel specific configuration"),
)),
( "state",
MonitoringState(
- title = _("Default state if inventorized, unregistered tunnel is
not found"),
- help = _("Default state if a tunnel, which was inventorized but is
not listed in this rule, "
- "is not longer present in the snmp data"),
+ title = _("Default state to report when tunnel can not be found
anymore"),
+ help = _("Default state if a tunnel, which is not listed above in
this rule, "
+ "can no longer be found."),
),
),
],