2021-09-08 22:03:06 +02:00
|
|
|
# Integration in Grafana
|
2021-03-05 08:02:00 +01:00
|
|
|
|
2021-09-08 22:03:06 +02:00
|
|
|
## Prometheus
|
|
|
|
|
|
|
|
### Prometheus export
|
2021-03-05 08:02:00 +01:00
|
|
|
|
|
|
|
Blocky can optionally export metrics for [Prometheus](https://prometheus.io/).
|
|
|
|
|
|
|
|
Following metrics will be exported:
|
|
|
|
|
|
|
|
| name | Description |
|
|
|
|
| ------------------------------------------------ | -------------------------------------------------------- |
|
2024-04-08 19:09:51 +02:00
|
|
|
| blocky_denylist_cache / blocky_allowlist_cache | Number of entries in denylist/allowlist cache, partitioned by group |
|
2023-11-22 15:16:19 +01:00
|
|
|
| blocky_error_total | Number of total queries that ended in error for any reason |
|
2021-03-05 08:02:00 +01:00
|
|
|
| blocky_query_total | Number of total queries, partitioned by client and DNS request type (A, AAAA, PTR, etc) |
|
|
|
|
| blocky_request_duration_ms_bucket | Request duration histogram, partitioned by response type (Blocked, cached, etc) |
|
|
|
|
| blocky_response_total | Number of responses, partitioned by response type (Blocked, cached, etc), DNS response code, and reason |
|
|
|
|
| blocky_blocking_enabled | 1 if blocking is enabled, 0 otherwise |
|
|
|
|
| blocky_cache_entry_count | Number of entries in cache |
|
|
|
|
| blocky_cache_hit_count / blocky_cache_miss_count | Cache hit/miss counters |
|
|
|
|
| blocky_prefetch_count | Amount of prefetched DNS responses |
|
|
|
|
| blocky_prefetch_domain_name_cache_count | Amount of domain names being prefetched |
|
2022-01-04 21:24:49 +01:00
|
|
|
| blocky_failed_download_count | Number of failed list downloads |
|
2021-03-05 08:02:00 +01:00
|
|
|
|
2021-09-08 22:03:06 +02:00
|
|
|
### Grafana dashboard
|
2021-03-05 08:02:00 +01:00
|
|
|
|
|
|
|
Example [Grafana](https://grafana.com/) dashboard
|
2024-04-10 19:18:15 +02:00
|
|
|
definition [as JSON](blocky-grafana.json)
|
2021-03-05 08:02:00 +01:00
|
|
|
or [at grafana.com](https://grafana.com/grafana/dashboards/13768)
|
2021-09-08 22:03:06 +02:00
|
|
|
![grafana-dashboard](grafana-dashboard.png).
|
2021-03-05 08:02:00 +01:00
|
|
|
|
|
|
|
This dashboard shows all relevant statistics and allows enabling and disabling the blocking status.
|
|
|
|
|
2021-09-08 22:03:06 +02:00
|
|
|
### Grafana configuration
|
2021-03-05 08:02:00 +01:00
|
|
|
|
|
|
|
Please install `grafana-piechart-panel` and
|
2023-07-06 21:06:46 +02:00
|
|
|
set [disable_sanitize_html](https://grafana.com/docs/grafana/latest/installation/configuration/#disable_sanitize_html)
|
2021-03-05 08:02:00 +01:00
|
|
|
in config or as env to use control buttons to enable/disable the blocking status.
|
|
|
|
|
2021-09-08 22:03:06 +02:00
|
|
|
### Grafana and Prometheus example project
|
2021-03-05 08:02:00 +01:00
|
|
|
|
|
|
|
This [repo](https://github.com/0xERR0R/blocky-grafana-prometheus-example) contains example docker-compose.yml with
|
|
|
|
blocky, prometheus (with configured scraper for blocky) and grafana with prometheus datasource.
|
|
|
|
|
2021-09-08 22:03:06 +02:00
|
|
|
## MySQL / MariaDB
|
|
|
|
|
|
|
|
If database query logging is activated (see [Query logging](configuration.md#query-logging)), you can use following
|
2024-04-10 19:18:15 +02:00
|
|
|
Grafana Dashboard [as JSON](blocky-query-grafana.json)
|
2021-09-08 22:03:06 +02:00
|
|
|
or [at grafana.com](https://grafana.com/grafana/dashboards/14980)
|
|
|
|
|
|
|
|
![grafana-dashboard](grafana-query-dashboard.png).
|
|
|
|
|
|
|
|
Please define the MySQL source in Grafana, which points to the database with blocky's log entries.
|
|
|
|
|
2022-09-19 21:24:52 +02:00
|
|
|
## Postgres
|
|
|
|
|
2024-04-10 19:18:15 +02:00
|
|
|
The JSON for a Grafana dashboard equivalent to the MySQL/MariaDB version is located [here](blocky-query-grafana-postgres.json)
|
2022-09-19 21:24:52 +02:00
|
|
|
|
2021-03-05 08:02:00 +01:00
|
|
|
--8<-- "docs/includes/abbreviations.md"
|