Module: check_mk
Branch: master
Commit: 41b34efc597b626a17667c48a34da3ca41e69761
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=41b34efc597b62…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Jun 21 09:36:43 2016 +0200
3548 FIX agent_netapp: fixed agent exception for channels without shelfes. improved
7mode/clustermode differentation
An exception has been fixed when a channel has 0 shelfes configured.
Furthermore, the agent has now a slightly more reliable 7mode/clustermode detection
mechanism.
The 7mode/clustermode detection will be revised in an upcoming agent version.
---
.werks/3548 | 13 +++++++++++++
ChangeLog | 1 +
agents/special/agent_netapp | 27 ++++++++++++++++++---------
3 files changed, 32 insertions(+), 9 deletions(-)
diff --git a/.werks/3548 b/.werks/3548
new file mode 100644
index 0000000..c2c360c
--- /dev/null
+++ b/.werks/3548
@@ -0,0 +1,13 @@
+Title: agent_netapp: fixed agent exception for channels without shelfes. improved
7mode/clustermode differentation
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i1
+Date: 1466494329
+Class: fix
+
+An exception has been fixed when a channel has 0 shelfes configured.
+
+
+Furthermore, the agent has now a slightly more reliable 7mode/clustermode detection
mechanism.
+The 7mode/clustermode detection will be revised in an upcoming agent version.
diff --git a/ChangeLog b/ChangeLog
index aae9674..ed3be01 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -275,6 +275,7 @@
* 3143 FIX: windows agent: fixed some minor memory and handle leaks
* 3144 FIX: bugfix: replacing pipe symbol in plugin output was broken
* 3638 FIX: cisco_qos: fixed wrong unit handling
+ * 3548 FIX: agent_netapp: fixed agent exception for channels without shelfes.
improved 7mode/clustermode differentation...
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/agents/special/agent_netapp b/agents/special/agent_netapp
index d7e81c6..149ac69 100755
--- a/agents/special/agent_netapp
+++ b/agents/special/agent_netapp
@@ -409,7 +409,14 @@ if clustered_info:
netapp_mode = clustered_info.lower() == "false" and "7mode" or
"clustermode"
else:
# Looks like the is-clustered attribute is not set, e.g. NetApp 7-Mode Version 8.0
- netapp_mode = "7-mode" in
version_info.child_get_string("version").lower() and "7mode" or
"clustermode"
+ version_string = version_info.child_get_string("version").lower()
+ # TODO: Needs improvement. Unfortunately the version info string does not provide
+ # exact info whether its a 7mode or a clustermode system
+ # Possible approach: Query a class which does not exist in 7-mode and evaluate
response
+ if "NetApp Release 7.3.5.1".lower() in version_string:
+ netapp_mode = "7mode"
+ else:
+ netapp_mode = "7-mode" in version_string and "7mode" or
"clustermode"
#.
@@ -812,14 +819,16 @@ else:
environ_info = query("storage-shelf-environment-list-info")
if environ_info:
for channel in environ_info.children_get():
- for shelf in
channel.child_get("shelf-environ-shelf-list").children_get():
- 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)
+ shelf_list = channel.child_get("shelf-environ-shelf-list")
+ if shelf_list:
+ for shelf in shelf_list.children_get():
+ 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)
# License information
print "<<<netapp_api_licenses:sep(9)>>>"