Counting prefered routes for a protocol with bird2
Hi, With bird1, I can know how much routes are used for each protocol just by parsing birdc: [alarig@nominoe ~]$ birdc show protocols all bgp_breizhix | grep 'Routes:' Routes: 75 imported, 0 filtered, 4 exported, 73 preferred With bird2, I don’t see this information: [alarig@budic ~]$ birdc -r show protocols all bgp_breizhix_ipv4 BIRD 2.0.2 ready. Access restricted Name Proto Table State Since Info bgp_breizhix_ipv4 BGP --- up 2018-11-21 Established Description: BreizhIX BGP state: Established Neighbor address: 185.1.89.1 Neighbor AS: 206165 Neighbor ID: 185.1.89.1 Local capabilities Multiprotocol AF announced: ipv4 Route refresh Graceful restart 4-octet AS numbers Enhanced refresh Neighbor capabilities Multiprotocol AF announced: ipv4 Route refresh Graceful restart 4-octet AS numbers Enhanced refresh Session: external AS4 Source address: 185.1.89.13 Hold timer: 216.225/240 Keepalive timer: 12.810/80 Channel ipv4 State: UP Table: master4 Preference: 100 Input filter: bgp_filter_breizhix_in_ipv4 Output filter: (unnamed) Receive limit: 800000 Action: block Export limit: 4 Action: block Routes: 75 imported, 0 filtered, 4 exported Route change stats: received rejected filtered ignored accepted Import updates: 90 0 0 0 90 Import withdraws: 15 0 --- 0 15 Export updates: 5738200 88 5738108 --- 4 Export withdraws: 155358 --- --- --- 0 BGP Next hop: 185.1.89.13 The only way I found is by using 'show route count primary', but it takes so many time: [alarig@nominoe ~]$ time birdc show protocols all bgp_breizhix | grep 'Routes:' | sed -Ee '/preferred/{ s/^.* ([0-9]+) 'preferred'.*$/\1/; p;}' -e d 73 real 0m0.003s user 0m0.000s sys 0m0.006s [alarig@budic ~]$ time birdc -r show route count primary table master4 protocol bgp_breizhix_ipv4 | awk '/routes/ { print $1 }' 73 real 0m0.612s user 0m0.000s sys 0m0.003s Is there a faster manner to do this? My goal is to adapt https://git.grifon.fr/alarig/munin-bird/src/branch/master/bird_ to bird2. Thanks, -- Alarig
On Tue, Nov 27, 2018 at 03:32:36PM +0100, Alarig Le Lay wrote:
Hi,
With bird1, I can know how much routes are used for each protocol just by parsing birdc: [alarig@nominoe ~]$ birdc show protocols all bgp_breizhix | grep 'Routes:' Routes: 75 imported, 0 filtered, 4 exported, 73 preferred
With bird2, I don’t see this information: [alarig@budic ~]$ birdc -r show protocols all bgp_breizhix_ipv4
[alarig@budic ~]$ time birdc -r show route count primary table master4 protocol bgp_breizhix_ipv4 | awk '/routes/ { print $1 }'
Is there a faster manner to do this?
Hi Not really, we removed the preferred counter as it was misleading - it counted each route several times for each routing table in which it was preferred.
My goal is to adapt https://git.grifon.fr/alarig/munin-bird/src/branch/master/bird_ to bird2.
I would just also drop the preferred counter from the munin script. -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
participants (2)
-
Alarig Le Lay -
Ondrej Zajicek