Skip to content

Commit

Permalink
Add logic for zabbix-disable and zabbix-enable tags
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-eisenhart committed Jun 6, 2024
1 parent 990fe11 commit 0da1f24
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/sonic/netbox_zabbix/netbox_zabbix.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,14 @@ def disable_enable_zabbix_hosts_from_netbox_data(self, zabbix_servers, netbox_se
log.debug(f"TRACE:{name}:disable?")
nbsrv = netbox_servers[name]
zbsrv = zabbix_servers[name]
if nbsrv.status["value"] == "decommissioning":
# Enable if tagged Zabbix Enable
if any(tag["slug"] == "zabbix-enable" for tag in nbsrv.tags):
log.debug("Zabbix Enable Tag")
self.zabbix.host_enable(zbsrv)
elif any(tag["slug"] == "zabbix-disable" for tag in nbsrv.tags):
log.debug("Zabbix Enable Tag")
self.zabbix.host_disable(zbsrv)
elif nbsrv.status["value"] == "decommissioning":
log.debug(f"Decommissioning Host {name}")
self.zabbix.host_disable(zbsrv)
elif nbsrv.status["value"] == "planned":
Expand Down

0 comments on commit 0da1f24

Please sign in to comment.