Skip to main content
Community Scripts logo
Skip to Content
Tools & Add-onsAdd-ons

Pi-hole Exporter

Build and run the Prometheus exporter for Pi-hole as a systemd or OpenRC service.

pihole-exporter.sh downloads the eko/pihole-exporter release source, builds it with Go and runs it against one Pi-hole instance.

Run itOn any system that can reach your Pi-hole, usually the Pi-hole container. The script has no Proxmox VE host check
Supported OSDebian, Ubuntu (ID=debian or ID=ubuntu in /etc/os-release) and Alpine. Anything else exits with code 238
Port9617
Sourcetools/addon/pihole-exporter.sh

Run

bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/addon/pihole-exporter.sh)"

Prompts

PromptAnswer
Install Pihole-Exporter? (y/N):y installs. Anything else exits
Enter the protocol to use (http/https), default https:Written as PIHOLE_PROTOCOL. Empty means https
Enter the hostname of Pihole, example: (127.0.0.1):Written as PIHOLE_HOSTNAME. Empty means 127.0.0.1
Enter the port of Pihole, default 443:Written as PIHOLE_PORT. Empty means 443
Enter Pihole password:Hidden input, written as PIHOLE_PASSWORD
Do you want to skip TLS-Verification (if using a self-signed Certificate on Pi-Hole) [y/N]:y sets SKIP_TLS_VERIFICATION="true". Default is false

When /opt/pihole-exporter/pihole-exporter already exists:

PromptAnswer
Uninstall Pihole-Exporter? (y/N):y removes it
Update Pihole-Exporter? (y/N):y updates. Anything else exits with No action selected

What it creates

ItemValue
ToolchainGo through setup_go
Application/opt/pihole-exporter, with the built binary /opt/pihole-exporter/pihole-exporter
Configuration/opt/pihole-exporter.env
Servicepihole-exporter (systemd unit /etc/systemd/system/pihole-exporter.service, or OpenRC script /etc/init.d/pihole-exporter on Alpine, logging to /var/log/pihole-exporter.log), runs as root
Update helper/usr/local/bin/update_pihole-exporter
Metricshttp://<ip>:9617/metrics

The configuration file holds the Pi-hole password in plain text. Restart the service after editing it.

Update

Run update_pihole-exporter, answer y to the update prompt, or let the container's update command offer it (see how update finds add-ons). If a newer release exists, the service is stopped, the source is downloaded and rebuilt, and the service is started. The configuration file lives outside the application directory and is kept.

Remove

The uninstall prompt stops and removes the service and deletes /opt/pihole-exporter, /opt/pihole-exporter.env and the update helper. Go stays installed.

Limits

  • The metrics port is not written to the configuration; 9617 is the address the script prints after the install.