Skip to content

Instantly share code, notes, and snippets.

@lusis
Created April 10, 2019 16:19
Show Gist options
  • Save lusis/e72d42c700329c6637b5e21a83e39f28 to your computer and use it in GitHub Desktop.
Save lusis/e72d42c700329c6637b5e21a83e39f28 to your computer and use it in GitHub Desktop.
exabgp promethues exporter

Current metrics at startup

root@node1:~# curl -s http://localhost:9569/metrics  | grep peer
# HELP peer_route_state shows the current peer state for a given route
# TYPE peer_route_state gauge
peer_route_state{family="ipv4 unicast",peer_asn="64496",peer_ip="192.168.1.2",route="192.168.88.2/32",self_asn="64496",self_ip="192.168.1.184"} 1
# HELP peer_state shows the current peer state
# TYPE peer_state gauge
peer_state{peer_asn="64496",peer_ip="192.168.1.2",self_asn="64496",self_ip="192.168.1.184"} 1

stop haproxy which triggers a withdraw

root@node1:~# service haproxy stop
root@node1:~# curl -s http://localhost:9569/metrics  | grep peer
# HELP peer_route_state shows the current peer state for a given route
# TYPE peer_route_state gauge
peer_route_state{family="ipv4 unicast",peer_asn="64496",peer_ip="192.168.1.2",route="192.168.88.2/32",self_asn="64496",self_ip="192.168.1.184"} 0
# HELP peer_state shows the current peer state
# TYPE peer_state gauge
peer_state{peer_asn="64496",peer_ip="192.168.1.2",self_asn="64496",self_ip="192.168.1.184"} 1

Note that the peer_route_state is now 0

neighbor 192.168.1.2 {
local-as 64496;
peer-as 64496;
router-id 192.168.1.184;
local-address 192.168.1.184;
group-updates false;
capability {
graceful-restart;
route-refresh;
}
family {
ipv4 unicast;
}
api routing {
processes [ watch-haproxy ];
}
api logging {
processes [ golang-test ];
neighbor-changes;
signal;
receive {
parsed;
notification;
update;
refresh;
keepalive;
open;
operational;
}
send {
parsed;
notification;
update;
refresh;
keepalive;
open;
operational;
}
}
}
process watch-haproxy {
run python3 -m exabgp healthcheck -F /etc/exabgp/haproxy.cfg;
encoder json;
}
process golang-test {
run /tmp/exabgp_exporter;
encoder json;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment