Module: check_mk
Branch: master
Commit: d4e83a2890597ef219f76fc6b8e3b42f31f36c98
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d4e83a2890597e…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Oct 19 11:57:32 2016 +0200
3828 FIX agent_netapp: improved error reporting. fixed exception when
snapmirror-get-status returns no values
---
.werks/3828 | 9 +++++++++
ChangeLog | 1 +
agents/special/agent_netapp | 15 +++++++++++----
3 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/.werks/3828 b/.werks/3828
new file mode 100644
index 0000000..91cfc7c
--- /dev/null
+++ b/.werks/3828
@@ -0,0 +1,9 @@
+Title: agent_netapp: improved error reporting. fixed exception when snapmirror-get-status
returns no values
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.4.0i2
+Date: 1476871000
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 1ad77a9..fd5524d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -31,6 +31,7 @@
* 3827 FIX: windows agent: fixed 3 bugs which broke the skype section
* 3650 FIX: Fixed bash versionitis, unbreaking cached check results....
* 3960 FIX: if.include: fixed wrong order if interface groups are configured
+ * 3828 FIX: agent_netapp: improved error reporting. fixed exception when
snapmirror-get-status returns no values
Multisite:
* 3959 Two new filters for the comment view: author and comment text field
diff --git a/agents/special/agent_netapp b/agents/special/agent_netapp
index 6651602..23e0d1d 100755
--- a/agents/special/agent_netapp
+++ b/agents/special/agent_netapp
@@ -170,8 +170,11 @@ else:
# The following code in the else: block completely replaces the used functionality of
NaServer/NaElements
import base64
import requests
- from requests.packages.urllib3.exceptions import InsecureRequestWarning
- requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
+ try:
+ from requests.packages.urllib3.exceptions import InsecureRequestWarning
+ requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
+ except:
+ pass
from lxml import etree
from StringIO import StringIO
@@ -213,6 +216,9 @@ else:
xml_declaration = True, encoding = "UTF-8")
+ def add_error_message(self, message):
+ self.error_messages.add_message(message)
+
# Converts: ['perf-object-get-instances', [['objectname',
'nfsv3'], ['instance-uuids', [['instance-uuid', '5']]]]]
# into a xml etree:
# <perf-object-get-instances>
@@ -263,7 +269,7 @@ else:
if self.debug:
print "######## GOT RESPONSE #######"
if self.last_response.status != "passed":
- print "Error: Unable to parse content of response: %s" %
self.last_response.content
+ print "Error: Unable to parse content of response: %s" %
self.last_response.raw_response_text
else:
print prettify(self.last_response.content.get_node())
@@ -1130,7 +1136,7 @@ try:
server.set_vfiler(vfiler)
response = server.invoke("snapmirror-get-status")
data = response.children_get()
- if not data:
+ if not data or len(data) <= 1:
continue
data = data[1]
print format_config(data, "snapvault",
"source-location",
@@ -1193,6 +1199,7 @@ try:
except Exception, e:
# Shouldn't happen at all...
+ server.add_error_message("Agent Exception (contact developer): %s" % e)
if opt_debug:
raise
finally: