better defaults for freebox parsing issue #927

This commit is contained in:
jokob-sk
2025-01-03 22:27:56 +11:00
parent 4aa18691f4
commit 93886cec8a

View File

@@ -152,12 +152,13 @@ def main():
if "l3connectivities" in host and isinstance(host["l3connectivities"], list):
for ip in [ip for ip in host["l3connectivities"] if ip.get("reachable")]:
mac: str = host.get("l2ident", {}).get("id", "(unknown)")
if mac != '(unknown)':
plugin_objects.add_object(
primaryId=mac,
secondaryId=ip.get("addr", "(unknown)"),
secondaryId=ip.get("addr", "0.0.0.0"),
watched1=host.get("primary_name", "(unknown)"),
watched2=host.get("vendor_name", "(unknown)"),
watched3=map_device_type(host.get("host_type", "unknown")),
watched3=map_device_type(host.get("host_type", "")),
watched4=datetime.fromtimestamp(ip.get("last_time_reachable", 0)),
extra="",
foreignKey=mac,