Module: check_mk
Branch: master
Commit: d2aa4cfe4829f22b22a725647af8faa8e77a5bf7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d2aa4cfe4829f2…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri Jun 13 10:04:16 2014 +0200
FIX agent_ibmsvc: improved error messages on using wrong credentials
---
.werks/936 | 8 ++++++++
ChangeLog | 1 +
agents/special/agent_ibmsvc | 14 +++++++++-----
3 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/.werks/936 b/.werks/936
new file mode 100644
index 0000000..e156c15
--- /dev/null
+++ b/.werks/936
@@ -0,0 +1,8 @@
+Title: agent_ibmsvc: improved error messages on using wrong credentials
+Level: 1
+Component: checks
+Version: 1.2.5i4
+Date: 1402646582
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index fd4955d..3314dc3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,7 @@
* 0993 raritan_pdu_inlet: now delivers performance data
* 0616 FIX: brocade.fan, brocade.power, brocade.temp: will now only discover services
which are not marked as absent
* 0992 FIX: zfs_arc_cache: returns OK even if values of arc meta are missing...
+ * 0936 FIX: agent_ibmsvc: improved error messages on using wrong credentials
Multisite:
* 0934 FIX: Logwatch messages with class unknown ( 'u' ) now displayed as
WARN...
diff --git a/agents/special/agent_ibmsvc b/agents/special/agent_ibmsvc
index 3806044..a17fd2a 100755
--- a/agents/special/agent_ibmsvc
+++ b/agents/special/agent_ibmsvc
@@ -93,7 +93,7 @@ host_address = None
user = None
mortypes = [ 'all' ]
-command_options = {
+command_options = {
"lshost" : {"section_header" : "ibm_svc_host",
"active" : False,
"command" : "lshost -nohdr -delim :"},
"lslicense" : {"section_header" :
"ibm_svc_license", "active" : False,
@@ -189,13 +189,17 @@ stdout, stderr = result.communicate()
exit_code = result.wait()
if exit_code not in [ 0, 1 ]:
- print "Error connecting via ssh"
+ sys.stderr.write("Error connecting via ssh")
sys.exit(2)
-if stdout.startswith("CMMVC7016E"):
- print str(stdout)
+lines = stdout.split('\n')
+
+if lines[0].startswith("CMMVC7016E") or (len(lines) > 1 and
lines[1].startswith("CMMVC7016E")):
+ sys.stderr.write(stdout)
sys.exit(2)
-for line in stdout.split('\n'):
+
+# Quite strange.. Why not simply print stdout?
+for line in lines:
print line