fixed outdated systemtime of check_mk agent
Message-ID: <52cbccf9.CLG4VlK2IG3FWLAD%ab(a)mathias-kettner.de>
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: 5fdf551fece051069d5bc696a190469c285af394
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5fdf551fece051…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Tue Jan 7 10:45:36 2014 +0100
FIX agent_vsphere / check_mk agent: fixed outdated systemtime of check_mk agent
The systemtime of the check_mk agent was incorrect most of the time whenever the
agent_vsphere was used together with the classic agent.
The reason was that the agent_vsphere program was called after the check_mk agent
- its execution took several seconds - thus leading to an outdated systemtime of the
standard agent.
---
.werks/251 | 13 +++++++++++++
ChangeLog | 1 +
agents/special/agent_vsphere | 9 +++++----
agents/special/agent_vsphere.pysphere | 17 +++++++++++------
4 files changed, 30 insertions(+), 10 deletions(-)
diff --git a/.werks/251 b/.werks/251
new file mode 100644
index 0000000..c0d489a
--- /dev/null
+++ b/.werks/251
@@ -0,0 +1,13 @@
+Title: agent_vsphere / check_mk agent: fixed outdated systemtime of check_mk agent
+Level: 1
+Component: checks
+Class: fix
+State: unknown
+Version: 1.2.5i1
+Date: 1389087583
+Targetversion: future
+
+The systemtime of the check_mk agent was incorrect most of the time whenever the
+agent_vsphere was used together with the classic agent.
+The reason was that the agent_vsphere program was called after the check_mk agent
+- its execution took several seconds - thus leading to an outdated systemtime of the
standard agent.
diff --git a/ChangeLog b/ChangeLog
index 6371a30..3ea6478 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -75,6 +75,7 @@
* 0397 FIX: mrpe: tolerate performance variable names with spaces...
* 0399 FIX: check_ftp: cleanup configuration via WATO, remove Hostname field...
* 0435 FIX: esx_vsphere_sensors: Fix garbled output in case of placeholder VMs...
+ * 0251 FIX: agent_vsphere / check_mk agent: fixed outdated systemtime of check_mk
agent...
Multisite:
* 0371 Added log class filter to hostsvcevents view
diff --git a/agents/special/agent_vsphere b/agents/special/agent_vsphere
index f65eae0..b1ddcea 100755
--- a/agents/special/agent_vsphere
+++ b/agents/special/agent_vsphere
@@ -278,10 +278,6 @@ def get_agent_info_tcp(hostname):
raise
return output
-if opt_agent:
- sys.stdout.write(get_agent_info_tcp(host_address))
- sys.stdout.flush()
- error_exit = 0
results = {}
@@ -592,6 +588,11 @@ if not error:
raise
error = "Error while processing received data"
+if opt_agent:
+ sys.stdout.write(get_agent_info_tcp(host_address))
+ sys.stdout.flush()
+ error_exit = 0
+
if tracefile:
tracefile.close()
diff --git a/agents/special/agent_vsphere.pysphere
b/agents/special/agent_vsphere.pysphere
index 68284f8..f5487dd 100755
--- a/agents/special/agent_vsphere.pysphere
+++ b/agents/special/agent_vsphere.pysphere
@@ -183,16 +183,16 @@ def get_agent_info_tcp(hostname):
return output
error_exit = 1
-if opt_agent:
- sys.stdout.write(get_agent_info_tcp(host_address))
- sys.stdout.flush()
- error_exit = 0 # do not fail if vSphere fails
-
try:
from pysphere import VIServer, VIProperty, MORTypes
from pysphere.resources import VimService_services as VI
-except:
+except:
+ # Get check_mk agent output even if pysphere is missing
+ if opt_agent:
+ sys.stdout.write(get_agent_info_tcp(host_address))
+ sys.stdout.flush()
+ error_exit = 0 # do not fail if vSphere fails
sys.stderr.write("pysphere API not found. Please install and try
again.\n")
sys.exit(error_exit)
@@ -770,5 +770,10 @@ for entry in object_collection:
print "\t".join(entry)
host.disconnect()
+# Get check_mk agent output
+if opt_agent:
+ sys.stdout.write(get_agent_info_tcp(host_address))
+ sys.stdout.flush()
+
if g_profile:
output_profile()