Module: check_mk
Branch: master
Commit: c9c6ea730ec8330e10da3fdbb837cb7d7bbdbdcb
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c9c6ea730ec833…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Apr 30 13:47:08 2014 +0200
esx_vsphere_hostsystem.multipath: now able to configure paths minimum count
You can now configure the minimum levels for the active, dead, disabled, standby and
unknown paths via WATO.
---
.werks/911 | 9 ++++++++
ChangeLog | 1 +
checkman/esx_vsphere_hostsystem.multipath | 5 ++---
checks/esx_vsphere_hostsystem | 26 ++++++++++++++++-----
web/plugins/wato/check_parameters.py | 35 ++++++++++++++++-------------
5 files changed, 52 insertions(+), 24 deletions(-)
diff --git a/.werks/911 b/.werks/911
new file mode 100644
index 0000000..6adcbe4
--- /dev/null
+++ b/.werks/911
@@ -0,0 +1,9 @@
+Title: esx_vsphere_hostsystem.multipath: now able to configure paths minimum count
+Level: 1
+Component: checks
+Version: 1.2.5i3
+Date: 1398858257
+Class: feature
+
+You can now configure the minimum levels for the active, dead, disabled, standby and
+unknown paths via WATO.
diff --git a/ChangeLog b/ChangeLog
index e0393e1..7c4d359 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -39,6 +39,7 @@
* 0898 ibm_svc_nodestats.disk_latency, ibm_svc_systemstats.disk_latency: New Checks
for Disk Latency in IBM SVC / Storwize V3700 / V7000 devices
* 0156 akcp_daisy_temp: New Check for akcp daisyTemp sensor chains...
* 0899 enterasys_temp: New Check for temperature sensor in Enterasys Switches
+ * 0911 esx_vsphere_hostsystem.multipath: now able to configure paths minimum
count...
* 0777 FIX: special agent emcvnx: did not work with security file authentication...
* 0786 FIX: zfsget: fixed compatibility with older Solaris agents...
* 0809 FIX: brocade_fcport: Fixed recently introduced problem with port speed
detection
diff --git a/checkman/esx_vsphere_hostsystem.multipath
b/checkman/esx_vsphere_hostsystem.multipath
index b3aa1e2..08b5c74 100644
--- a/checkman/esx_vsphere_hostsystem.multipath
+++ b/checkman/esx_vsphere_hostsystem.multipath
@@ -22,6 +22,5 @@ item:
The unique id of the path
[parameters]
-parameters (dict): Each key represents a path state. It's values
- are the warn / crit levels and of type (int,int). Available key types
- are {active}, {dead}, {disabled}, {standby}, {unknown}
+parameters (dict): Each key represents a path state. The value is a int tuple
+ with (crit_min, warn_min, warn_max, crit_max). Available key types are {active}, {dead},
{disabled}, {standby}, {unknown}
diff --git a/checks/esx_vsphere_hostsystem b/checks/esx_vsphere_hostsystem
index 343d213..09c6160 100644
--- a/checks/esx_vsphere_hostsystem
+++ b/checks/esx_vsphere_hostsystem
@@ -260,14 +260,28 @@ def check_esx_vsphere_hostsystem_multipath(item, params, info):
state = 0
for state_name, state_values in state_infos.items():
if params.get(state_name):
- warn, crit = params.get(state_name)
+ limits = params.get(state_name)
+ if len(limits) == 2:
+ warn_max, crit_max = limits
+ crit_min, warn_min = 0, 0
+ else:
+ crit_min, warn_min, warn_max, crit_max = limits
+
+ extra_info = ""
count = state_values[1]
- if count > crit:
- state = 2
- state_values[2] = "(!!)"
- elif count > warn:
+ if count < crit_min:
+ state = max(state, 2)
+ state_values[2] = "(!!)(less than %d)" % crit_min
+ elif count > crit_max:
+ state = max(state, 2)
+ state_values[2] = "(!!)(more than %d)" % crit_max
+ elif count < warn_min:
state = max(state, 1)
- state_values[2] = "(!)"
+ state_values[2] = "(!)(less than %d)" % warn_min
+ elif count > warn_max:
+ state = max(state, 1)
+ state_values[2] = "(!)(more than %d)" % warn_max
+
# Output message
message = "Type %s" % path_type
for element in "active", "dead", "disabled",
"standby", "unknown":
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 7be3629..7f31150 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -3454,21 +3454,26 @@ register_check_parameters(
Dictionary(
title = _("Custom settings"),
elements = [ (element,
- Tuple(
- title = description,
- elements = [
- Integer(title = _("Warning if more
than")),
- Integer(title = _("Critical if more
than")),
- ]
- )
- ) for (element, description) in [
- ("active", _("Active
paths")),
- ("dead", _("Dead
paths")),
- ("disabled", _("Disabled
paths")),
- ("standby", _("Standby
paths")),
- ("unknown", _("Unknown
paths"))
- ]
- ]
+ Transform(
+ Tuple(
+ title = description,
+ elements = [
+ Integer(title = _("Critical if
less than")),
+ Integer(title = _("Warning if
less than")),
+ Integer(title = _("Warning if
more than")),
+ Integer(title = _("Critical if
more than")),
+ ]
+ ),
+ forth = lambda x: len(x) == 2 and (0, 0,
x[0], x[1]) or x
+ )
+ ) for (element, description) in [
+ ("active", _("Active
paths")),
+ ("dead", _("Dead
paths")),
+ ("disabled", _("Disabled
paths")),
+ ("standby", _("Standby
paths")),
+ ("unknown", _("Unknown
paths"))
+ ]
+ ]
),
]
),