[nsp] BGP & mrtg

Pete Templin petelists at templin.org
Tue Jul 6 15:57:39 EDT 2004


Roger wrote:
> Would anyone know of some helpful mrtg/snmp info for keeping 
> track/monitoring a BGP sessions?  ie how much memory a peer is taking 
> up, number of total routes advirtised and recieved, bestpath routes 
> installed per neighbor, etc..
> 
> I'm looking for canned examples.  I realize I'll have to sift through 
> snmp-walk output

Many of the parameters you're looking for seem to be unmonitorable.  I 
monitor peer status, number of FSM transitions to "established", and 
updates, using the following snippet within a larger generator:

sub bgpcfg {

# Make a page
#
     open(BGPPAGE,">$basedir/$city/$router.bgp.html");

# Make an entry on router page
     print ROUTERPAGE "\<A HREF\=\"$router.bgp.html\"\>BGP 
Information\<\/A>\<BR\>\n";

# snmpwalk the bgpPeerID tree (.1.3.6.1.2.1.15.3.1.1)
# figure out some way to track this information for peer changes
# consider DNS lookup on PeerID and address
#

     open(PEERLIST,"snmpwalk -c $snmpcomm $rtraddr .1.3.6.1.2.1.15.3.1.1|");
     while(<PEERLIST>) {
         $peeraddr = $_;
         chomp($peeraddr);
         $peeraddr =~ s/ = IpA.*//;
         $peeraddr =~ s/15.3.1.1.//;


# Make a page for this peer?
#
         open(PEERPAGE,">$basedir/$city/$router.bgp.$peeraddr.html");

# for each Peer:
# retrieve RemoteAS and show on page along with PeerID
# RemoteAS is .1.3.6.1.2.1.15.3.1.9
#

         open(REMOTEAS,"snmpget -c $snmpcomm $rtraddr 
.1.3.6.1.2.1.15.3.1.9.$peeraddr|");
         while(<REMOTEAS>){
             $remoteas = $_;
             chomp($remoteas);
             $remoteas =~ s/.*= //;
         }

         print BGPPAGE "\<A HREF\=\"$router.bgp.$peeraddr.html\"\>Peer 
$peeraddr \(AS $remoteas\)\<\/A>\<BR\>\n";
         print PEERPAGE "\<H2\>$peeraddr (AS $remoteas)\<BR\>\n";
         print PEERPAGE "\<P\>\<TABLE\>\n";

# graph InUpdates and OutUpdates {target 1}
# graph InUpdates <= 500 and OutUpdates <= 500 {target 2}
# OIDs are .1.3.6.1.2.1.15.3.1.10 and .1.3.6.1.2.1.15.3.1.11
#

         print MAINCFG "Target[$router.bgp.$peeraddr.1]: 
1.3.6.1.2.1.15.3.1.10.$peeraddr&1.3.6.1.2.1.15.3.1.11.$peeraddr:$snmpcomm\@$rtraddr 
* $interval\n";
         print MAINCFG "AbsMax[$router.bgp.$peeraddr.1]: 150000\n";
         print MAINCFG "MaxBytes[$router.bgp.$peeraddr.1]: 150000\n";
         print MAINCFG "Title[$router.bgp.$peeraddr.1]: BGP Updates\n";
         print MAINCFG "PageTop[$router.bgp.$peeraddr.1]: <H1>BGP 
Updates for $peeraddr (AS $remoteas)</H1>\n";
         print MAINCFG "Options[$router.bgp.$peeraddr.1]: unknaszero, 
withzeroes, growright\n";
         print MAINCFG "WithPeak[$router.bgp.$peeraddr.1]: wmy\n";
         print MAINCFG "YLegend[$router.bgp.$peeraddr.1]: Updates\n";
         print MAINCFG 
"#---------------------------------------------------\n";

         print MAINCFG "Target[$router.bgp.$peeraddr.2]: 
1.3.6.1.2.1.15.3.1.10.$peeraddr&1.3.6.1.2.1.15.3.1.11.$peeraddr:$snmpcomm\@$rtraddr 
* $interval\n";
         print MAINCFG "AbsMax[$router.bgp.$peeraddr.2]: 500\n";
         print MAINCFG "MaxBytes[$router.bgp.$peeraddr.2]: 250\n";
         print MAINCFG "Title[$router.bgp.$peeraddr.2]: Low-Level BGP 
Updates\n";
         print MAINCFG "PageTop[$router.bgp.$peeraddr.2]: <H1>Low-Level 
BGP Updates for $peeraddr (AS $remoteas)</H1>\n";
         print MAINCFG "Options[$router.bgp.$peeraddr.2]: unknaszero, 
withzeroes, growright\n";
         print MAINCFG "WithPeak[$router.bgp.$peeraddr.2]: wmy\n";
         print MAINCFG "YLegend[$router.bgp.$peeraddr.2]: Updates\n";
         print MAINCFG 
"#---------------------------------------------------\n";

         $target1page = "$router.bgp.$peeraddr.1.html";
         $target1img = "$router.bgp.$peeraddr.1-day.png";
         print PEERPAGE "\<TR\>\<TD\>\<B\>BGP Updates for $peeraddr on 
$router \<\/B\>\<BR\>\n";
         print PEERPAGE "\<A HREF\=\"$target1page\"\> \<IMG BORDER\=1 
ALT\=\"BGP Updates\"\n";
         print PEERPAGE "SRC\=\"$target1img\"\>\<\/A\>\n";
         print PEERPAGE "\<BR\>\<SMALL\>\<\!--#flastmod 
file\=\"$target1page\" --\>\<\/SMALL\>\n";
         print PEERPAGE "\<\/TD\>\<\/TR\>\n";

         $target2page = "$router.bgp.$peeraddr.2.html";
         $target2img = "$router.bgp.$peeraddr.2-day.png";
         print PEERPAGE "\<TR\>\<TD\>\<B\>Low-Level BGP Updates for 
$peeraddr on $router \<\/B\>\<BR\>\n";
         print PEERPAGE "\<A HREF\=\"$target2page\"\> \<IMG BORDER\=2 
ALT\=\"BGP Updates\"\n";
         print PEERPAGE "SRC\=\"$target2img\"\>\<\/A\>\n";
         print PEERPAGE "\<BR\>\<SMALL\>\<\!--#flastmod 
file\=\"$target2page\" --\>\<\/SMALL\>\n";
         print PEERPAGE "\<\/TD\>\<\/TR\>\n";


# graph PeerState as gauge with threshold
# (less than 6 is bad) {target 3}
# PeerState is .1.3.6.1.2.1.15.3.1.2
#

         print MAINCFG "Target[$router.bgp.$peeraddr.3]: 
1.3.6.1.2.1.15.3.1.2.$peeraddr&1.3.6.1.2.1.15.3.1.2.$peeraddr:$snmpcomm\@$rtraddr\n";
         print MAINCFG "AbsMax[$router.bgp.$peeraddr.3]: 12\n";
         print MAINCFG "MaxBytes[$router.bgp.$peeraddr.3]: 6\n";
         print MAINCFG "Title[$router.bgp.$peeraddr.3]: Peer State\n";
         print MAINCFG "PageTop[$router.bgp.$peeraddr.3]: <H1>Peer State 
for Peer $peeraddr (AS $remoteas)</H1>\n";
         print MAINCFG "Options[$router.bgp.$peeraddr.3]: gauge, 
growright\n";
         print MAINCFG "WithPeak[$router.bgp.$peeraddr.3]: wmy\n";
         print MAINCFG "YLegend[$router.bgp.$peeraddr.3]: State\n";
         print MAINCFG "ThreshMinI[$router.bgp.$peeraddr.3]: 0\n";
         print MAINCFG "ThreshMaxI[$router.bgp.$peeraddr.3]: 5\n";
         print MAINCFG "ThreshProgI[$router.bgp.$peeraddr.3]: 
/usr/local/bin/bgpstateclear\n";
         print MAINCFG "ThreshProgOKI[$router.bgp.$peeraddr.3]: 
/usr/local/bin/bgpstatealarm\n";
         print MAINCFG "ThreshMinO[$router.bgp.$peeraddr.3]: 0\n";
         print MAINCFG "ThreshMaxO[$router.bgp.$peeraddr.3]: 5\n";
         print MAINCFG "ThreshProgO[$router.bgp.$peeraddr.3]: 
/usr/local/bin/threshnull\n";
         print MAINCFG "ThreshProgOKO[$router.bgp.$peeraddr.3]: 
/usr/local/bin/threshnull\n";
         print MAINCFG 
"#---------------------------------------------------\n";

         $target3page = "$router.bgp.$peeraddr.3.html";
         $target3img = "$router.bgp.$peeraddr.3-day.png";
         print PEERPAGE "\<TR\>\<TD\>\<B\>Peer State for $peeraddr on 
$router \<\/B\>\<BR\>\n";
         print PEERPAGE "\<A HREF\=\"$target3page\"\> \<IMG BORDER\=3 
ALT\=\"Peer State\"\n";
         print PEERPAGE "SRC\=\"$target3img\"\>\<\/A\>\n";
         print PEERPAGE "\<BR\>\<SMALL\>\<\!--#flastmod 
file\=\"$target3page\" --\>\<\/SMALL\>\n";
         print PEERPAGE "\<\/TD\>\<\/TR\>\n";

# graph FSMEstablishedTransitions with threshold {target 4}
# FSMET is .1.3.6.1.2.1.15.3.1.15 (multiply by interval?)
#

         print MAINCFG "Target[$router.bgp.$peeraddr.4]: 
1.3.6.1.2.1.15.3.1.15.$peeraddr&1.3.6.1.2.1.15.3.1.15.$peeraddr:$snmpcomm\@$rtraddr 
* $interval\n";
         print MAINCFG "AbsMax[$router.bgp.$peeraddr.4]: 50000\n";
         print MAINCFG "MaxBytes[$router.bgp.$peeraddr.4]: 10000\n";
         print MAINCFG "Title[$router.bgp.$peeraddr.4]: FSM Transitions\n";
         print MAINCFG "PageTop[$router.bgp.$peeraddr.4]: <H1>FSM 
Transitions for Peer $peeraddr (AS $remoteas)</H1>\n";
         print MAINCFG "Options[$router.bgp.$peeraddr.4]: growright\n";
         print MAINCFG "WithPeak[$router.bgp.$peeraddr.4]: wmy\n";
         print MAINCFG "YLegend[$router.bgp.$peeraddr.4]: Activity\n";
         print MAINCFG "ThreshMinI[$router.bgp.$peeraddr.4]: 0\n";
         print MAINCFG "ThreshMaxI[$router.bgp.$peeraddr.4]: 0.1\n";
         print MAINCFG "ThreshProgI[$router.bgp.$peeraddr.4]: 
/usr/local/bin/fsmstatealarm\n";
         print MAINCFG "ThreshProgOKI[$router.bgp.$peeraddr.4]: 
/usr/local/bin/fsmstateclear\n";
         print MAINCFG "ThreshMinO[$router.bgp.$peeraddr.4]: 0\n";
         print MAINCFG "ThreshMaxO[$router.bgp.$peeraddr.4]: 1\n";
         print MAINCFG "ThreshProgO[$router.bgp.$peeraddr.4]: 
/usr/local/bin/threshnull\n";
         print MAINCFG "ThreshProgOKO[$router.bgp.$peeraddr.4]: 
/usr/local/bin/threshnull\n";
         print MAINCFG 
"#---------------------------------------------------\n";

         $target4page = "$router.bgp.$peeraddr.4.html";
         $target4img = "$router.bgp.$peeraddr.4-day.png";
         print PEERPAGE "\<TR\>\<TD\>\<B\>FSM Transitions for $peeraddr 
on $router \<\/B\>\<BR\>\n";
         print PEERPAGE "\<A HREF\=\"$target4page\"\> \<IMG BORDER\=4 
ALT\=\"FSM Activity\"\n";
         print PEERPAGE "SRC\=\"$target4img\"\>\<\/A\>\n";
         print PEERPAGE "\<BR\>\<SMALL\>\<\!--#flastmod 
file\=\"$target4page\" --\>\<\/SMALL\>\n";
         print PEERPAGE "\<\/TD\>\<\/TR\>\n";

     }

HTH,

Pete


More information about the cisco-nsp mailing list