From 55bebda4d4b52a46542ef3e8edacba600ec5556a Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sun, 29 Jan 2023 11:02:49 +0100 Subject: [PATCH] bundles/powerdns: fix socket path for telegraf --- bundles/powerdns/metadata.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/bundles/powerdns/metadata.py b/bundles/powerdns/metadata.py index 3cf5d4e..5a2cc41 100644 --- a/bundles/powerdns/metadata.py +++ b/bundles/powerdns/metadata.py @@ -43,7 +43,11 @@ if node.has_bundle('telegraf'): defaults['telegraf'] = { 'input_plugins': { 'builtin': { - 'powerdns': [{}], + 'powerdns': [{ + 'unix_sockets': [ + '/var/run/pdns/pdns.controlsocket', + ], + }], }, }, 'additional_groups': { @@ -186,16 +190,16 @@ def hosts_entries_for_all_dns_servers(metadata): if rnode.name == node.name: continue - ip = rnode.metadata.get('external_ipv4') + found_ips = repo.libs.tools.resolve_identifier(repo, rnode.name) + for ip in sorted(found_ips['ipv4']): + if not ip.is_private: + entries[str(ip)] = { + rnode.metadata.get('hostname'), + rnode.name, + } - if ip: - entries[ip] = { - rnode.metadata.get('hostname'), - rnode.name, - } - - if rnode.metadata.get('powerdns/my_hostname', None): - entries[ip].add(rnode.metadata.get('powerdns/my_hostname')) + if rnode.metadata.get('powerdns/my_hostname', None): + entries[str(ip)].add(rnode.metadata.get('powerdns/my_hostname')) return { 'hosts': {