unbound_exporter
unbound_exporter copied to clipboard
Panic occurs when certificates do not exist on disk
Note that I am missing the -unbound.ca
flag which then defaults to a non-existant file /etc/unbound/unbound_server.pem
. We should detect file existence and not panic.
Systemd unit
[Unit]
Description=Prometheus exporter for Unbound metrics, written in Go with pluggable metric collectors. The metrics exporter converts Unbound metric names to Prometheus metric names and labels by using a set of regular expressions.
Documentation=https://github.com/letsencrypt/unbound_exporter
After=network.target
[Service]
Type=simple
ExecStart=/opt/prometheus/bin/unbound_exporter \
-unbound.cert "/etc/unbound/unbound_control_ec.pem" \
-unbound.key "/etc/unbound/unbound_control_ec.key" \
-unbound.host "tcp://localhost:8953"
[Install]
WantedBy=multi-user.target
Logs
unbound_exporter[5031]: level=info ts=2022-08-09T21:18:30.787Z caller=unbound_exporter.go:492 Startingunbound_exporter=(MISSING)
unbound_exporter[5031]: panic: open /etc/unbound/unbound_server.pem: no such file or directory
unbound_exporter[5031]: goroutine 1 [running]:
unbound_exporter[5031]: main.main()
unbound_exporter[5031]: /tmp/tmp.pHIIcqYEmU/unbound_exporter.go:495 +0x679