def import_hosts(self): """ Create/update zabbix IDn for all matched CI's """ logger.debug('Zabbix hosts import started.') hosts = zabbix.get_all_hosts() for h in hosts: # base method ci = self.get_ci_by_name(h.get('host')) if not ci: continue ci.zabbix_id=h.get('hostid') ci.save() logger.debug('Finshed')
def import_hosts(self): """ Create/update zabbix IDn for all matched CI's """ logger.debug('Zabbix hosts import started.') hosts = zabbix.get_all_hosts() for h in hosts: # base method ci = self.get_ci_by_name(h.get('host')) if not ci: continue ci.zabbix_id = h.get('hostid') ci.save() logger.debug('Finshed')
def import_hosts(self): """ Create/update zabbix IDn for all matched CI's """ logger.debug('Zabbix hosts import started.') hosts = zabbix.get_all_hosts() for host in hosts: # base method name = host.get('host') ci = self.get_ci_by_name(name) if not ci: if getattr(settings, 'ZABBIX_IMPORT_HOSTS', False): ci = db.CI(name=name) ci.type_id = db.CI_TYPES.DEVICE.id ci.state = db.CI_STATE_TYPES.ACTIVE.id ci.save() else: logger.debug('Skipping hostname: %s' % name) continue ci.zabbix_id = host.get('hostid') ci.save() logger.debug('Finshed')