Module: check_mk
Branch: master
Commit: 20fdef80330266e7d0e7f14f844014ba57f430d5
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=20fdef80330266…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Tue Sep 25 16:10:48 2018 +0200
agent_netapp: recover from parse exception & print some debug info
Change-Id: Id9dd3b78b2a6af11f7f0da8b67d56640f28cccac
---
agents/special/agent_netapp | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/agents/special/agent_netapp b/agents/special/agent_netapp
index 1075440..055dc8f 100755
--- a/agents/special/agent_netapp
+++ b/agents/special/agent_netapp
@@ -289,6 +289,8 @@ else:
print "######## GOT RESPONSE #######"
if netapp_response.results_status() != "passed":
print "Error: Unable to parse content of response:\n%s" %
netapp_response.results_reason()
+ if netapp_response.results_status() == "parse-exception":
+ print "Raw response text:\n%s" %
netapp_response.raw_response_text
else:
print prettify(netapp_response.get_results().get_node())
@@ -387,7 +389,12 @@ else:
return
# We except an XML answer (not HTML)
- self.content = NetAppNode(ET.fromstring(self.raw_response_text))
+ try:
+ self.content = NetAppNode(ET.fromstring(self.raw_response_text))
+ except ET.ParseError, exc:
+ self.status = "parse-exception"
+ self.reason = str(exc)
+ return
self.status =
self.content.child_get("results").node.attrib["status"]
if self.status != "passed":