feat: add node hostname info to discovery info logging (#388)

Co-authored-by: Robert Kaussow <xoxys@rknet.org>
This commit is contained in:
etfeet 2023-05-14 10:55:03 -07:00 committed by GitHub
parent edf8082b31
commit 8dad3ae9dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -156,8 +156,9 @@ class Discovery():
@PROPAGATION_TIME.time() @PROPAGATION_TIME.time()
def propagate(self): def propagate(self):
self.host_list.clear() self.host_list.clear()
nodelist = self._get_names(self.client.get_nodes(), "node")
for node in self._get_names(self.client.get_nodes(), "node"): self.logger.info(f"Discovered nodes: {','.join(nodelist)}")
for node in nodelist:
try: try:
qemu_list = self._filter(self.client.get_all_vms(node)) qemu_list = self._filter(self.client.get_all_vms(node))
container_list = self._filter(self.client.get_all_containers(node)) container_list = self._filter(self.client.get_all_containers(node))
@ -169,7 +170,7 @@ class Discovery():
instances.update(self._get_variables(container_list, "container")) instances.update(self._get_variables(container_list, "container"))
HOST_GAUGE.set(len(instances)) HOST_GAUGE.set(len(instances))
self.logger.info(f"Found {len(instances)} targets") self.logger.info(f"{node}: Found {len(instances)} targets")
for host in instances: for host in instances:
host_meta = instances[host] host_meta = instances[host]
vmid = host_meta["proxmox_vmid"] vmid = host_meta["proxmox_vmid"]