mirror of
https://github.com/TheNetworkGuy/netbox-zabbix-sync.git
synced 2025-07-14 01:41:25 -06:00
This commit is contained in:
parent
df77eca944
commit
e269b28381
@ -215,21 +215,14 @@ class NetworkDevice():
|
|||||||
|
|
||||||
# Gather device Zabbix templates
|
# Gather device Zabbix templates
|
||||||
device_type_cf = self.nb.device_type.custom_fields
|
device_type_cf = self.nb.device_type.custom_fields
|
||||||
if(templates_config_context):
|
if(template_cf in device_type_cf):
|
||||||
try:
|
self.template_name = device_type_cf[template_cf]
|
||||||
self.zbx_templates = self.config_context["zabbix"]["templates"]
|
|
||||||
except KeyError:
|
|
||||||
e = "Config context for Zabbix template was not found for host {self.name}"
|
|
||||||
else:
|
else:
|
||||||
if(template_cf in device_type_cf):
|
e = (f"Custom field {template_cf} not "
|
||||||
self.template_name = device_type_cf[template_cf]
|
f"found for {self.nb.device_type.manufacturer.name}"
|
||||||
self.zbx_templates = [device_type_cf[template_cf]]
|
f" - {self.nb.device_type.display}.")
|
||||||
else:
|
logger.warning(e)
|
||||||
e = (f"Custom field {template_cf} not "
|
raise SyncInventoryError(e)
|
||||||
f"found for {self.nb.device_type.manufacturer.name}"
|
|
||||||
f" - {self.nb.device_type.display}.")
|
|
||||||
logger.warning(e)
|
|
||||||
raise SyncInventoryError(e)
|
|
||||||
|
|
||||||
def set_hostgroup(self, format):
|
def set_hostgroup(self, format):
|
||||||
"""Set the hostgroup for this device"""
|
"""Set the hostgroup for this device"""
|
||||||
|
Loading…
Reference in New Issue
Block a user