Module: check_mk
Branch: master
Commit: 5c4084b22076a92be187da5de26dca554cc2d878
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5c4084b22076a9…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Mon Apr 4 09:25:00 2016 +0200
3017 FIX Fixed missing host/vms inventory information when having multiple datacenters
The inventory data was incomplete when more than one datacenter was available.
---
.werks/3017 | 9 +++++++++
ChangeLog | 1 +
agents/special/agent_vsphere | 31 ++++++++++++++++---------------
3 files changed, 26 insertions(+), 15 deletions(-)
diff --git a/.werks/3017 b/.werks/3017
new file mode 100644
index 0000000..ef6650b
--- /dev/null
+++ b/.werks/3017
@@ -0,0 +1,9 @@
+Title: Fixed missing host/vms inventory information when having multiple datacenters
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.9i1
+Date: 1459754630
+Class: fix
+
+The inventory data was incomplete when more than one datacenter was available.
diff --git a/ChangeLog b/ChangeLog
index d609d64..482918c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -118,6 +118,7 @@
* 3110 FIX: ewon: Various improvements to snmp proxy functionality...
NOTE: Please refer to the migration notes!
* 3016 FIX: mk-job: scheduled jobs are now always executed despite of any status file
permission problems...
+ * 3017 FIX: Fixed missing host/vms inventory information when having multiple
datacenters...
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/agents/special/agent_vsphere b/agents/special/agent_vsphere
index 85da7df..f70284f 100755
--- a/agents/special/agent_vsphere
+++ b/agents/special/agent_vsphere
@@ -1583,21 +1583,22 @@ if not error:
if not opt_direct:
reply_code, reply_msg, reply_headers, response =
query_server(telegram_list["datacenters"])
- datacenter = get_pattern('<objects><obj
type="Datacenter">(.*?)</obj>.*', response)[0]
- reply_code, reply_msg, reply_headers, response =
query_server(telegram_list["clustersofdatacenter"],
-
payload_params = {"datacenter": datacenter} )
- clusters = get_pattern('<objects><obj
type="ClusterComputeResource">(.*?)</obj>.*?string">(.*?)</val></propSet></objects>',
response)
-
- output("<<<esx_vsphere_clusters:sep(9)>>>")
- for cluster in clusters:
- reply_code, reply_msg, reply_headers, response =
query_server(telegram_list["esxhostsofcluster"],
-
payload_params = {"clustername": cluster[0]} )
- cluster_vms = []
- hosts = get_pattern('<objects><obj
type="HostSystem">.*?string">(.*?)</val></propSet></objects>',
response)
- for host in hosts:
- cluster_vms.extend(vm_esx_host.get(host, []))
- output("%s\thostsystems\t%s\t%s" % (datacenter, cluster[1],
"\t".join(hosts)))
- output("%s\tvms\t%s\t%s" % (datacenter, cluster[1],
"\t".join(map(convert_hostname, cluster_vms))))
+ datacenters = get_pattern('<objects><obj
type="Datacenter">(.*?)</obj>', response)
+ for datacenter in datacenters:
+ reply_code, reply_msg, reply_headers, response =
query_server(telegram_list["clustersofdatacenter"],
+
payload_params = {"datacenter": datacenter} )
+ clusters = get_pattern('<objects><obj
type="ClusterComputeResource">(.*?)</obj>.*?string">(.*?)</val></propSet></objects>',
response)
+
+
output("<<<esx_vsphere_clusters:sep(9)>>>")
+ for cluster in clusters:
+ reply_code, reply_msg, reply_headers, response =
query_server(telegram_list["esxhostsofcluster"],
+
payload_params = {"clustername": cluster[0]} )
+ cluster_vms = []
+ hosts = get_pattern('<objects><obj
type="HostSystem">.*?string">(.*?)</val></propSet></objects>',
response)
+ for host in hosts:
+ cluster_vms.extend(vm_esx_host.get(host, []))
+ output("%s\thostsystems\t%s\t%s" % (datacenter,
cluster[1], "\t".join(hosts)))
+ output("%s\tvms\t%s\t%s" % (datacenter, cluster[1],
"\t".join(map(convert_hostname, cluster_vms))))
output("<<<esx_vsphere_objects:sep(9)>>>")