infra/ansible/roles/telegraf/templates/telegraf.conf.j2
Graham McIntire 66986e294b
monitoring: collect Unbound metrics via Telegraf into Prometheus + Grafana
Add a telegraf role (applied to the resolvers) that runs unbound-control
via the inputs.unbound plugin and exposes the stats as a Prometheus
/metrics endpoint on :9273, firewalled to the 204.110.188.0/22 scrape
network. Imports the InfluxData signing key (influxdata-archive.key; the
_compat key expired 2026-01-17) so dnf can validate the package.

- prom.w5isp.com: scrape job "unbound" for resolver1/2:9273
- grafana: "Unbound Resolvers" dashboard (queries, cache hit ratio,
  rcodes, query types, recursion time, request list, cache memory)
- resolvers: disable unused shm-enable to silence the startup warning
2026-06-07 13:34:24 -05:00

29 lines
974 B
Django/Jinja

# {{ ansible_managed }}
# Managed by Ansible (roles/telegraf). Collects Unbound stats via
# unbound-control and exposes them as a Prometheus /metrics endpoint that
# prom.w5isp.com scrapes. This file fully replaces the packaged default so
# the stock [[outputs.influxdb]] section never runs.
[agent]
interval = "{{ telegraf_interval }}"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
omit_hostname = false
# Read Unbound statistics (runs `unbound-control stats_noreset`).
[[inputs.unbound]]
binary = "{{ telegraf_unbound_binary }}"
use_sudo = false
thread_as_tag = false
# Expose collected metrics for Prometheus to scrape (measurement "unbound"
# becomes unbound_<field>, e.g. unbound_total_num_queries).
[[outputs.prometheus_client]]
listen = "{{ telegraf_prometheus_listen }}"
metric_version = 2
path = "/metrics"
expiration_interval = "60s"