Module: check_mk
Branch: master
Commit: d8f0fa7de0ae4667b17b9cdd3739e5628bf5e1a3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d8f0fa7de0ae46…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Wed Jan 21 15:54:11 2015 +0100
#1856 FIX ibm_svc_array ibm_svc_mdisk ibm_svc_mdiskgrp ibm_svc_portfc: made checks more
robust for varying number of parameters of IBM SVC agent plugin
The number of parameters returned by the IBM SVC agent plugin depends on the IBM SVC's
version. This change makes the corresponding checks
handle IBM SVC versions up to at least V7.4
---
.werks/1856 | 12 ++++++++++++
ChangeLog | 1 +
checks/ibm_svc_array | 24 ++++++++++--------------
checks/ibm_svc_mdisk | 24 ++++++++++--------------
checks/ibm_svc_mdiskgrp | 43 +++++++++++++++++++------------------------
checks/ibm_svc_portfc | 21 +++++++++------------
6 files changed, 61 insertions(+), 64 deletions(-)
diff --git a/.werks/1856 b/.werks/1856
new file mode 100644
index 0000000..0e4b9bf
--- /dev/null
+++ b/.werks/1856
@@ -0,0 +1,12 @@
+Title: ibm_svc_array ibm_svc_mdisk ibm_svc_mdiskgrp ibm_svc_portfc: made checks more
robust for varying number of parameters of IBM SVC agent plugin
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1421851629
+
+The number of parameters returned by the IBM SVC agent plugin depends on the IBM
SVC's version. This change makes the corresponding checks
+handle IBM SVC versions up to at least V7.4
+
diff --git a/ChangeLog b/ChangeLog
index 58b428d..68faea4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -97,6 +97,7 @@
* 1853 FIX: cisco_power, cisco_fan, cisco_temp_perf: fixed service description for
some special cases...
NOTE: Please refer to the migration notes!
* 1671 FIX: windows agent: fixed gaps in eventlog monitoring after agent restart...
+ * 1856 FIX: ibm_svc_array ibm_svc_mdisk ibm_svc_mdiskgrp ibm_svc_portfc: made checks
more robust for varying number of parameters of IBM SVC agent plugin...
Multisite:
* 1758 Improved exception hander: Shows details without additional debug request,
added mailto link for error report...
diff --git a/checks/ibm_svc_array b/checks/ibm_svc_array
index 9f9f280..cc247b6 100644
--- a/checks/ibm_svc_array
+++ b/checks/ibm_svc_array
@@ -33,23 +33,22 @@
def inventory_ibm_svc_array(info):
- inventory = []
- for mdisk_id, mdisk_name, mdisk_status, mdisk_grp_id, mdisk_grp_name, capacity, \
- raid_status, raid_level, redundancy, strip_size, tier in info:
- inventory.append( (mdisk_id, None) )
- return inventory
+ for line in info:
+ if len(line) in (11, 12):
+ yield line[0], None
def check_ibm_svc_array(item, _no_params, info):
- status = 3
- for mdisk_id, mdisk_name, mdisk_status, mdisk_grp_id, mdisk_grp_name, capacity, \
- raid_status, raid_level, redundancy, strip_size, tier in info:
- if mdisk_id == item:
+ for line in info:
+ if len(line) in (11, 12) and line[0] == item:
+ raid_status = line[6]
+ raid_level = line[7]
+ tier = line[10]
# Check raid_status
- message = "RAID Array %s reports status %s" % (item, raid_status)
+ message = "Status: %s" % raid_status
if raid_status == "online":
status = 0
- elif raid_status == "offline" or raid_status ==
"degraded":
+ elif raid_status in ("offline", "degraded"):
status = 2
message += "(!!)"
else:
@@ -60,12 +59,9 @@ def check_ibm_svc_array(item, _no_params, info):
message += ", RAID Level: %s, Tier: %s" % (raid_level, tier)
return status, message
- return 3, "RAID Array %s not found in agent output" % item
check_info["ibm_svc_array"] = {
"check_function" : check_ibm_svc_array,
"inventory_function" : inventory_ibm_svc_array,
"service_description" : "RAID Array %s",
- "has_perfdata" : False,
}
-
diff --git a/checks/ibm_svc_mdisk b/checks/ibm_svc_mdisk
index f1adb0a..10a9419 100644
--- a/checks/ibm_svc_mdisk
+++ b/checks/ibm_svc_mdisk
@@ -39,40 +39,36 @@
def inventory_ibm_svc_mdisk(info):
- inventory = []
- for mdisk_id, mdisk_name, mdisk_status, mdisk_mode, mdisk_grp_id, mdisk_grp_name,
capacity, ctrl_lun_number, controller_name, mdisk_uid, tier in info:
- inventory.append( (mdisk_name, None) )
- return inventory
+ for line in info:
+ if len(line) in (11, 12):
+ yield line[1], None
def check_ibm_svc_mdisk(item, _no_params, info):
- status = 3
- for mdisk_id, mdisk_name, mdisk_status, mdisk_mode, mdisk_grp_id, mdisk_grp_name,
capacity, ctrl_lun_number, controller_name, mdisk_uid, tier in info:
- if mdisk_name == item:
+ for line in info:
+ if len(line) in (11, 12) and line[1] == item:
+ mdisk_status = line[2]
+ mdisk_mode = line[3]
- # Check mdisk_status
- message = "%s reports status %s" % (item, mdisk_status)
+ message = "Status: %s" % mdisk_status
if mdisk_status == "online":
status = 0
- elif mdisk_status == "offline" or mdisk_status ==
"excluded":
+ elif mdisk_status in ("offline", "excluded"):
status = 2
message += "(!!)"
else:
status = 1
message += "(!)"
- # check mdisk_mode
- message += ", Mode %s" % mdisk_mode
+ message += ", Mode: %s" % mdisk_mode
if mdisk_mode not in ( "managed", "array" ):
status = max(status, 1)
message += "(!)"
return status, message
- return 3, "MDisk %s not found in agent output" % item
check_info["ibm_svc_mdisk"] = {
"check_function" : check_ibm_svc_mdisk,
"inventory_function" : inventory_ibm_svc_mdisk,
"service_description" : "MDisk %s",
- "has_perfdata" : False,
}
diff --git a/checks/ibm_svc_mdiskgrp b/checks/ibm_svc_mdiskgrp
index 67c8c30..828f4ae 100644
--- a/checks/ibm_svc_mdiskgrp
+++ b/checks/ibm_svc_mdiskgrp
@@ -56,33 +56,28 @@ def ibm_svc_mdiskgrp_to_mb(size):
return size
def inventory_ibm_svc_mdiskgrp(info):
- inventory = []
- for mgrp_id, mgrp_name, mgrp_status, mdisk_count, vdisk_count, capacity, \
- extent_size, free_capacity, virtual_capacity, used_capacity, \
- real_capacity, overallocation, mgrp_warning, easy_tier, easy_tier_status, \
- compression_active, compression_virtual_capacity,
compression_compressed_capacity, \
- compression_uncompressed_capacity in info:
- inventory.append( (mgrp_name, {}) )
- return inventory
+ for line in info:
+ if len(line) in (15, 19, 24):
+ yield line[1], {}
def check_ibm_svc_mdiskgrp(item, params, info):
- for mgrp_id, mgrp_name, mgrp_status, mdisk_count, vdisk_count, capacity, \
- extent_size, free_capacity, virtual_capacity, used_capacity, \
- real_capacity, overallocation, mgrp_warning, easy_tier, easy_tier_status, \
- compression_active, compression_virtual_capacity,
compression_compressed_capacity, \
- compression_uncompressed_capacity in info:
- if mgrp_name == item:
- if mgrp_status != "online":
- return 2, "MDiskGrp %s reports status %s" % (item,
mgrp_status)
- fslist = []
- size_mb = ibm_svc_mdiskgrp_to_mb(capacity)
- avail_mb = ibm_svc_mdiskgrp_to_mb(free_capacity)
- fslist.append((item, size_mb, avail_mb))
- status, message, perfdata = df_check_filesystem_list(item, params,
fslist)
- message += ", MDiskGrp %s reports status %s" % (item,
mgrp_status)
- return status, message, perfdata
+ for line in info:
+ if len(line) in (15, 19, 24) and item == line[1]:
+ mgrp_status = line[2]
- return 3, "MDiskGrp %s not found in agent output" % item
+ if mgrp_status != "online":
+ return 2, "Status: %s" % mgrp_status
+
+ fslist = []
+ capacity = line[5]
+ free_capacity = line[7]
+ size_mb = ibm_svc_mdiskgrp_to_mb(capacity)
+ avail_mb = ibm_svc_mdiskgrp_to_mb(free_capacity)
+ fslist.append((item, size_mb, avail_mb))
+ status, message, perfdata = df_check_filesystem_list(item, params, fslist)
+ message += ", Status: %s" % mgrp_status
+
+ return status, message, perfdata
check_info["ibm_svc_mdiskgrp"] = {
diff --git a/checks/ibm_svc_portfc b/checks/ibm_svc_portfc
index b2d171c..bcae05f 100644
--- a/checks/ibm_svc_portfc
+++ b/checks/ibm_svc_portfc
@@ -52,29 +52,26 @@
def inventory_ibm_svc_portfc(info):
- inventory = []
for line in info:
- if len(line) in (11, 12) and line[9] == "active":
- inventory.append( (line[0], None) )
- return inventory
+ if len(line) in (11, 12, 14) and line[9] == "active":
+ yield line[0], None
def check_ibm_svc_portfc(item, _no_params, info):
for line in info:
- if len(line) in (11, 12):
- fc_port_id = line[0]
- fc_port_status = line[9]
- if fc_port_id == item:
+ if len(line) in (11, 12, 14):
+ if line[0] == item:
+ fc_port_status = line[9]
+
if fc_port_status == "active":
- return 0, "FC Port %s is %s" % (fc_port_id,
fc_port_status)
+ state = 0
else:
- return 2, "FC Port %s is %s" % (fc_port_id,
fc_port_status)
+ state = 2
- return 3, "FC Port %s not found in agent output" % item
+ return state, fc_port_status
check_info["ibm_svc_portfc"] = {
"check_function" : check_ibm_svc_portfc,
"inventory_function" : inventory_ibm_svc_portfc,
"service_description" : "FC Port %s",
- "has_perfdata" : False,
}