Module: check_mk
Branch: master
Commit: 56280e80728ed2059c6aafc58f582749214773c2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=56280e80728ed2…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Feb 28 17:50:11 2013 +0100
agent_vsphere: removed <<<local>>>
Reason: error messages from the agent cannot be sent via <<<local>>>,
since
new items here wont be visible. Correct way is to exit with non-zero status.
---
agents/special/agent_vsphere | 14 ++++----------
1 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/agents/special/agent_vsphere b/agents/special/agent_vsphere
index 5630ed1..0b12890 100755
--- a/agents/special/agent_vsphere
+++ b/agents/special/agent_vsphere
@@ -42,9 +42,8 @@ try:
from pysphere import VIServer, VIProperty, MORTypes
from pysphere.resources import VimService_services as VI
except:
- print "<<<local>>>"
- print "2 Agent_error - pysphere API not found. Please install and make a
reinventory"
- sys.exit(0)
+ sys.stderr.write("pysphere API not found. Please install and try
again.\n")
+ sys.exit(1)
host = VIServer()
@@ -53,9 +52,8 @@ object_collection = {}
try:
host.connect(params['Hostname'], params['u'], params['s'])
except:
- print "<<<local>>>"
- print "2 Agent_error - Cant connect to vSphere Server. May the wrong
credentials. Please correct and make a reinventory"
- sys.exit(0)
+ sys.stderr.write("Cannot connect to vSphere Server. May the wrong credentials.
Please correct and make a reinventory.")
+ sys.exit(1)
print "<<<check_mk>>>"
print "Version: %s" % host.get_api_version()
@@ -142,9 +140,5 @@ if "virtualmachine" in check:
})
print "<<<<>>>>"
-print "<<<local>>>"
-for name, data in object_collection.items():
- print "0 %s-%s - INFO: Collecting data for %s" % (data[0], name, data[1])
-
host.disconnect()