From e9143eb24cc7e0e3e81fe2d65fb6b371426fe93b Mon Sep 17 00:00:00 2001 From: Raymond Kuiper Date: Fri, 12 Apr 2024 10:38:43 +0200 Subject: [PATCH] Update netbox_zabbix_sync.py Minor bug fix for float or int zero values in inventory fields --- netbox_zabbix_sync.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/netbox_zabbix_sync.py b/netbox_zabbix_sync.py index 8b36c6a..2a40976 100755 --- a/netbox_zabbix_sync.py +++ b/netbox_zabbix_sync.py @@ -410,7 +410,10 @@ class NetworkDevice(): for item in field_list: value = value[item] if value else None # Check if the result is usable and expected - if value and isinstance(value, int | float | str ): + # We want to apply any int or float 0 values, + # even if python thinks those are empty. + if ((value and isinstance(value, int | float | str )) or + (isinstance(value, int | float) and int(value) ==0)): self.inventory[zbx_inv_field] = str(value) elif not value: # empty value should just be an empty string for API compatibility