mirror of
https://github.com/TheNetworkGuy/netbox-zabbix-sync.git
synced 2025-07-13 15:24:48 -06:00
improved debug logging
This commit is contained in:
parent
435fd1fa78
commit
9933c97e94
@ -229,6 +229,7 @@ class PhysicalDevice:
|
||||
self.inventory = field_mapper(
|
||||
self.name, self._inventory_map(), nbdevice, self.logger
|
||||
)
|
||||
self.logger.debug(f"Host {self.name}: Resolved inventory: {self.inventory}")
|
||||
return True
|
||||
|
||||
def isCluster(self):
|
||||
|
@ -159,7 +159,7 @@ def sanatize_log_output(data):
|
||||
"""
|
||||
Used for the update function to Zabbix which
|
||||
shows the data that its using to update the host.
|
||||
Removes and sensitive data from the input.
|
||||
Removes any sensitive data from the input.
|
||||
"""
|
||||
if not isinstance(data, dict):
|
||||
return data
|
||||
@ -168,7 +168,8 @@ def sanatize_log_output(data):
|
||||
if "macros" in data:
|
||||
for macro in sanitized_data["macros"]:
|
||||
# Check if macro is secret type
|
||||
if not macro["type"] == str(1):
|
||||
if not (macro["type"] == str(1) or
|
||||
macro["type"] == 1):
|
||||
continue
|
||||
macro["value"] = "********"
|
||||
# Check for interface data
|
||||
|
@ -6,7 +6,7 @@ All of the Zabbix Usermacro related configuration
|
||||
from logging import getLogger
|
||||
from re import match
|
||||
|
||||
from modules.tools import field_mapper
|
||||
from modules.tools import field_mapper, sanatize_log_output
|
||||
|
||||
|
||||
class ZabbixUsermacros:
|
||||
@ -98,6 +98,7 @@ class ZabbixUsermacros:
|
||||
Generate full set of Usermacros
|
||||
"""
|
||||
macros = []
|
||||
data={}
|
||||
# Parse the field mapper for usermacros
|
||||
if self.usermacro_map:
|
||||
self.logger.debug(f"Host {self.nb.name}: Starting usermacro mapper")
|
||||
@ -119,4 +120,6 @@ class ZabbixUsermacros:
|
||||
m = self.render_macro(macro, properties)
|
||||
if m:
|
||||
macros.append(m)
|
||||
data={'macros': macros}
|
||||
self.logger.debug(f"Host {self.name}: Resolved macros: {sanatize_log_output(data)}")
|
||||
return macros
|
||||
|
Loading…
Reference in New Issue
Block a user