1
0
Fork 0
mirror of https://github.com/cafebazaar/keepalived-exporter.git synced 2025-12-16 05:43:54 +00:00
No description
Find a file
Seena Fallah 8cf2a9003d
Merge pull request #211 from clwluvw/slog
refactor: move from logrus to slog
2025-05-30 15:16:58 +02:00
.github Optimize workflow runs 2025-05-18 20:36:47 +02:00
cmd/keepalived-exporter refactor: move from logrus to slog 2025-05-30 15:16:04 +02:00
deployments/dev build: add kos integreation to goreleaser 2025-04-19 17:44:57 +02:00
grafana/dashboards grafana: compatible dashboard with new versions 2023-02-02 10:43:33 +01:00
internal refactor: move from logrus to slog 2025-05-30 15:16:04 +02:00
test_files feat: add excluded vip support (#114) 2023-04-19 22:16:25 +02:00
.gitignore build: add goreleaser configuration 2023-04-02 11:15:05 +02:00
.golangci.yml ci: update golangci-lint to v2.0.0 2025-03-24 19:42:09 +01:00
.goreleaser.yaml build: omit any additional to image name 2025-05-20 00:22:28 +02:00
docker-compose.yml build: fix deprecation in docker 2025-05-27 22:46:22 +02:00
Dockerfile build: fix deprecation in docker 2025-05-27 22:46:22 +02:00
go.mod refactor: move from logrus to slog 2025-05-30 15:16:04 +02:00
go.sum refactor: move from logrus to slog 2025-05-30 15:16:04 +02:00
LICENSE Create LICENSE 2020-02-24 19:09:44 +03:30
Makefile build: remove obsolete release file cleanup 2025-05-29 19:28:41 +02:00
README.md doc: update keepavlied docker mode with pid mode 2025-05-27 22:46:22 +02:00

Keepalived Exporter

Continuous Integration

Prometheus exporter for Keepalived metrics.

Installation

Debian/Ubuntu

Download the latest release from here and install it using dpkg

dpkg -i keepalived-exporter-downloaded-pkg.deb

RedHat/CentOS

Download the latest release from here and install it using rpm

rpm -i keepalived-exporter-downloaded-pkg.rpm

Binary releases

export VERSION=1.3.2
wget https://github.com/mehdy/keepalived-exporter/releases/download/v${VERSION}/keepalived-exporter-${VERSION}.linux-amd64.tar.gz
tar xvzf keepalived-exporter-${VERSION}.linux-amd64.tar.gz keepalived-exporter-${VERSION}.linux-amd64/keepalived-exporter
sudo mv keepalived-exporter-${VERSION}.linux-amd64/keepalived-exporter /usr/local/bin/

From source

git clone --depth 1 https://github.com/mehdy/keepalived-exporter.git
cd keepalived-exporter
make build
sudo mv keepalived-exporter /usr/local/bin/

Usage

Run keepalived-exporter

sudo keepalived-exporter [flags]

Help on flags

./keepalived-exporter --help
Name Description
web.listen-address Address to listen on for web interface and telemetry, defaults to :9165.
web.telemetry-path A path under which to expose metrics, defaults to /metrics.
ka.json Send SIGJSON and decode JSON file instead of parsing text files, defaults to false.
ka.pid-path A path for Keepalived PID, defaults to /var/run/keepalived.pid.
cs Health Check script path to be execute for each VIP.
container-name Keepalived container name to export metrics from Keepalived container.
container-tmp-dir Keepalived container tmp volume path, defaults to /tmp.

Note: For ka.json option requirement is to have Keepalived compiled with --enable-json configure option.

Keepalived on Docker and Keepalived Exporter on host

Set the --container-name to the Keepalived container name and set --container-tmp-dir to the Keepalived /tmp dir path that is volumed to the host

./keepalived-exporter --container-name keepalived --container-tmp-dir /tmp

Keepalived and Keepalived Exporter on docker

We support two methods to signal keepalived running in a container.

Using Docker Signal

This is when the keepalived is running with PID 1 in the container so we can use the standard docker API to send signal to the keepalived process.

Volume docker socket (/var/run/docker.sock) to Keepalived Exporter cotnainer in the same path and pass the args like as using Keepalived on container

docker pull ghcr.io/mehdy/keepalived-exporter
docker run -v keepalived-data:/tmp/ ... $KEEPALIVED_IMAGE
docker run -v /var/run/docker.sock:/var/run/docker.sock -v keepalived-data:/tmp/keepalived-data:ro -p 9165:9165 ghcr.io/mehdy/keepalived-exporter --container-name keepalived --container-tmp-dir "/tmp/keepalived-data"

Exec to container with PID path

In case the keepalived process is not running with PID 1, this method will exec to the container and use the provided PID path to send the signal.

docker pull ghcr.io/mehdy/keepalived-exporter
docker run -v keepalived-data:/tmp/ -v keepalived-pid:/var/run/ ... $KEEPALIVED_IMAGE
docker run -v /var/run/docker.sock:/var/run/docker.sock -v keepalived-data:/tmp/keepalived-data:ro -v keepalived-pid:/var/run/:ro -p 9165:9165 ghcr.io/mehdy/keepalived-exporter --container-name keepalived --container-tmp-dir "/tmp/keepalived-data" --ka.container.pid-path "/var/run/keepalived.pid"

Metrics

Metric Notes
keepalived_exporter_build_info Exporter build info
keepalived_up Status of Keepalived service
keepalived_vrrp_state State of vrrp
keepalived_vrrp_excluded_state State of vrrp with excluded VIP
keepalived_exporter_check_script_status Check Script status for each VIP
keepalived_gratuitous_arp_delay_total Gratuitous ARP delay
keepalived_advertisements_received_total Advertisements received
keepalived_advertisements_sent_total Advertisements sent
keepalived_become_master_total Became master
keepalived_release_master_total Released master
keepalived_packet_length_errors_total Packet length errors
keepalived_advertisements_interval_errors_total Advertisement interval errors
keepalived_ip_ttl_errors_total TTL errors
keepalived_invalid_type_received_total Invalid type errors
keepalived_address_list_errors_total Address list errors
keepalived_authentication_invalid_total Authentication invalid
keepalived_authentication_mismatch_total Authentication mismatch
keepalived_authentication_failure_total Authentication failure
keepalived_priority_zero_received_total Priority zero received
keepalived_priority_zero_sent_total Priority zero sent
keepalived_script_status Tracker Script Status
keepalived_script_state Tracker Script State

Check Script

You can specify a check script like Keepalived script check to check if all the things is okay or not. The script will run for each VIP and gives an arg $1 that contains VIP.

Note: The script should be executable.

chmod +x check_script.sh

Sample Check Script

#!/usr/bin/env bash

ping $1 -c 1 -W 1