mehdy / keepalived-exporter

Prometheus Keepalived exporter
GNU General Public License v3.0
121 stars 40 forks source link

/tmp/keepalived.data not created #135

Closed arteonprifti closed 1 year ago

arteonprifti commented 1 year ago

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=
clwluvw commented 1 year ago

Hi, Can you please share more info about your deployment and how did you run the exporter (with which flags on which env (container or host))?

arteonprifti commented 1 year ago

Hi, it is runinng in the same pod as keepalived. This is the command: /keepalived-exporter -ka.pid-path=/var/run/keepalived/keepalived.pid

clwluvw commented 1 year ago

Basically, the data file would be created by keepalived. So have you taken care of mounting /tmp from keepalived container to the keepalived-exporter container?

arteonprifti commented 1 year ago

Yes the folder is mounted on both, but somehow the signal is not sent to the keepalived process, so the file is not generated. If I send the signal manually (kill -s 10 pid) the file gets generated and the exporter starts working. I am running the following keepalived version: Keepalived v2.2.8 (04/04,2023), git commit v2.2.7-154-g292b299e+

clwluvw commented 1 year ago

If keepalived-exporter fails to send a signal then you should see logs about it. Did you try to send the signal from the keepalived-exporter container?

hadi2f244 commented 1 year ago

I installed keepalived and keepalived-exporter on host directly by deb files. Same errors I've got.

Also, If I run sudo kill -USR1 $(cat /var/run/keepalived.pid) manually, It creates /tmp/keepalived.data and then exporter can collect data.

After downgrading to v1.3.0, everythings works fine.

Details:

Keepalived-exporter errors:

ERRO[0009] failed to open Script VRRP file               error="open /tmp/keepalived.data: no such file or directory" fileName=/tmp/keepalived.data
ERRO[0009] failed to open Script VRRP file               error="open /tmp/keepalived.data: no such file or directory" fileName=/tmp/keepalived.data
ERRO[0009] failed to open Script VRRP file               error="open /tmp/keepalived.data: no such file or directory" fileName=/tmp/keepalived.data
ERRO[0009] failed to open Script VRRP file               error="open /tmp/keepalived.data: no such file or directory" fileName=/tmp/keepalived.data
ERRO[0009] failed to open Script VRRP file               error="open /tmp/keepalived.data: no such file or directory" fileName=/tmp/keepalived.data
ERRO[0009] failed to open Script VRRP file               error="open /tmp/keepalived.data: no such file or directory" fileName=/tmp/keepalived.data
ERRO[0010] failed to open Script VRRP file               error="open /tmp/keepalived.data: no such file or directory" fileName=/tmp/keepalived.data
ERRO[0010] failed to open Script VRRP file               error="open /tmp/keepalived.data: no such file or directory" fileName=/tmp/keepalived.data
ERRO[0010] failed to open Script VRRP file               error="open /tmp/keepalived.data: no such file or directory" fileName=/tmp/keepalived.data
ERRO[0010] failed to open Script VRRP file               error="open /tmp/keepalived.data: no such file or directory" fileName=/tmp/keepalived.data
ERRO[0010] failed to open Script VRRP file               error="open /tmp/keepalived.data: no such file or directory" fileName=/tmp/keepalived.data
ERRO[0011] failed to open Script VRRP file               error="open /tmp/keepalived.data: no such file or directory" fileName=/tmp/keepalived.data
ERRO[0011] No data found to be exported                  error="open /tmp/keepalived.data: no such file or directory"
$ sudo keepalived-exporter -version
INFO[0000] Keepalived Exporter                           build_time= commit= version=
$ sudo keepalived-exporter -version

INFO[0000] Keepalived Exporter                           build_time= commit= version=
$ sudo keepalived -v

Keepalived v2.2.4 (08/21,2021)

Copyright(C) 2001-2021 Alexandre Cassen, <acassen@gmail.com>

Built with kernel headers for Linux 5.15.27
Running on Linux 5.15.0-76-generic #83-Ubuntu SMP Thu Jun 15 19:16:32 UTC 2023
Distro: Ubuntu 22.04.2 LTS

configure options: --build=x86_64-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --disable-option-checking --disable-silent-rules --libdir=${prefix}/lib/x86_64-linux-gnu --runstatedir=/run --disable-maintainer-mode --disable-dependency-tracking --enable-snmp --enable-sha1 --enable-snmp-rfcv2 --enable-snmp-rfcv3 --enable-dbus --enable-json --enable-bfd --enable-regex --with-init=systemd build_alias=x86_64-linux-gnu CFLAGS=-g -O2 -ffile-prefix-map=/build/keepalived-NeItXh/keepalived-2.2.4=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security LDFLAGS=-Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2

Config options:  NFTABLES LVS REGEX VRRP VRRP_AUTH VRRP_VMAC JSON BFD OLD_CHKSUM_COMPAT SNMP_V3_FOR_V2 SNMP_VRRP SNMP_CHECKER SNMP_RFCV2 SNMP_RFCV3 DBUS INIT=systemd SYSTEMD_NOTIFY

System options:  VSYSLOG MEMFD_CREATE 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_PROTOCOL FRA_IP_PROTO FRA_SPORT_RANGE FRA_DPORT_RANGE RTA_TTL_PROPAGATE IFA_FLAGS LWTUNNEL_ENCAP_MPLS LWTUNNEL_ENCAP_ILA NET_LINUX_IF_H_COLLISION LIBIPVS_NETLINK IPVS_DEST_ATTR_ADDR_FAMILY IPVS_SYNCD_ATTRIBUTES IPVS_64BIT_STATS IPVS_TUN_TYPE IPVS_TUN_CSUM IPVS_TUN_GRE VRRP_IPVLAN IFLA_LINK_NETNSID GLOB_BRACE GLOB_ALTDIRFUNC INET6_ADDR_GEN_MODE VRF SO_MARK
mehdy commented 1 year ago

@hadi2f244 @arteonprifti Thank you both for reporting the bug. I made a patch and will release a new version soon.