Skip to content

Instantly share code, notes, and snippets.

@dnaeon
Last active August 29, 2015 14:21
Show Gist options
  • Save dnaeon/eca835909b61b3a54427 to your computer and use it in GitHub Desktop.
Save dnaeon/eca835909b61b3a54427 to your computer and use it in GitHub Desktop.
diff --git a/extra/zabbix/vsphere-import/zabbix-vsphere-import b/extra/zabbix/vsphere-import/zabbix-vsphere-import
index 01cd0c4..3958e6a 100755
--- a/extra/zabbix/vsphere-import/zabbix-vsphere-import
+++ b/extra/zabbix/vsphere-import/zabbix-vsphere-import
@@ -436,8 +436,14 @@ class ZabbixVSphere(object):
host
)
+ # Fix for issue #128
+ # Split the VM name which consists of '<vm> (uuid)'
+ # The host machine name ({HOST.HOST} macro) would become '<vm>'
+ # The host visible name ({HOST.NAME} macro) would become '<vm> (uuid)'
+ machine_name, visible_name = host.split('(')
params = deepcopy(host_options)
- params['host'] = host
+ params['host'] = machine_name.strip()
+ params['name'] = host
# Add the virtual machine to it's respective hostgroup/cluster in Zabbix
# We do this by first finding the host this VM runs on and then we get the
@MattParr
Copy link

MattParr commented Aug 6, 2015

It would be better if this mapped:

uuid => host.host
vm (uuid) => host.name

The zabbix host.host field must be unique. It's quite common for a vCloud environment to have a lot of VMs with the same name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment