Skip to content

Commit

Permalink
fix(unbound): unbound-exporter installation
Browse files Browse the repository at this point in the history
  • Loading branch information
rwxd committed Oct 4, 2023
1 parent b94f6d9 commit baf5cd8
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Applications/PiHole/add-unbound.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ server:
# logfile: "/var/log/unbound/unbound.log"
verbosity: 0

# view more statistics
extended-statistics: yes

interface: 127.0.0.1
port: 5335
do-ip4: yes
Expand Down
54 changes: 54 additions & 0 deletions Applications/PiHole/install-unbound-prometheus-exporter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Install the Unbound Prometheus Exporter

## Install

### Install golang & compile the exporter

```bash
sudo apt update -y
sudo apt install golang
```

Clone, compile & move the exporter to the correct location

```bash
git clone https://github.com/letsencrypt/unbound_exporter.git
cd unbound_exporter
go build
sudo install -o root -g root -m 0755 unbound_exporter /usr/local/bin/unbound-exporter
cd ..
rm -rf unbound_exporter
```

### Create a systemd service

```bash
cat << EOF > /etc/systemd/system/unbound-exporter.service
[Unit]
Description=Unbound Prometheus Exporter
After=network.target
[Service]
Type=simple
User=root
Group=root
Restart=always
ExecStart=/usr/local/bin/unbound-exporter -web.listen-address ":9167" -web.telemetry-path "/metrics"
[Install]
WantedBy=multi-user.target
EOF
```

### Start the service

```bash
sudo systemctl daemon-reload
sudo systemctl enable --now unbound-exporter.service
```

### Test the exporter

```bash
curl localhost:9167/metrics
```

0 comments on commit baf5cd8

Please sign in to comment.