Module: check_mk
Branch: master
Commit: c1a1268f2c0daa8c5a1d1bd59f632b2eba052469
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c1a1268f2c0daa…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Sep 18 11:48:54 2014 +0200
fixed exception when querying esx host
---
agents/special/agent_vsphere | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/agents/special/agent_vsphere b/agents/special/agent_vsphere
index 45edf35..12b034d 100755
--- a/agents/special/agent_vsphere
+++ b/agents/special/agent_vsphere
@@ -642,7 +642,7 @@ try:
systeminfo[entry] = function and function(element[0]) or element[0]
elif name == "login":
my_cookie = reply_headers.get("Set-Cookie")
- if reply_msg != "OK":
+ if "InvalidLogin" in reply_data:
raise Exception("Login response is not 'OK'. Please check
the credentials")
except Exception, e:
@@ -890,7 +890,8 @@ if not error:
print "<<<esx_vsphere_objects:sep(9)>>>"
if "hostsystem" in query_objects:
if opt_direct and opt_hostname:
- print "hostsystem\t%s\t\t%s" % ( opt_hostname,
hostsystems_properties[hostname]["runtime.powerState"][0] )
+ for hostname, data in hostsystems_properties.items():
+ print "hostsystem\t%s\t\t%s" % ( opt_hostname,
hostsystems_properties[hostname]["runtime.powerState"][0] )
else:
for hostname, data in hostsystems_properties.items():
print "hostsystem\t%s\t\t%s" % (
convert_hostname(hostsystems_properties[hostname]["name"][0]),