Categorygithub.com/henrywhitaker3/adguard-exporter
repositorypackage
1.2.0
Repository: https://github.com/henrywhitaker3/adguard-exporter.git
Documentation: pkg.go.dev

# README

AdGuard Home Prometheus Exporter

This is a Prometheus exporter for AdGuard Home.

Dashboard

Installation

Using Docker

You can run it using the following example and pass configuration environment variables:

$ docker run \
  -e 'ADGUARD_SERVERS=http://192.168.1.2' \
  -e 'ADGUARD_USERNAMES=demo' \
  -e 'ADGUARD_PASSWORDS=mypassword' \
  -e 'INTERVAL=15s' \ # Optional, defaults to 30s
  -p 9618:9618 \
  ghcr.io/henrywhitaker3/adguard-exporter:latest

A single instance of adguard-exporter can monitor multiple AdGuard Home instances. To do so, you can specify a list of servers, usernames and passwords by separating them with commas in their respective environment variable:

$ docker run \
  -e 'ADGUARD_SERVERS=http://192.168.1.2,http://192.168.1.3,http://192.168.1.4"' \
  -e "ADGUARD_USERNAMES=$USERNAME1,$USERNAME2,$USERNAME3" \
  -e "ADGUARD_PASSWORDS=$PASSWORD1,$PASSWORD2,$PASSWORD3" \
  -p 9618:9618 \
  ghcr.io/henrywhitaker3/adguard-exporter:latest

Env Vars

VariableDescriptionRequiredDefault
ADGUARD_SERVERSThe servers you want the exporter to scrape. Must include the scheme http(s) and port if non-standard.True
ADGUARD_USERNAMESThe username to connect to the adguard api with. Must be in the same order as ADGUARD_SERVERS if scraping multiple instances.True
ADGUARD_PASSWORDSThe password to connect to the adguard api with. Must be in the same order as ADGUARD_SERVERS if scraping multiple instances.True
INTERVALThe interval that the exporter scrapes metrics from the serverFalse30s
DEBUGTurns on the go profilerFalsefalse

Usage

Once the exporter is running, you also have to update your prometheus.yml configuration to let it scrape the exporter:

scrape_configs:
  - job_name: 'adguard'
    static_configs:
      - targets: ['localhost:9618']

If you want to strip the scheme and port out of the server label in the metrics, you can add a relabeling:

- action: replace
  sourceLabels: ["server"]
  regex: http(|s):\/\/([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}).*
  replacement: $2
  targetLabel: server

Available Prometheus metrics

Metric nameDescription
adguard_scrape_errors_totalThe number of errors scraping a target
adguard_protection_enabledWhether DNS filtering is enabled
adguard_runningWhether adguard is running or not
adguard_queriesTotal queries processed in the last 24 hours
adguard_query_typesThe number of DNS queries by adguard_query_types
adguard_blocked_filteredTotal queries that have been blocked from filter lists
adguard_blocked_safesearchTotal queries that have been blocked due to safesearch
adguard_blocked_safebrowsingTotal queries that have been blocked due to safebrowsing
adguard_avg_processing_time_secondsThe average query processing time in seconds
adguard_avg_processing_time_milliseconds_bucketThe processing time of queries
adguard_top_queried_domainsThe number of queries for the top domains
adguard_top_blocked_domainsThe number of blocked queries for the top domains
adguard_top_clientsThe number of queries for the top clients
adguard_top_upstreamsThe number of repsonses for the top upstream servers
adguard_top_upstreams_avg_response_time_secondsThe average response time for each of the top upstream servers
adguard_dhcp_enabledWhether dhcp is enabled
adguard_dhcp_leasesThe dhcp leases
adguard_queries_detailsQueries with times and additional labels
adguard_queries_details_histogramHistogram of queries with times and additional labels