Git Product home page Git Product logo

keepalived-exporter's Introduction

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

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"

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

keepalived-exporter's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

keepalived-exporter's Issues

Add old version Keepalived v1.3.5

ip_address is determined incorrectly
keepalived_vrrp_state{environment="PROD", iname="gql_5111", instance="server01", intf="ens192", ip_address="10.72.63.100/32", job="keepalived", vrid="100"}

cat /tmp/keepalived.data
------< VRRP Topology >------
VRRP Instance = gql_5111
VRRP Version = 2
State = MASTER
Last transition = 1698874220 (Thu Nov 2 00:30:20 2023)
Listening device = ens192
Using src_ip = 10.72.63.101
Gratuitous ARP delay = 5
Gratuitous ARP repeat = 5
Gratuitous ARP refresh = 0
Gratuitous ARP refresh repeat = 1
Gratuitous ARP lower priority delay = 5
Gratuitous ARP lower priority repeat = 5
Send advert after receive lower priority advert = true
Send advert after receive higher priority advert = false
Virtual Router ID = 100
Priority = 110
Advert interval = 1 sec
Accept = enabled
Preempt = enabled
Promote_secondaries = disabled
Authentication type = SIMPLE_PASSWORD
Password = 1111
Tracked scripts = 1
VRRP Script = chk_nginx_service
Command = /usr/sbin/pidof nginx
Interval = 2 sec
Weight = -10
Rise = 1
Full = 1
Insecure = no
uid:gid = 0:0
Status = GOOD
Interface weight -10
Virtual IP = 1
10.72.63.100/32 dev ens192 scope global

cat /tmp/keepalived.stats
VRRP Instance: gql_5111
Advertisements:
Received: 293
Sent: 25349905
Became master: 54
Released master: 53
Packet Errors:
Length: 0
TTL: 0
Invalid Type: 0
Advertisement Interval: 0
Address List: 0
Authentication Errors:
Invalid Type: 0
Type Mismatch: 0
Failure: 0
Priority Zero:
Received: 0
Sent: 0

Support keepalived < 1.3.8

The collector use --signum to determine which signal to send to keepalived in order to retrieve stats/data. From keepalived release notes, this parameter has been added in version 1.3.8.

Unfortunately, the only version available in RHEL 7 and derivatives is 1.3.5. It seems that for this versions, the expected signals are USR1 for data, and USR2 for stats.

Would it be possible to add a failback to these signals if --signum is not supported ?

The exporter does not get any metrics

Hello,

I installed the exporter using the binary into /srv/ directory and I am using Keepalived v2.0.19 (10/19,2019) on Ubuntu Focal.

When I execute the exporter using a dedicated user, the exporter can't get any metrics :

# service keepalived-exporter status
systemd[1]: Started Keepalived Exporter Server.
keepalived-exporter[102339]: time="2021-02-17T08:40:18+01:00" level=info msg="Listening on address: :9165"
keepalived-exporter[102339]: time="2021-02-17T08:40:35+01:00" level=error msg="Failed to send signal" error="operation not permitted" pid=74793
keepalived-exporter[102339]: time="2021-02-17T08:40:35+01:00" level=error msg="Failed to send STATS signal to keepalived" error="operation not permitted"
keepalived-exporter[102339]: time="2021-02-17T08:40:35+01:00" level=error msg="No data found to be exported" error="operation not permitted" json=false

When I execute the exporter as root, I get the following error :

/srv/keepalived-exporter-1.0.0.linux-amd64# ./keepalived-exporter
INFO[0000] Listening on address: :9165
panic: runtime error: index out of range [2] with length 1

goroutine 32 [running]:
github.com/cafebazaar/keepalived-exporter/internal/collector.(*KeepalivedCollector).Collect(0xc000080910, 0xc0000b1560)
	/home/seena/storage/keepalived-exporter/internal/collector/collector.go:151 +0x29ef
github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
	/home/seena/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:444 +0x19d
created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
	/home/seena/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:536 +0xe36

Do you have any idea of how I can fix this?

Thanks.
Kind regards,
Christian

Exporter not working when keepalived container init doesn't handle keepalived signals

Currently, if docker mode is enabled, this exporter first checks signal numbers, by executing command in container: docker exec "${container-name}" keepalived --signum [STATS|DATA]. Related lines: https://github.com/cafebazaar/keepalived-exporter/blob/master/internal/types/container/keepalived_container_collector_host.go#L76-L104

It then uses those signal numbers to send them through docker to process with PID1 inside the container `docker kill : https://github.com/cafebazaar/keepalived-exporter/blob/master/internal/types/container/keepalived_container_collector_host.go#L106-L117

This unfortunately fails with osixia keepalived docker image, because it's init script doesn't relay these signals to keepalived instances it spawns osixia/docker-keepalived#50. While I believe this should be fixed in the keepalived image itself, maybe it could be considered to be handled in the exporter. I've chosen to use that docker image, because it seems most up to date.

The fix for this seems relatively simple - instead of running docker kill --signal 12 keepalived, one could run docker exec keepalived sh -c 'kill -12 "$( cat /var/run/keepalived.pid )"'. Of course this assumes that sh exists, so would probably require it to be a separate command line argument to switch between these 2 behaviors.

keepalived_vrrp_state

From your documentation, it says that keepalived_vrrp_state is supported, however, i don't see it being part of the metrics.
Is this the case or it is just on my implementation?

No keepalived_vrrp_state on Alpine

Running keepalived-exporter v1.2.0 on Alpine 3.16.2 doesn't return the keepalived_vrrp_state metric:

$ curl http://localhost:9165/metrics | grep keepalived | grep -v "#"
keepalived_advertisements_interval_errors_total{iname="loadbalancer",intf="eth0",state="MASTER",vrid="100"} 0
keepalived_advertisements_received_total{iname="loadbalancer",intf="eth0",state="MASTER",vrid="100"} 3
keepalived_advertisements_sent_total{iname="loadbalancer",intf="eth0",state="MASTER",vrid="100"} 390
keepalived_authentication_failure_total{iname="loadbalancer",intf="eth0",state="MASTER",vrid="100"} 0
keepalived_authentication_invalid_total{iname="loadbalancer",intf="eth0",state="MASTER",vrid="100"} 0
keepalived_authentication_mismatch_total{iname="loadbalancer",intf="eth0",state="MASTER",vrid="100"} 0
keepalived_become_master_total{iname="loadbalancer",intf="eth0",state="MASTER",vrid="100"} 1
keepalived_gratuitous_arp_delay_total{iname="loadbalancer",intf="eth0",state="MASTER",vrid="100"} 5
keepalived_invalid_type_received_total{iname="loadbalancer",intf="eth0",state="MASTER",vrid="100"} 0
keepalived_ip_ttl_errors_total{iname="loadbalancer",intf="eth0",state="MASTER",vrid="100"} 0
keepalived_packet_length_errors_total{iname="loadbalancer",intf="eth0",state="MASTER",vrid="100"} 0
keepalived_priority_zero_received_total{iname="loadbalancer",intf="eth0",state="MASTER",vrid="100"} 0
keepalived_priority_zero_sent_total{iname="loadbalancer",intf="eth0",state="MASTER",vrid="100"} 0
keepalived_release_master_total{iname="loadbalancer",intf="eth0",state="MASTER",vrid="100"} 0
keepalived_up 1

exporter exited after curl

base on the README I started the keepalived-exporter with this command:
sudo keepalived-exporter
and it began to listen on port 9165.
then I curled curl localhost:9165/metrics
but the keepalived-exporter exited with these errors:

INFO[0000] Listening on address: :9165                  
panic: runtime error: index out of range [2] with length 1

goroutine 22 [running]:
github.com/cafebazaar/keepalived-exporter/internal/collector.(*KeepalivedCollector).Collect(0xc000066910, 0xc00005d5c0)
	/home/seena/storage/keepalived-exporter/internal/collector/collector.go:151 +0x29ef
github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
	/home/seena/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:444 +0x19d
created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
	/home/seena/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:536 +0xe36

Keepalived Exporter stuck

In some cases when there is many prometheus to collect data from one exporter Keepalived Exporter will stuck.
I tried to reproduce this case with three prometheus to collect data with interval of 10s but it works!

Testing version: v0.1.1 Beta 1

Failed to parse VIP from keepalived data

Hi we have a two node keepalived cluster setup bevor haproxy. We are monitoring all components with prometheus and grafana and wanted to have the same for keepalived. That is we decided to try your solution.
We have downloaded the newest version of keepalived-exporter (1.0.1) and installed it on our server. After starting it we are getting the following message on the /metrics REST:

An error has occurred while serving metrics:

collected metric "keepalived_vrrp_state" { label:<name:"iname" value:"VI_1" > label:<name:"intf" value:"ens192" > label:<name:"ip_address" value:"141.249.3.160/32" > label:<name:"vrid" value:"52" > gauge:<value:2 > } was collected before with the same name and label values

On the console we are getting the following message:

sudo ./keepalived-exporter 
INFO[0000] Listening on address: :9165                  
ERRO[0008] Failed to parse VIP from keepalived data      VIP=1

Keepalived version:

Keepalived v2.0.10 (11/12,2018)

Our keepalived config:

node1:

! Configuration File for keepalived
global_defs {
    notification_email {
               [email protected]
                [email protected]
        }
smtp_server mail.server.com

}
vrrp_script chk_service {           # Requires keepalived-1.1.13
        script "/usr/bin/killall -0 haproxy"    # cheaper than pidof
        interval 2                      # check every 2 seconds
}
vrrp_instance VI_1 {
    state MASTER
    interface ens192
    virtual_router_id 52
        priority 50

    virtual_ipaddress {
        141.249.3.160
    }
    track_script {
        chk_service
    }
}

node2

! Configuration File for keepalived
global_defs {
    notification_email {
               [email protected]
                [email protected]
        }
smtp_server mail.server.com

}
vrrp_script chk_service {           # Requires keepalived-1.1.13
        script "/usr/bin/killall -0 haproxy"    # cheaper than pidof
        interval 2                      # check every 2 seconds
}
vrrp_instance VI_1 {
    state SLAVE
    interface ens192
    virtual_router_id 52
        priority 50
       
    virtual_ipaddress {
        141.249.3.160 
    }
    track_script {
        chk_service
    }
}

Do you have any advice what the problem could be?

Many thanks in advance
Attila

keepalived.data and keepalived.stats datas are not synced error

with old version (Keepalived v1.3.9 on Ubuntu 2018), the following error occured in random way and the metric keepalived_up is set to 0 but in fact the keepalived is running properly:

keepalived_exporter[80560]: time="2023-04-14T15:52:37+02:00" level=error msg="keepalived.data and keepalived.stats datas are not synced"

It's possible to just warn this error to support old version too ?

collector.go

if len(vrrpData) != len(vrrpStats) {
	logrus.Warn("keepalived.data and keepalived.stats datas are not synced: ", len(vrrpData), len(vrrpStats))
	// return nil, errors.New("keepalived.data and keepalived.stats datas are not synced")
}

if len(vrrpData) == len(vrrpStats) {
...
}

Exporter crashes while it is running

I am catching a follow panic. Version of exporter is 1.0.0

panic: runtime error: index out of range [2] with length 1

goroutine 31 [running]:
github.com/cafebazaar/keepalived-exporter/internal/collector.(*KeepalivedCollector).Collect(0xc0000b48c0, 0xc0000ad500)
        /home/seena/storage/keepalived-exporter/internal/collector/collector.go:151 +0x29ef
github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1()
        /home/seena/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:444 +0x19d
created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather
        /home/seena/go/pkg/mod/github.com/prometheus/[email protected]/prometheus/registry.go:536 +0xe36

My keepalived version is

Keepalived v2.2.4 (08/21,2021)

Occasional wrong result keepalived_up=0

Occasionally the exporter returns no keepalived metrics and keepalived_up = 0 even though the keepalived works fine.
In the exporter log there are lines

level=error msg="keepalived.data and keepalived.stats datas are not synced"
level=error msg="No data found to be exported" error="keepalived.data and keepalived.stats datas are not synced"

keepalived-exporter version 1.2.0 on Ubuntu 18.04.5 LTS,
keepalived version is 1.3.9 without support for JSON output, so stats/data is used.

One explanation could be that keepalived takes too long to write the stats or data file after the SIGSTATS/SIGDATA signal. Waiting 10 ms as in keepalived_container_collector_host.go:115 may not always be enough.

Multiple IPv4 interfaces with keepalived erroring out.

Hi ,
I have two virtual ipv4 interfaces (internal and external network). I am running the keepalived-exporter as a service . It works absolutely fine when there's just one interface. But with two interfaces, I am getting the following error when doing curl:

$ curl http://x.x.x.x:9165/metrics
An error has occurred while serving metrics:

collected metric "keepalived_script_status" { label:<name:"name" value:"chk_haproxy" > gauge:<value:1 > } was collected before with the same name and label values

---------- keepalived.conf-----------

vrrp_script chk_haproxy {
  script "/usr/bin/pgrep haproxy"
  interval 2 # every 2 seconds
  weight 2 # add 2 points if OK
}

vrrp_instance VI4_1 {
  interface eth0 

vrrp_instance VI4_2 {
  interface eth1 # interface to monitor

Should I change the internal code someplace so that it takes just one of the vrrp_instance instead ?

Make dump files thread safe

In a case of using 3 or more prometheus for HA and requesting at a same time Keepalived Exporter should make created files in /tmp thread safe.

The exporter requires to run as "root" to work

If I run it as a non root user, I get this error

prometheus@pgsyncslave:/home/sosuna/keepalived-exporter-1.0.0.linux-amd64$ curl localhost:9165/metrics
ERRO[0010] Failed to send signal                         error="operation not permitted" pid=12008
ERRO[0010] Failed to send STATS signal to keepalived     error="operation not permitted"
ERRO[0010] No data found to be exported                  error="operation not permitted" json=false

And the only metric returned is

keepalived_up 0

If I run it as "root" instead, the exporter works just fine. But obviously I don't wanna run it as root...

[Question] - Next release

Do you have a release date for v1.3.0 ?
As this release will include fix for keepalived_vrrp_state on keepalived v2.2.7 #88

Cannot start exporter

Hi
When I try to run the exporter, I get this fatal error
FATA[0000] Error getting signum error="exit status 1" signal=JSON

keepalived --signum=DATA
10
 keepalived --version
Keepalived v2.2.7 (01/16,2022)

Copyright(C) 2001-2022 Alexandre Cassen, <[email protected]>

Built with kernel headers for Linux 3.10.0
Running on Linux 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021
Distro: CentOS Linux 7 (Core)

configure options:

Config options:  LVS VRRP VRRP_AUTH VRRP_VMAC OLD_CHKSUM_COMPAT INIT=systemd

System options:  VSYSLOG RTA_ENCAP RTA_EXPIRES RTA_PREF FRA_SUPPRESS_PREFIXLEN FRA_TUN_ID RTAX_CC_ALGO RTAX_QUICKACK RTA_VIA IFA_FLAGS NET_LINUX_IF_H_COLLISION LIBIPTC_LINUX_NET_IF_H_COLLISION IFLA_LINK_NETNSID GLOB_BRACE GLOB_ALTDIRFUNC INET6_ADDR_GEN_MODE SO_MARK

keepalived 2.0.X

Using keepalived 2.0.X results in:

ERRO[0000] Failed to parse keepalived version output     output=
WARN[0000] Version detection failed. Assuming it's the latest one.  error="Failed to parse keepalived version output"
FATA[0000] Error parsing signum result                   error="strconv.ParseInt: parsing \"10\\n\": invalid syntax" signal=DATA signum="10\n"

keepalived -version output:

Keepalived v2.0.10 (11/12,2018)

Copyright(C) 2001-2018 Alexandre Cassen, <[email protected]>

Built with kernel headers for Linux 4.18.20
Running on Linux 5.4.77-v8+ #1371 SMP PREEMPT Tue Nov 17 13:39:18 GMT 2020

configure options: --build=aarch64-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libdir=${prefix}/lib/aarch64-linux-gnu --libexecdir=${prefix}/lib/aarch64-linux-gnu --runstatedir=/run --disable-maintainer-mode --disable-dependency-tracking --with-kernel-dir=debian/ --enable-snmp --enable-sha1 --enable-snmp-rfcv2 --enable-snmp-rfcv3 --enable-dbus --enable-dbus-create-instance --enable-json --enable-bfd build_alias=aarch64-linux-gnu CFLAGS=-g -O2 -fdebug-prefix-map=/build/keepalived-9m3AHp/keepalived-2.0.10=. -fstack-protector-strong -Wformat -Werror=format-security LDFLAGS=-Wl,-z,relro CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2

Config options:  LIBIPSET_DYNAMIC LVS VRRP VRRP_AUTH JSON BFD OLD_CHKSUM_COMPAT FIB_ROUTING SNMP_V3_FOR_V2 SNMP_VRRP SNMP_CHECKER SNMP_RFCV2 SNMP_RFCV3 DBUS DBUS_CREATE_INSTANCE

System options:  PIPE2 SIGNALFD INOTIFY_INIT1 VSYSLOG EPOLL_CREATE1 IPV4_DEVCONF LIBNL3 RTA_ENCAP RTA_EXPIRES RTA_NEWDST RTA_PREF FRA_SUPPRESS_PREFIXLEN FRA_SUPPRESS_IFGROUP FRA_TUN_ID RTAX_CC_ALGO RTAX_QUICKACK RTEXT_FILTER_SKIP_STATS FRA_L3MDEV FRA_UID_RANGE RTAX_FASTOPEN_NO_COOKIE RTA_VIA FRA_OIFNAME FRA_PROTOCOL FRA_IP_PROTO FRA_SPORT_RANGE FRA_DPORT_RANGE RTA_TTL_PROPAGATE IFA_FLAGS IP_MULTICAST_ALL LWTUNNEL_ENCAP_MPLS LWTUNNEL_ENCAP_ILA LIBIPTC LIBIPSET_PRE_V7 LIBIPVS_NETLINK IPVS_DEST_ATTR_ADDR_FAMILY IPVS_SYNCD_ATTRIBUTES IPVS_64BIT_STATS VRRP_VMAC SOCK_NONBLOCK SOCK_CLOEXEC O_PATH GLOB_BRACE INET6_ADDR_GEN_MODE VRF SO_MARK SCHED_RT SCHED_RESET_ON_FORK

exporter build: master branch

error running the binary

Downloaded version 1.0.3
OS: Red Hat Enterprise Linux Server release 7.9 (Maipo)

./keepalived-exporter
FATA[0000] Error unmarshalling signum result error="unexpected end of JSON input" signal=DATA

Thanks

/tmp/keepalived.data not created

Hello,
in the latest version of the exporter (1.3.1) the file /tmp/keepalived.data is not created automatically by the exporter, and it complains that the file doesn't exist.

keepalived-exporter time="2023-07-25T14:11:39Z" level=error msg="No data found to be exported" error="open /tmp/keepalived.data: no such file or directory"

keepalived-exporter time="2023-07-25T14:12:37Z" level=error msg="failed to open Script VRRP file" error="open /tmp/keepalived.data: no such file or directory" fileName=/tmp/keepalived.data

It works after I add the file manually (touch /tmp/keepalived.data)

Can you please have a look?

By the way the version is not correctly showing:

/keepalived-exporter -version
INFO[0000] Keepalived Exporter                           build_time= commit= version=

keepalived_vrrp_state value doesn't update

Hello, when i stop the keepalived service on my primary server (keepalived-01), the value of old master stay on 2 on grafana, but i would like to change in 0 for became in fault state. How to do it ?

image

Recurring warning about unkown script state with keepalived 1.3.5

Running keepalived-exporter 1.1.0 with keepalived 1.3.5 returns a recurring warning in the logs :

keepalived-exporter: time="2020-10-23T15:40:13+02:00" level=warning msg="Unknown state" name=node_status state=

It seems that the exporter tries to get the script state here : https://github.com/cafebazaar/keepalived-exporter/blob/7f70713c5b9d41121339e7e5195f91df9147fb1d/internal/collector/collector.go#L176

However, keepalived 1.3.5 does not expose this information in the data, only the status.

The warning can be safely ignored, but spam the logs with false positives.

Cannot start exporter: unexpected end of JSON input

Hi
When I try to run the exporter, I get this fatal error:

FATA[0000] Error unmarshalling signum result             error="unexpected end of JSON input" signal=DATA

I'm using version 1.0.3 of the exporter on centos7 and keepalived version 1.3.5

"Failed to open /tmp/keepalived.stats"

keeplaived version 1.3.5 - 1.3.9 (one host in 1.3.9 and 2 other in 1.3.5).

I have deployed keepalived-exporter as a service using the keepalived-exporter binary from the tar file on our keepalived/haproxy hosts.

systemctl status keepalived-exporter
● keepalived-exporter.service - Keepalived Exporter
   Loaded: loaded (/usr/lib/systemd/system/keepalived-exporter.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2021-06-29 17:03:58 UTC; 5h 18min ago
 Main PID: 3750 (keepalived-expo)
   CGroup: /system.slice/keepalived-exporter.service
           └─3750 /usr/local/bin/keepalived-exporter

journalctl -u keepalived-exporter

Jun 29 15:45:41 welktx08labidms-l-fr-idms-00-hap-000 keepalived-exporter[6378]: time="2021-06-29T15:45:41Z" level=error msg="Failed to open /tmp/keepalived.stats" er
ror="open /tmp/keepalived.stats: no such file or directory"
Jun 29 15:45:41 welktx08labidms-l-fr-idms-00-hap-000 keepalived-exporter[6378]: time="2021-06-29T15:45:41Z" level=error msg="No data found to be exported" error="ope
n /tmp/keepalived.stats: no such file or directory"
Jun 29 15:46:11 welktx08labidms-l-fr-idms-00-hap-000 keepalived-exporter[6378]: time="2021-06-29T15:46:11Z" level=error msg="Failed to open /tmp/keepalived.stats" er
ror="open /tmp/keepalived.stats: no such file or directory"

/tmp permission:
drwxrwxrwt. 10 root root 243 Jun 29 22:21 tmp

Because of this missing keepalived.data file, we are not able to get the keepalived metrics even when the scrape is happening on correct port using endpoints.

curl http://localhost:9165/metrics | grep keepalived
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  6240    0  6240    0     0   324k      0 --:--:-- --:--:-- --:--:--  338k
# HELP keepalived_up Status
# TYPE keepalived_up gauge
keepalived_up 0

The keepalived service is up and running

sudo systemctl status keepalived
● keepalived.service - LVS and VRRP High Availability Monitor
   Loaded: loaded (/usr/lib/systemd/system/keepalived.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2021-06-29 21:45:04 UTC; 46min ago
  Process: 22086 ExecStart=/usr/sbin/keepalived $KEEPALIVED_OPTIONS (code=exited, status=0/SUCCESS)
 Main PID: 22087 (keepalived)
   CGroup: /system.slice/keepalived.service
           ├─22087 /usr/sbin/keepalived -D
           ├─22088 /usr/sbin/keepalived -D
           └─22089 /usr/sbin/keepalived -D

The leepalived servers do not have killall binary

ls -lrt /usr/sbin/kill*
-rwxr-xr-x. 1 root root 23728 Jun  9  2014 /usr/sbin/killall5

ERRO[123716] keepalived.data and keepalived.stats datas are not synced

As in title:

Getting: ERRO[123716] keepalived.data and keepalived.stats datas are not synced

What shoul I do to get rid of this err. message?

Thanks in advance for the help!

Info:
Keepalived v1.3.5 (03/19,2017), git commit v1.3.5-6-g6fa32f2

Copyright(C) 2001-2017 Alexandre Cassen, [email protected]

Build options: PIPE2 LIBNL3 RTA_ENCAP RTA_EXPIRES RTA_PREF RTA_VIA FRA_OIFNAME FRA_SUPPRESS_PREFIXLEN FRA_TUN_ID RTAX_CC_ALGO RTAX_QUICKACK LIBIPTC LIBIPSET_DYNAMIC LVS LIBIPVS_NETLINK VRRP VRRP_AUTH VRRP_VMAC SOCK_NONBLOCK SOCK_CLOEXEC FIB_ROUTING INET6_ADDR_GEN_MODE SNMP_V3_FOR_V2 SNMP SNMP_KEEPALIVED SNMP_CHECKER SNMP_RFC SNMP_RFCV2 SNMP_RFCV3 SO_MARK

No version info for release v1.3.1

Latest version don't provide version number in metrics:
keepalived_exporter_build_info{branch="",goarch="amd64",goos="linux",goversion="go1.20.6",revision="11862a54a7f6bb175bfa82312d516b8ff1adccd4",tags="unknown",version=""} 1
and in command line:
keepalived-exporter --version INFO[0000] Keepalived Exporter build_time= commit= version=

missing vrid/intf value

Hi,

seems like the exporter doesn't populate vrid and interface value from the keepalived/config once the scraped

scrape example:
keepalived_vrrp_become_master{intf="",name="some_name",state="MASTER",vrid="0"} 1
keepalived_vrrp_become_master{intf="",name="some_name1",state="MASTER",vrid="0"} 1
keepalived_vrrp_become_master{intf="",name="some_name2",state="MASTER",vrid="0"} 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.