Module: check_mk
Branch: master
Commit: ebe4c0f3033f54b7ffa4309a3ea95f3478bc5c60
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ebe4c0f3033f54…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Thu Feb 22 12:41:54 2018 +0100
5767 f5_bigip_vserver: Status of VServer is configurable
Change-Id: I9306cbb7434258839610f3ad1a52f391009ff8f5
---
.werks/5767 | 10 ++++++++++
checkman/f5_bigip_vserver | 6 ++++++
checks/f5_bigip_vserver | 12 +++++++-----
web/plugins/wato/check_parameters.py | 26 +++++++++++++++++++++++---
4 files changed, 46 insertions(+), 8 deletions(-)
diff --git a/.werks/5767 b/.werks/5767
new file mode 100644
index 0000000..392ea39
--- /dev/null
+++ b/.werks/5767
@@ -0,0 +1,10 @@
+Title: f5_bigip_vserver: Status of VServer is configurable
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i4
+Date: 1519299680
+Class: feature
+
+
diff --git a/checkman/f5_bigip_vserver b/checkman/f5_bigip_vserver
index befc11a..94f201a 100644
--- a/checkman/f5_bigip_vserver
+++ b/checkman/f5_bigip_vserver
@@ -12,6 +12,12 @@ description:
There is one special handling in the check. If the vserver is not available
and all its children pool members are down the check reports {OK}.
+ All states are configurable. Default values are
+ OK (is up and available, the children pool member(s) are down if VServer is not
available),
+ WARN (is disabled, availability unknown),
+ CRIT (is currently not available, is not available),
+ UNKNOWN (is unlicensed).
+
inventory:
Any virtual server that is found online will be added during inventory
and checked for it's status. Virtual servers in the various "Warning"
diff --git a/checks/f5_bigip_vserver b/checks/f5_bigip_vserver
index 47eaf42..0f1120c 100644
--- a/checks/f5_bigip_vserver
+++ b/checks/f5_bigip_vserver
@@ -122,8 +122,9 @@ def check_f5_bigip_vserver(item, params, parsed):
4: (1, "availability is unknown"),
5: (3, "is unlicensed")
}
- state, status = map_server_status.get(vserver["status"][0],\
- (3, "Unhandled status (%d)" %
vserver["status"][0]))
+ state, state_readable = map_server_status.get(vserver["status"][0],
+ (3, "Unhandled status (%d)" %
vserver["status"][0]))
+ state = params.get('state', {}).get(state_readable.replace(' ',
'_'), state)
# vserver["enabled"]
# 0 - none
@@ -133,17 +134,16 @@ def check_f5_bigip_vserver(item, params, parsed):
enabled = ["NONE", "enabled", "disabled",
"disabled by parent"][vserver["enabled"][0]]
output = "Virtual Server with IP %s is %s, State %s, Detail: %s" %
(vserver["ip"][0],\
- enabled, status, vserver["detail"][0])
+ enabled, state_readable, vserver["detail"][0])
# Special handling
if vserver["status"][0] == 3: # not available
# Statement from the network team, it's uncritical when the childrens are
down
if vserver["detail"][0].lower() == "The children pool
member(s) are down".lower():
- state = 0
+ state = params.get('state',
{}).get("children_pool_members_down_if_not_available", 0)
yield state, output
-
# Check configured limits
map_paramvar_to_text = {
"if_in_octets": "Incoming Bytes",
@@ -156,6 +156,8 @@ def check_f5_bigip_vserver(item, params, parsed):
summed_values["if_total_octets"] =
summed_values["if_in_octets"] + summed_values["if_out_octets"]
summed_values["if_total_pkts"] =
summed_values["if_in_pkts"] + summed_values["if_out_pkts"]
for param_var, levels in params.items():
+ if param_var == "state":
+ continue
if param_var.endswith("_lower") and type(levels) == tuple:
levels = (None, None) + levels
value = summed_values[param_var.rstrip("_lower")]
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index b87bc93..2ef3561 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -496,9 +496,29 @@ register_check_parameters(
default_difference = (5, 8),
default_value = None,
),
- )
- ]
- ),
+ ),
+ ("state", Dictionary(
+ title=_("Map states"),
+ elements=[
+ ("is_disabled",
+ MonitoringState(title=_("Is disabled"),
default_value=1)),
+ ("is_up_and_available",
+ MonitoringState(title=_("Is up and available"),
default_value=0)),
+ ("is_currently_not_available",
+ MonitoringState(title=_("Is currently not available"),
default_value=2)),
+ ("is_not_available",
+ MonitoringState(title=_("Is not available"),
default_value=2)),
+ ("availability_is_unknown",
+ MonitoringState(title=_("Availability is unknown"),
default_value=1)),
+ ("is_unlicensed",
+ MonitoringState(title=_("Is unlicensed"),
default_value=3)),
+ ("children_pool_members_down_if_not_available",
+ # Special handling, see check plugin
+ MonitoringState(title=_("The children pool member(s) are
down if VServer is not available"), default_value=0)),
+ ],
+ optional_keys=False,
+ )),
+ ]),
TextAscii(
title = _("VServer name"),
allow_empty = False