2022-07-03 17:09:53 +02:00

1.1 KiB

Description

This is a prometheus exporter for knot dns (the authoritative server, not knot-resolver !). It gets all of its values from the mod-stats of knot, which can be set this way in knot's conf:

#/etc/knot/knot.conf
template:
  - id: default
    storage: "/var/lib/knot"
    file: "%s.zone"
    global-module: mod-rrl/default
    global-module: mod-stats/default

It gives knot's default stats, plus the rrl stats. For other modules, you'll have to add them yourself; have a look at the get_stats and gen_metrics functions.

Prometheus job example

The exporter uses port 8001.

  - job_name: 'knot-stats'
    static_configs:
      - targtes: ['myknot:8001']

Installation

  • Install requirements in requirements.txt (python3 -m pip install -r requirements.txt)
  • Copy knot-prom.py to /usr/bin and make it executable by root
  • Copy prometheus-knot-exporter.service to /etc/systemd/system
  • systemctl enable prometheus-knot-exporter.service && systemctl start prometheus-knot-exporter.service
  • Don't forget to open port 8001/tcp in your firewall