Operations 5 min read

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.

Linux Ops Smart Journey
Linux Ops Smart Journey
Linux Ops Smart Journey
Boost Service Reliability: Deploy Keepalived Exporter with Prometheus & Grafana

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

:

<code>$ curl -LO https://github.com/mehdy/keepalived-exporter/releases/download/v1.4.0/keepalived-exporter_1.4.0_linux_amd64.tar.gz</code>
<code>$ tmpdir=$(mktemp -d)
$ tar xvf keepalived-exporter_1.4.0_linux_amd64.tar.gz -C ${tmpdir}
$ sudo mv ${tmpdir}/keepalived-exporter /usr/local/bin/</code>

Create a systemd service file and start the exporter:

<code>$ 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 --now</code>

Clean up temporary files:

<code>$ rm -rf ${tmpdir}</code>

2. Prometheus Collect keepalived Metrics

Edit the Prometheus ConfigMap to add a job for the exporter:

<code>$ kubectl -n kube-system edit cm prometheus
    - job_name: "keepalived-exporter"
      static_configs:
      - targets:
        - "172.139.20.81:9165"
        - "172.139.20.177:9165"</code>

Verify collection success:

<code>$ 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"]}]}}</code>

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

Grafana dashboard example
Grafana dashboard example
Grafana panel view
Grafana panel view

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.

Monitoringhigh availabilityPrometheusGrafanakeepalived
Linux Ops Smart Journey
Written by

Linux Ops Smart Journey

The operations journey never stops—pursuing excellence endlessly.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.