Skip to content

Commit

Permalink
zabbix-vsphere-import: Fix import of Datacenter objects
Browse files Browse the repository at this point in the history
  • Loading branch information
dnaeon committed Feb 17, 2015
1 parent 937ffe5 commit 219fc5f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions extra/zabbix/vsphere-import/zabbix-vsphere-import
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class ZabbixVSphere(object):

missing_datacenters = set(self.vsphere_datacenters) - set(zabbix_hosts)

if not missing_hosts:
if not missing_datacenters:
logging.info(
'[Datacenter@%s] Objects are in sync with Zabbix',
self.options['vsphere']['hostname']
Expand All @@ -191,7 +191,7 @@ class ZabbixVSphere(object):
logging.info(
'[Datacenter@%s] Number of objects to be imported: %d',
self.options['vsphere']['hostname'],
len(missing_hosts)
len(missing_datacenters)
)

# Get hosts options (templates, groups, macros) from the config file
Expand All @@ -210,15 +210,15 @@ class ZabbixVSphere(object):
}
]

for host in missing_hosts:
for datacenter in missing_datacenters:
logging.info(
"[Datacenter@%s] Creating Zabbix host '%s'",
self.options['vsphere']['hostname'],
host
datacenter
)

params = deepcopy(host_options)
params['host'] = host
params['host'] = datacenter

try:
result = self.zapi.host.create(params)
Expand Down

0 comments on commit 219fc5f

Please sign in to comment.