Go to file
Phil Porada 1d05a2741b
Add contrib directory (#45)
The new contrib directory contains a script that generates an EC key-pair that satisfies golang >=1.15 CommonName deprecation. 

Co-authored-by: J.C. Jones <jcjones@users.noreply.github.com>
Co-authored-by: Samantha <hello@entropy.cat>
2023-02-22 18:22:22 -05:00
.github/workflows Update dependencies to fix promhttp uncontrolled resource consumption (#51) 2023-02-21 16:42:51 -05:00
contrib Add contrib directory (#45) 2023-02-22 18:22:22 -05:00
.gitignore Refactored the unbound histogram metrics from gauge metrics into 2017-10-19 16:10:25 +02:00
LICENSE Add a proper license. 2017-01-09 09:35:52 +01:00
README.md Update installation instructions (#43) 2022-07-06 18:33:29 -07:00
go.mod Update dependencies to fix promhttp uncontrolled resource consumption (#51) 2023-02-21 16:42:51 -05:00
go.sum Update dependencies to fix promhttp uncontrolled resource consumption (#51) 2023-02-21 16:42:51 -05:00
nfpm.yaml Build and Release Action (#38) 2022-04-22 11:28:46 -07:00
unbound_exporter.go Update dependencies to fix promhttp uncontrolled resource consumption (#51) 2023-02-21 16:42:51 -05:00
unbound_exporter_test.go Fix lints, add testing file, and update go mod and sum files (#28) 2021-11-17 14:32:28 -05:00

README.md

Prometheus Unbound exporter

This repository provides code for a simple Prometheus metrics exporter for the Unbound DNS resolver. This exporter connects to Unbounds TLS control socket and sends the stats_noreset command, causing Unbound to return metrics as key-value pairs. The metrics exporter converts Unbound metric names to Prometheus metric names and labels by using a set of regular expressions.


Prerequisites

Go 1.16 or above is required.

Installation

go install github.com/letsencrypt/unbound_exporter@latest

This will install the binary in $GOBIN, or $HOME/go/bin if $GOBIN is unset.

Updating dependencies

go get -u
go mod tidy

Usage

To show all CLI flags available

$ unbound_exporter -h

Scrape metrics from the exporter

$ curl 127.0.0.1:9167/metrics | grep '^unbound_up'
unbound_up 1

From the Unbound statistics doc: Unbound has an option to enable extended statistics collection. If enabled, more statistics are collected, for example what types of queries are sent to the resolver. Otherwise, only the total number of queries is collected. Add the following to your unbound.conf.

server:
    extended-statistics: yes