[checkmk-commits] 3996 agent_netapp clustermode: now uses a fallback query to determine the node name if the intial query fails

Andreas Boesl ab at mathias-kettner.de
Wed Nov 30 15:41:39 CET 2016


Module: check_mk
Branch: master
Commit: 3c24b9797486e9e5378a804086a2eaf70194820c
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3c24b9797486e9e5378a804086a2eaf70194820c

Author: Andreas Boesl <ab at mathias-kettner.de>
Date:   Wed Nov 30 15:41:31 2016 +0100

3996 agent_netapp clustermode: now uses a fallback query to determine the node name if the intial query fails

---

 .werks/3996                 |  9 +++++++++
 ChangeLog                   |  1 +
 agents/special/agent_netapp | 17 +++++++++++++++--
 3 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/.werks/3996 b/.werks/3996
new file mode 100644
index 0000000..96ffcbb
--- /dev/null
+++ b/.werks/3996
@@ -0,0 +1,9 @@
+Title: agent_netapp clustermode: now uses a fallback query to determine the node name if the intial query fails
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i3
+Date: 1480516853
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index cf6575f..f27c983 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,7 @@
     * 4116 mk_oracle.ps1: added Oracle wallet support to Windows plugin...
     * 3995 skype check: updated perfvariable and metric names, making their purpose more clear...
             NOTE: Please refer to the migration notes!
+    * 3996 agent_netapp clustermode: now uses a fallback query to determine the node name if the intial query fails
     * 3987 FIX: Check_MK Agent Access: Windows agent reported incorrect only from value
     * 3952 FIX: diskstat: fixed bug if multipath devices having an alias...
     * 3939 FIX: f5_bigip_conns: readded performance data and graphs...
diff --git a/agents/special/agent_netapp b/agents/special/agent_netapp
index a3b7960..2f1d3a4 100755
--- a/agents/special/agent_netapp
+++ b/agents/special/agent_netapp
@@ -559,13 +559,26 @@ def query_nodes(what, node_attribute = "node-name"):
             results["%s.%s" % (what, node)] = response
     else:
         if not nodes:
+            # This query may fail for unknown reasons. Some clustermode systems report 0 results
             response = server.get_response(["system-get-node-info-iter", []])
             if response.results_status() == "failed":
                 return
 
+            nodename_field = "system-name"
+            attr_list      = response.get_results().child_get("attributes-list")
+
+            # Fallback query to determine the available node names
+            if not attr_list:
+                response = server.get_response(["system-node-get-iter", []])
+                if response.results_status() == "failed":
+                    return
+
+                attr_list  = response.get_results().child_get("attributes-list")
+                nodename_field = "node"
+
             nodes = []
-            for instance in response.get_results().child_get("attributes-list").children_get():
-                nodes.append(instance.child_get_string("system-name"))
+            for instance in attr_list.children_get():
+                nodes.append(instance.child_get_string(nodename_field))
 
         results = {}
         for node in nodes:



More information about the checkmk-commits mailing list