InfluxDB and Grafana are your best friends for understanding what’s really happening with your Pi-hole.

Let’s see Pi-hole in action. Imagine you’ve got a simple setup: your Pi-hole is running on a Raspberry Pi at 192.168.1.100. You’ve installed InfluxDB and Grafana on a separate machine, say 192.168.1.200.

First, you need to get Pi-hole to send its data to InfluxDB. You’ll edit Pi-hole’s configuration file, usually /etc/pihole/pihole-FTL.conf (or /etc.pihole/FTL.conf on older versions). Add these lines:

INFLUXDB_HOST=192.168.1.200
INFLUXDB_PORT=8086
INFLUXDB_DB=pihole
INFLUXDB_USER=pihole
INFLUXDB_PASS=your_influxdb_password

Make sure your_influxdb_password matches the password you set up for the pihole user in InfluxDB. If you haven’t created a user and database yet, you’ll do that in InfluxDB. For example, using the InfluxDB CLI:

influx
> CREATE DATABASE pihole
> CREATE USER pihole WITH PASSWORD 'your_influxdb_password'
> GRANT ALL PRIVILEGES ON pihole TO pihole
> QUIT

After editing pihole-FTL.conf, restart the FTL service:

sudo systemctl restart pihole-FTL

Now, InfluxDB is receiving DNS query data, blocked queries, and other metrics from your Pi-hole.

Next, Grafana needs to connect to InfluxDB and visualize this data. In Grafana, go to "Configuration" -> "Data Sources" and click "Add data source". Select "InfluxDB".

For the settings:

  • URL: http://192.168.1.200:8086
  • Database: pihole
  • User: pihole
  • Password: your_influxdb_password
  • InfluxDB Details -> Version: 1.x (if you’re using InfluxDB v1.x, which is common with older Pi-hole setups. If you’re on v2.x, you’ll need to adjust authentication and potentially the query language).

Save and test the connection.

Once connected, you’ll want to import a pre-made Pi-hole dashboard. You can find excellent ones on the Grafana Dashboards website. Search for "Pi-hole". A popular one might have an ID like 10650 (though IDs change, search for "Pi-hole" on grafana.com/grafana/dashboards).

In Grafana, go to "Dashboards" -> "Import". Enter the dashboard ID and click "Load". On the next screen, select your InfluxDB data source that you just configured. Click "Import".

You’ll now see a dashboard with panels showing:

  • Total queries over time
  • Blocked queries over time
  • Top clients making requests
  • Top domains being queried
  • DNSSEC status
  • DHCP leases (if enabled on Pi-hole)

This setup allows you to track trends, identify noisy clients, and see your Pi-hole’s effectiveness in blocking ads and trackers. You can drill down into specific time ranges, see real-time query rates, and even set up alerts if certain thresholds are breached (e.g., a sudden spike in blocked queries that might indicate a new, aggressive ad campaign).

The surprising thing is how much granular detail Pi-hole exposes through FTL and how readily it integrates with standard time-series databases. It’s not just a black box that blocks; it’s a transparent system you can deeply inspect.

Each panel in Grafana runs a specific InfluxQL query against your InfluxDB. For instance, to show total queries, a query might look like:

SELECT non_negative_derivative(mean("dns_queries_total"), 1s) FROM "pihole" WHERE $timeFilter GROUP BY time($__interval) fill(null)

This query asks InfluxDB to calculate the rate of change for the dns_queries_total metric over 1-second intervals, averaged over the time range selected in Grafana ($timeFilter), and then grouped by Grafana’s interval ($__interval).

The real power comes when you start customizing. You can add panels that show the percentage of blocked queries, or the ratio of IPv4 to IPv6 queries. You can even correlate Pi-hole’s data with network traffic data from other sources if you have them, to get a complete picture of your network’s DNS activity.

When you’re setting up alerts in Grafana, you’ll often use the same query language (InfluxQL or Flux, depending on your InfluxDB version) to define the conditions. For example, to alert if blocked queries exceed 100 per minute for 5 consecutive minutes, you’d write a query that aggregates blocked queries over a minute and then use Grafana’s alert conditions to check if that aggregate value is consistently above 100.

The next step is often to explore how to use Pi-hole’s API in conjunction with InfluxDB and Grafana, perhaps to trigger actions based on dashboard data or to enrich the data being sent.

Want structured learning?

Take the full Pihole course →