Bastille Template: AdGuard Home Exporter

AdGuard Home Exporter presents your DNS metrics to Prometheus.

AdGuard Exporter Grafana Dashboard (ID: 13330).

Bastille is an open-source system for automating deployment and management containerized applications on FreeBSD.


Template: AdGuard Home Exporter

Bastille is more than just lightweight containers for FreeBSD. The template command allows you to automatically deploy a wide range of software!

We continue the series with a template that builds on last month’s example. This template will install and integrate a Prometheus exporter into the AdGuard Home service we installed last time.

If you missed “last time” you can find it here: Bastille Template: AdGuard Home.

Prometheus is my preferred way to capture metrics and monitor a home or corporate network. Exporting my DNS information to Prometheus is a great addition to my dashboards.

If you’d like to extend AdGuard Home with this Prometheus exporter follow these steps:

Bootstrap

bastille bootstrap https://gitlab.com/bastillebsd-templates/adguardhome-exporter

Output Example

ishmael ~ # bastille bootstrap https://gitlab.com/bastillebsd-templates/adguardhome-exporter
Cloning into '/usr/local/bastille/templates/bastillebsd-templates/adguardhome-exporter'...
warning: redirecting to https://gitlab.com/bastillebsd-templates/adguardhome-exporter.git/
remote: Enumerating objects: 24, done.
remote: Counting objects: 100% (24/24), done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 24 (delta 7), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (24/24), 6.05 KiB | 6.05 MiB/s, done.
Resolving deltas: 100% (7/7), done.
Detected Bastillefile hook.
[Bastillefile]:
PKG adguard-exporter
SYSRC adguard_exporter_enable=YES
SYSRC adguard_exporter_username=adguard
SYSRC adguard_exporter_password=BastilleBSD!
SYSRC adguard_exporter_hostname=${JAIL_IP}
SYSRC adguard_exporter_port=80
SYSRC adguard_exporter_protocol=http
SERVICE adguard_exporter restart

Template ready to use.

Template

Apply the new template to your existing adguardhome container created from the previous guide.

bastille template adguardhome bastillebsd-templates/adguardhome-exporter

Output Example

[adguard]:
Applying template: bastillebsd-templates/adguardhome-exporter...
[adguard]:
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	adguard-exporter: 1.14

Number of packages to be installed: 1

The process will require 6 MiB more space.
2 MiB to be downloaded.
[adguard] [1/1] Fetching adguard-exporter-1.14.pkg: 100%    2 MiB   2.0MB/s    00:01
Checking integrity... done (0 conflicting)
[adguard] [1/1] Installing adguard-exporter-1.14...
===> Creating groups.
Using existing group 'nobody'.
===> Creating users
Using existing user 'nobody'.
[adguard] [1/1] Extracting adguard-exporter-1.14: 100%

[adguard]:
adguard_exporter_enable:  -> YES

[adguard]:
adguard_exporter_username:  -> adguard

[adguard]:
adguard_exporter_password:  -> BastilleBSD!

[adguard]:
adguard_exporter_hostname:  -> 10.17.89.53

[adguard]:
adguard_exporter_port:  -> 80

[adguard]:
adguard_exporter_protocol:  -> http

[adguard]:
Starting adguard_exporter.

Template applied: bastillebsd-templates/adguardhome-exporter

Usage

Now that the template is applied you can add the node to your Prometheus targets. The exporter presents metrics on port :9617.

You’ll probably want to import the AdGuard Exporter Grafana Dashboard too.

Avatar
Christer Edwards
Code Custodian

FreeBSD die-hard, software developer, author, educator, man behind BastilleBSD.