mehdy / keepalived-exporter

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

Failed to parse VIP from keepalived data #37

Closed yeti-master closed 4 years ago

yeti-master commented 4 years ago

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 {
               x@yz.com
                w@yz.com
        }
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 {
               x@yz.com
                w@yz.com
        }
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

clwluvw commented 4 years ago

@yeti-master Can you please also share your /tmp/keepalived.data?

yeti-master commented 4 years ago

@clwluvw keepalived_data.txt

clwluvw commented 4 years ago

The issue is for

   Virtual IP = 1
     141.249.3.160/32 dev ens192 scope global

that is newer versions of Keepalived it is like

   Virtual IP :
     141.249.3.160/32 dev ens192 scope global

And we don't support older format yet. If you update your Keepalived your problem will be solved but anyway I'll submit a PR to support older Keepalived data format.

yeti-master commented 4 years ago

@clwluvw Many thanks for your update. We are aware that our Keepalived version is quite old and going to try with newer version of Keepalived as suggested.