WireGuard has no built-in dashboard and no status page. All it gives you is wg show: a list of peers, how much data each one sent and received, and when each one last completed a handshake.
That's enough to build useful monitoring. With a small exporter, Prometheus can collect those numbers from every server, Grafana can graph them, and alert rules can tell you when something changes.
This guide sets up the most widely used WireGuard exporter, adds alert rules that work for a VPN server with many users, builds a basic Grafana dashboard, and then covers what this setup can't see.
What WireGuard can tell you
Run wg show on a server and you get, per peer:
- latest handshake: when the peer last completed a handshake with the server
- transfer: bytes received from and sent to the peer
- endpoint: the IP and port the peer last connected from
- allowed ips: the tunnel addresses assigned to the peer
That's all. There are no error counters and no "failed connection" events. WireGuard silently ignores packets it can't authenticate, so a client with a wrong key never shows up anywhere. Everything you monitor from the server is based on the peers that did connect.
Step 1: Install the exporter
The most common choice is prometheus_wireguard_exporter, a small Rust program that reads wg show and serves the data as Prometheus metrics on port 9586.
Install it with Cargo:
cargo install prometheus_wireguard_exporter
Or run it with Docker. It needs the host network and the NET_ADMIN capability to read WireGuard's state:
docker run -d --name wg-exporter --net=host --cap-add=NET_ADMIN \
mindflavor/prometheus-wireguard-exporter
To see peer names instead of only public keys, add a comment to each [Peer] in your config:
[Peer]
# friendly_name = office-gateway
PublicKey = ...
AllowedIPs = 10.8.0.10/32
Then point the exporter at the config file with -n:
prometheus_wireguard_exporter -n /etc/wireguard/wg0.conf
Run it as a service
A minimal systemd unit:
[Unit]
Description=Prometheus WireGuard exporter
After=network-online.target
[Service]
ExecStart=/usr/local/bin/prometheus_wireguard_exporter -n /etc/wireguard/wg0.conf
AmbientCapabilities=CAP_NET_ADMIN
CapabilityBoundingSet=CAP_NET_ADMIN
Restart=always
[Install]
WantedBy=multi-user.target
Check that it works:
curl -s localhost:9586/metrics | grep wireguard_
You should see three metric families:
| Metric | What it is |
|---|---|
wireguard_latest_handshake_seconds |
Unix time of the peer's last handshake (0 if never) |
wireguard_received_bytes_total |
Bytes received from the peer |
wireguard_sent_bytes_total |
Bytes sent to the peer |
Each one has labels for the interface, the peer's public key and allowed IPs, plus friendly_name if you set one.
Don't expose port 9586 to the internet. The metrics include every peer's public key and tunnel address. Allow it only from your Prometheus server.
Step 2: Scrape it with Prometheus
Add a job to prometheus.yml, one target per VPN server:
scrape_configs:
- job_name: wireguard
scrape_interval: 30s
static_configs:
- targets:
- vpn-ams-01:9586
- vpn-fra-02:9586
- vpn-sgp-01:9586
For a large or changing fleet, use file-based or cloud service discovery instead of a static list.
Step 3: Alert rules that make sense for a VPN server
The obvious alert, "a peer hasn't had a handshake in 5 minutes", works for a site-to-site tunnel that should always be up. On a VPN server with thousands of users who connect and disconnect all day, it's useless: users going offline isn't a problem.
Peers on an active tunnel complete a new handshake about every two minutes. So a better signal for a VPN server is how many peers had a handshake recently, and whether that number suddenly falls.
First, a recording rule that counts active peers per server:
groups:
- name: wireguard-recording
rules:
- record: wireguard:active_peers
expr: sum by (instance) ((time() - wireguard_latest_handshake_seconds) < bool 180)
Then alerts based on it:
groups:
- name: wireguard-alerts
rules:
- alert: WireGuardExporterDown
expr: up{job="wireguard"} == 0
for: 2m
- alert: WireGuardActivePeersDropped
expr: wireguard:active_peers < 0.5 * (wireguard:active_peers offset 1h) and (wireguard:active_peers offset 1h) > 20
for: 10m
annotations:
summary: "Active peers on {{ $labels.instance }} fell by more than half in an hour"
- alert: WireGuardNoActivePeers
expr: wireguard:active_peers == 0 and (wireguard:active_peers offset 1h) > 5
for: 5m
The > 20 and > 5 conditions stop the alerts from firing on quiet servers, where a few users leaving at night would otherwise look like a big drop. Adjust them to your traffic.
For a tunnel that must always be up, a per-peer alert is still right:
- alert: WireGuardTunnelStale
expr: time() - wireguard_latest_handshake_seconds{friendly_name="office-gateway"} > 300
for: 2m
Step 4: A Grafana dashboard
You can import a ready-made WireGuard dashboard from grafana.com (search for "WireGuard" and pick one built for this exporter), or build a small one yourself. Four panels cover most needs:
| Panel | Query |
|---|---|
| Active peers per server | wireguard:active_peers |
| Traffic in | sum by (instance) (rate(wireguard_received_bytes_total[5m])) |
| Traffic out | sum by (instance) (rate(wireguard_sent_bytes_total[5m])) |
| Top peers by traffic | topk(10, rate(wireguard_sent_bytes_total[5m])) |
Add node_exporter to the same servers and you also get CPU, memory and network interface graphs next to the WireGuard ones, which helps when a server slows down under load.
What this setup can't see
Everything above measures WireGuard from inside the server, based on users who already connected. That leaves real gaps:
- Users who can't connect. WireGuard drops packets it can't authenticate, so failed connections leave no trace. A broken key, a closed firewall port or a routing problem shows up only as fewer active peers, and only if the server was busy before. We cover these failures in WireGuard handshake not working.
- Quiet servers. A server with no users at 4 a.m. looks exactly the same whether it works or not.
- Traffic after the handshake. Peers can complete handshakes while their traffic goes nowhere, because of broken forwarding, NAT or DNS. Handshake metrics stay green. See why ping works but your VPN doesn't.
- Exit IP and leaks. The server can't tell you which IP users appear from, or whether DNS leaks.
- Regional blocking. If WireGuard is blocked in one country, users there never reach the server. Your graphs show a small drop at most. See VPN server blocked in one country.
- MTU problems. Users stay connected while some sites hang, and nothing in the metrics changes. See WireGuard MTU problems.
Server metrics are good for capacity and trends. To know whether a new user can connect right now, from a given region, you need a check from the outside.
Adding the outside view
An outside check runs a real WireGuard client against each server on a schedule, completes the handshake, sends traffic through the tunnel and checks the exit IP. Run from several regions, it catches the failures the exporter can't see, including on servers with no users.
ExitProbe does this from edge probes in multiple regions, with leak detection on every check. It also has a Prometheus metrics endpoint, so its results can go into the same Prometheus and Grafana you just set up. Inside metrics and outside checks then sit side by side on one dashboard, with one set of alert rules.
For the full picture across all protocols, see our complete guide to VPN server monitoring.
Frequently asked questions
Does WireGuard have built-in metrics?
No. It only exposes per-peer handshake times and byte counters through wg show. An exporter such as prometheus_wireguard_exporter turns those into Prometheus metrics.
What port does the WireGuard Prometheus exporter use?
prometheus_wireguard_exporter listens on port 9586 by default. Restrict it to your Prometheus server, because the metrics include peer public keys and tunnel addresses.
How do I alert when a WireGuard tunnel goes down?
For a single always-on tunnel, alert when time() - wireguard_latest_handshake_seconds for that peer goes above about 300 seconds. For a VPN server with many users, alert on a sudden drop in the number of peers with a recent handshake instead.
Can Prometheus tell me if users can connect to my WireGuard server?
Not directly. Server metrics only show peers that already connected. To test whether a new client can connect, run a real WireGuard client against the server from outside, ideally from several regions.
Add the outside view to your dashboards. Start free with ExitProbe and run real WireGuard checks from multiple regions.
Add a server as a monitor and ExitProbe runs the full session from outside, then verifies the exit IP.
