route statistics

I'm trying to collect statistics on how many routes match certain
patterns. So far I've been using zebra, set term len 0, and then sh ip
bgp regexp, and wait for the total prefixes count at the end of the list.
I figure there must be a better way than this, but so far haven't found
one. Any ideas?

Ralph Doncaster
principal, IStop.com
div. of Doncaster Consulting Inc.

I'm trying to collect statistics on how many routes match certain
patterns. So far I've been using zebra, set term len 0, and then sh ip
bgp regexp, and wait for the total prefixes count at the end of the list.
I figure there must be a better way than this, but so far haven't found
one. Any ideas?

Zebra supports dumping the RIB to MRT binary format. See the 'dump bgp'
family of commands. I find this format much easier to deal with than CLI
output.

Bradley

a message of 10 lines which said:

I'm trying to collect statistics on how many routes match certain
patterns. So far I've been using zebra, set term len 0, and then sh ip
bgp regexp, and wait for the total prefixes count at the end of the list.
I figure there must be a better way than this, but so far haven't found
one. Any ideas?

Compile zebra with --enable-snmp (the Debian binary package just
switched on this option) and snmpwalk the BGP table (1.3.6.1.2.1.15 ==
mib-2.15, see RFC 1657) ?

I didn't benchmark the two solutions against each other. If the BGP
machine is an actual forwarding router, not just a dedicated looking
glass, be sure to look at its load, not just at the wall-clock
response time.

Another solution is to dump the routing table
<URL:http://manticore.2y.net/doc/zebra/bgpd.html#Dump BGP packet and

in MRT format and to use MRT tools to analyze it (I tried that

and at least the Python version of these tools is hopelessly broken).

> I'm trying to collect statistics on how many routes match certain
> patterns. So far I've been using zebra, set term len 0, and then sh ip
> bgp regexp, and wait for the total prefixes count at the end of the list.
> I figure there must be a better way than this, but so far haven't found
> one. Any ideas?

Zebra supports dumping the RIB to MRT binary format. See the 'dump bgp'
family of commands. I find this format much easier to deal with than CLI
output.

Bradley

I've been told getting the MRT sources to build is rather difficult. I
may give it a shot anyway...

-Ralph

I've been told getting the MRT sources to build is rather difficult. I
may give it a shot anyway...

Yeah I haven't been able to build directly from the MRT source recently. On
FreeBSD building from the ports tree works fine. On Linux SuSE has an RPM at
ftp://ftp.suse.com/pub/suse/i386/7.3/suse/n3/mrt.rpm that works on Linux
flavors.

Bradley

You could rebuild the source rpm to any flavour also.

/Dee