Boost Service Reliability: Deploy Keepalived Exporter with Prometheus & Grafana
Learn how to enhance network service high availability by installing Keepalived Exporter, configuring Prometheus to collect its metrics, and adding a Grafana dashboard, with step‑by‑step commands and tips for a robust monitoring solution suitable for enterprises of any size.
Introduction
In modern enterprises, high availability and stability of network services are critical for business success. Any service interruption can cause customer loss and financial damage. Keepalived offers powerful fault detection, failover, and an enterprise‑grade monitoring panel to improve service reliability.
1. Deploy keepalived_exporter
Download the release package, extract the binary, and move it to /usr/local/bin:
$ curl -LO https://github.com/mehdy/keepalived-exporter/releases/download/v1.4.0/keepalived-exporter_1.4.0_linux_amd64.tar.gz $ tmpdir=$(mktemp -d)
$ tar xvf keepalived-exporter_1.4.0_linux_amd64.tar.gz -C ${tmpdir}
$ sudo mv ${tmpdir}/keepalived-exporter /usr/local/bin/Create a systemd service file and start the exporter:
$ cat <<'EOF' | sudo tee /usr/lib/systemd/system/keepalived_exporter.service > /dev/null
[Unit]
Description=keepalived_exporter
Documentation=https://github.com/mehdy/keepalived-exporter
Wants=network.service
After=network.service
[Service]
Type=simple
Environment=PATH=/app/keepalived/sbin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
ExecStart=/usr/local/bin/keepalived-exporter -ka.pid-path /app/keepalived/keepalived.pid
ExecStop=/bin/kill -s SIGTERM $MAINPID
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
$ sudo systemctl daemon-reload
$ sudo systemctl enable keepalived_exporter --nowClean up temporary files:
$ rm -rf ${tmpdir}2. Prometheus Collect keepalived Metrics
Edit the Prometheus ConfigMap to add a job for the exporter:
$ kubectl -n kube-system edit cm prometheus
- job_name: "keepalived-exporter"
static_configs:
- targets:
- "172.139.20.81:9165"
- "172.139.20.177:9165"Verify collection success:
$ curl -s $(kubectl -n kube-system get svc prometheus -ojsonpath='{.spec.clusterIP}:{.spec.ports[0].port}')/prometheus/api/v1/query --data-urlencode 'query=up{job="keepalived-exporter"}'
{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","instance":"172.139.20.177:9165","job":"keepalived-exporter"},"value":[1732258069.124,"1"]},{"metric":{"__name__":"up","instance":"172.139.20.81:9165","job":"keepalived-exporter"},"value":[1732258069.124,"1"]}]}}3. Add Keepalived Panel to Grafana
Import the official Keepalived exporter dashboard from GitHub:
Dashboard JSON URL: https://github.com/mehdy/keepalived-exporter/blob/master/grafana/dashboards/keepalived-exporter.json
Conclusion
By using the Keepalived monitoring panel, enterprises can easily achieve high availability and stability of network services, ensuring business continuity. Whether large or small, organizations benefit from Keepalived’s powerful features, and as the technology evolves, it will continue to provide smarter, more efficient HA solutions.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Linux Ops Smart Journey
The operations journey never stops—pursuing excellence endlessly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
