Module: check_mk
Branch: master
Commit: 5bbd6cf17e20cf2a96f875544cf8c849434d19a2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5bbd6cf17e20cf…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Dec 15 16:17:54 2015 +0100
#2813 FIX agent_netapp: fixed missing environmental sensor information and exception with
snapshot volumes
The agent now queries all nodes for environment sensors information.
Previously only the first node was queried.
The agent no longer crashes when it hits a volume void of any snapshots.
---
.werks/2813 | 12 ++++++++++
ChangeLog | 1 +
agents/special/agent_netapp | 53 +++++++++++++++++++++++++++----------------
3 files changed, 46 insertions(+), 20 deletions(-)
diff --git a/.werks/2813 b/.werks/2813
new file mode 100644
index 0000000..569a2d9
--- /dev/null
+++ b/.werks/2813
@@ -0,0 +1,12 @@
+Title: agent_netapp: fixed missing environmental sensor information and exception with
snapshot volumes
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1450192404
+Class: fix
+
+The agent now queries all nodes for environment sensors information.
+Previously only the first node was queried.
+
+The agent no longer crashes when it hits a volume void of any snapshots.
diff --git a/ChangeLog b/ChangeLog
index 65366c7..8f208e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -154,6 +154,7 @@
* 1312 FIX: carel_uniflair_cooling: Check is now disabled...
* 2868 FIX: cpu_util.include: fixed crash on some systems if per-core statistics were
enabled...
* 1317 FIX: fileinfo.groups: Fixed handling of $DATE pattern...
+ * 2813 FIX: agent_netapp: fixed missing environmental sensor information and
exception with snapshot volumes...
Multisite:
* 2684 Added icons for downloading agent data / walks of hosts...
diff --git a/agents/special/agent_netapp b/agents/special/agent_netapp
index 01f74ca..4908a3d 100755
--- a/agents/special/agent_netapp
+++ b/agents/special/agent_netapp
@@ -250,7 +250,7 @@ def format_dict(the_dict, prefix = "", report =
"all", delimeter = "\t", as_line
# +----------------------------------------------------------------------+
nodes = []
-def query_nodes(what, only_first = False, node_attribute = "node-name"):
+def query_nodes(what, node_attribute = "node-name"):
global nodes, section_errors
if not nodes:
node_query = NaElement("system-get-node-info-iter")
@@ -269,8 +269,6 @@ def query_nodes(what, only_first = False, node_attribute =
"node-name"):
continue
results["%s.%s" % (what, node)] = response
- if only_first:
- break
return results
@@ -474,12 +472,16 @@ if netapp_mode == "clustermode":
# Cluster info
# TODO: check is missing
cluster_status = query_nodes("cf-status", node_attribute =
"node")
+ ha_partners = {} # Used later on by environmental sensors
if cluster_status:
print "<<<netapp_api_cm_cluster:sep(9)>>>"
for node, entry in cluster_status.items():
# Small trick improve formatting
container = NaElement("container")
container.child_add(entry)
+ partner_name = entry.child_get_string("partner-name")
+ if partner_name:
+ ha_partners[node] = partner_name
print format_config(container, "cluster",
node.split(".",1)[1])
# Disk
@@ -581,20 +583,29 @@ if netapp_mode == "clustermode":
)
# Environmental sensors
- environment_info = query_nodes("storage-shelf-environment-list-info",
only_first = True)
+ environment_info = query_nodes("storage-shelf-environment-list-info")
+ processed_nodes = []
if environment_info:
- channel_list =
environment_info.values()[0].child_get("shelf-environ-channel-list")
- for channel in channel_list.children_get(): #
cycle channel list
- shelf_list = channel.child_get("shelf-environ-shelf-list")
- for shelf in
channel.child_get("shelf-environ-shelf-list").children_get(): # cylcle shelf
list
- shelf_id = shelf.child_get_string("shelf-id")
- for what, section in [ ("power-supply-list",
"netapp_api_psu"),
- ("cooling-element-list",
"netapp_api_fan"),
- ("temp-sensor-list",
"netapp_api_temp") ]:
- print "<<<%s:sep(9)>>>" % section
- node = shelf.child_get(what)
- print format_config(node, what, shelf_id)
-
+ for node, values in environment_info.items():
+ if node in processed_nodes:
+ continue
+ channel_list = values.child_get("shelf-environ-channel-list")
+ for channel in channel_list.children_get():
# cycle channel list
+ shelf_list = channel.child_get("shelf-environ-shelf-list")
+ for shelf in
channel.child_get("shelf-environ-shelf-list").children_get(): # cycle shelf
list
+ shelf_id = shelf.child_get_string("shelf-id")
+ for what, section in [ ("power-supply-list",
"netapp_api_psu"),
+ ("cooling-element-list",
"netapp_api_fan"),
+ ("temp-sensor-list",
"netapp_api_temp") ]:
+ print "<<<%s:sep(9)>>>" % section
+ node = shelf.child_get(what)
+ print format_config(node, what, shelf_id)
+ # HA partners always report redundant environmental data.
+ # (Node1/Node2) <--Cluster--> (Node3/Node4)
+ # We skip data from Node2 and Node4.
+ processed_nodes.append(node)
+ if node in ha_partners:
+ processed_nodes.append(ha_partners[node])
#.
@@ -667,11 +678,13 @@ else:
dict_reserved["size-total"] =
volume.child_get_string("size-total")
dict_reserved["percent-reserved"] =
volume_snapshots_reserved.child_get_string("percent-reserved")
dict_reserved["blocks-reserved"] =
volume_snapshots_reserved.child_get_string("blocks-reserved")
- print format_dict(dict_reserved, prefix = "volume_snapshot %s" % name,
as_line = True)
+ snapshots_elements = volume_snapshots.child_get("snapshots")
- volume_snapshots = server.invoke("snapshot-list-info",
"target-name", name, "target-type", "volume")
- print format_config(volume_snapshots.child_get("snapshots"),
"volume_snapshot", name,
- config_report = ["volume_snapshot",
"percentage-of-total-blocks", "cumulative-total"])
+ if snapshots_elements:
+ volume_snapshots = server.invoke("snapshot-list-info",
"target-name", name, "target-type", "volume")
+ print format_dict(dict_reserved, prefix = "volume_snapshot %s" %
name, as_line = True)
+ print format_config(volume_snapshots.child_get("snapshots"),
"volume_snapshot", name,
+ config_report = ["volume_snapshot",
"percentage-of-total-blocks", "cumulative-total"])
# Protocols