Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
madnuttah authored May 8, 2023
1 parent adb1fdb commit 92fb547
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
<img src="https://github.com/madnuttah/unbound-docker-stats/blob/main/unbound-stats/screenshots/Screenshot1.jpg" alt="Logo">
</p>

I wanted to have the Statistics of Unbound in my Grafana and I didn't want to modify my [`Unbound Docker Image`](https://github.com/madnuttah/unbound-docker) so I was searching for a way to get them into Zabbix and ship the stats to Grafana. This are the steps how I accomplished this.
I wanted to have the statistics of Unbound in my Grafana and I didn't want to modify my [`Unbound Docker Image`](https://github.com/madnuttah/unbound-docker) to use any third party tools like `Zabbix sender` so I was searching for a way to get them into Zabbix and ship the stats to Grafana.

There are many instructions around to get Zabbix with Active Agents running, please verify that Zabbix and it's Active Agents run properly. I can't and won't support the installation and configuration of Zabbix in your environment, I'm afraid. This was further tested only with Zabbix 6.4.
Zabbix active agents can ingest files, so Unbound-Control creates a file with the statistics using a modified healthcheck script and an active Zabbix agent reads and processes the log and saves the values into the Zabbix database.

Modify the `unbound.conf` to enable extended statistics:
***

### Instructions:

Adapt the `unbound.conf` to enable extended statistics:

```
server:
Expand All @@ -17,11 +21,13 @@ server:
statistics-interval: 0
```

Download the modified [`healthcheck.sh`](https://github.com/madnuttah/unbound-docker-stats/blob/main/unbound-stats/healthcheck.sh) and place it in your persistent Unbound volume.
Download the modified [`healthcheck.sh`](https://github.com/madnuttah/unbound-docker-stats/blob/main/unbound-stats/healthcheck.sh) script and place it in your persistent Unbound volume.

You need to modify your unbound `docker-compose` and add the following lines to the `volumes` section.
You also need to modify your unbound `docker-compose` and add the following lines to the `volumes` section.

```
...
unbound:
container_name: unbound
image: madnuttah/unbound:latest
Expand All @@ -43,13 +49,17 @@ You need to modify your unbound `docker-compose` and add the following lines to
retries: 5
start_period: 15s
timeout: 30s
...
```

Create an Active Zabbix agent on the docker host where Unbound runs on.

Map the `unbound-stats.log` to the agent's volumes in it's `docker-compose` like so:

```
...
zabbix-agent2:
image: zabbix/zabbix-agent2:alpine-6.4-latest
Expand All @@ -59,16 +69,18 @@ Map the `unbound-stats.log` to the agent's volumes in it's `docker-compose` like
...
- ./unbound/log.d/unbound-stats.log:/var/log/unbound-stats.log:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./unbound/log.d/unbound-stats.log:/var/log/unbound-stats.log:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
...
...
```

If you run in trouble, please verify that the permissions are correct, otherwise fix them accordingly. You can always access the running image with `sudo docker exec -ti IMAGENAME /bin/sh`.
Download my Zabbix [`template`](https://github.com/madnuttah/unbound-docker-stats/blob/main/unbound-stats/Zabbix%20Template%20Unbound%20Statistics.yaml) and import it into your host in Zabbix.

Zabbix should display values in `Latest Data` after a little while and you can now begin to configure your Grafana panels as you like.

Download my [`Zabbix template`](https://github.com/madnuttah/unbound-docker-stats/blob/main/unbound-stats/Zabbix%20Template%20Unbound%20Statistics.yaml) and import it into your host in Zabbix.
If you run in trouble, please verify that the permissions are correct, otherwise fix them accordingly. You can always access the running image with `sudo docker exec -ti CONTAINERNAME /bin/sh`.

Zabbix should display values in `Latest Data` and you can now begin to configure your Grafana panels as you like.
As this is my first template for Zabbix I guess there are many things to optimize or to make better. It's working for me and if you like to contribute, you're most welcome.

As I am a beginner in Zabbix I guess there are many things to optimize or to make better. It's working for me and if you like to contribute, you're most welcome.
**This was tested only with Zabbix 6.4.**

0 comments on commit 92fb547

Please sign in to comment.