Module: check_mk
Branch: master
Commit: cff9d866636c5e555e10e137bec995796161797c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cff9d866636c5e…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Apr 8 12:20:55 2014 +0200
Linux multipath check can now use the alias instead of the UUID as item
If you have set useful aliasses for you Linux multipath devices then you can
now have Check_MK use these instead of the UUIDs for the service description.
This makes alerting, BI aggregates and other stuff easier. The configuration
is via a new rule set <i>Linux Multipath Inventory</i>. If you are now using
WATO then please refer to the check's man page for details.
---
.werks/757 | 12 ++++++++++++
ChangeLog | 1 +
checkman/multipath | 13 ++++++++++++-
checks/multipath | 18 ++++++++++++++++--
web/plugins/wato/check_parameters.py | 19 +++++++++++++++++++
5 files changed, 60 insertions(+), 3 deletions(-)
diff --git a/.werks/757 b/.werks/757
new file mode 100644
index 0000000..5bc19d1
--- /dev/null
+++ b/.werks/757
@@ -0,0 +1,12 @@
+Title: Linux multipath check can now use the alias instead of the UUID as item
+Level: 2
+Component: checks
+Version: 1.2.5i3
+Date: 1396952369
+Class: feature
+
+If you have set useful aliasses for you Linux multipath devices then you can
+now have Check_MK use these instead of the UUIDs for the service description.
+This makes alerting, BI aggregates and other stuff easier. The configuration
+is via a new rule set <i>Linux Multipath Inventory</i>. If you are now using
+WATO then please refer to the check's man page for details.
diff --git a/ChangeLog b/ChangeLog
index 05ade8e..91d1403 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,7 @@
NOTE: Please refer to the migration notes!
* 0802 ibm_svc_nodestats.iops, ibm_svc_systemstats.iops: new checks for IO
operations/sec on IBM SVC / V7000 devices
* 0602 cmciii.humidity: new check for Rittals CMC III humidity sensors
+ * 0757 Linux multipath check can now use the alias instead of the UUID as item...
* 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/multipath b/checkman/multipath
index 0543f80..7b4a13d 100644
--- a/checkman/multipath
+++ b/checkman/multipath
@@ -24,9 +24,20 @@ item:
alias as item.
inventory:
- One check for each multipath device is created.
+ One check for each multipath device is created. Via {iventory_multipath_rules}
+ you can specify wether an alias should be used as item instead of the UUID.
+
+examples:
+ # Use the alias as item if one is being set
+ inventory_multipath_rules = [
+ ( {'use_alias': True}, [], ALL_HOSTS ),
+ ]
+
[parameters]
numpaths(int): The only parameter is the number of expected paths. This is not
a tuple but a simple integer value.
+[configuration]
+inventory_multipath_rules(ruleset): A dictionary ruleset with currently the only
possible
+ key being {use_alias}. See section inventory for details.
diff --git a/checks/multipath b/checks/multipath
index 6457f69..5247647 100644
--- a/checks/multipath
+++ b/checks/multipath
@@ -24,6 +24,8 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+# Configuration for using alias instead of UUID
+inventory_multipath_rules = []
# Output from multipath -l has the following format:
@@ -252,11 +254,17 @@ def parse_multipath_output(info, only_uuid = None):
# Get list of UUIDs of all multipath devices
# Length of UUID is 360a9800043346937686f456f59386741
def inventory_multipath(info):
+ settings = host_extra_conf_merged(g_hostname, inventory_multipath_rules)
+
inventory = []
parsed = parse_multipath_output(info)
for uuid, info in parsed.items():
# take current number of paths as target value
- inventory.append( (uuid, " ".join(info['luns']),
info['numpaths']) )
+ if "alias" in info and settings.get("use_alias"):
+ item = info["alias"]
+ else:
+ item = uuid
+ inventory.append( (item, info['numpaths']) )
return inventory
# item is UUID (e.g. '360a9800043346937686f456f59386741') or alias (e.g.
'mpath0')
@@ -269,9 +277,15 @@ def check_multipath(item, target_numpaths, info):
return (3, "no map with uuid/alias %s" % item)
mmap = parsed.values()[0]
+ # If the item is the alias, then show the UUID in the plugin output.
+ # If the item is the UUID, then vice versa.
alias = mmap.get('alias')
- if alias:
+ uuid = mmap.get('uuid')
+
+ if item == uuid and alias:
aliasinfo = "(%s) " % alias
+ elif item == alias and uuid:
+ aliasinfo = "(%s) " % uuid
else:
aliasinfo = ""
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 2d2c845..3b6d28f 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -3437,6 +3437,25 @@ register_check_parameters(
"first"
)
+register_rule(
+ "checkparams/" + subgroup_storage,
+ varname = "inventory_multipath_rules",
+ title = _("Linux Multipath Inventory"),
+ valuespec = Dictionary(
+ elements = [
+ ("use_alias", Checkbox(
+ title = _("Use the multipath alias as service name, if one is
set"),
+ label = _("use alias"),
+ help = _("If a multipath device has an alias then you can
use that for specifying "
+ "the device instead of the UUID. The alias will
then be part of the service "
+ "description. The UUID will be output in the
pluging outpout."))
+ ),
+ ],
+ help = _('This rule controls the inventory of Multipath devices on
Linux.'),
+ ),
+ match = 'dict',
+)
+
register_check_parameters(
subgroup_storage,
"multipath_count",