[c-nsp] How to monitor BGP sessions

liviu.pislaru at gmail.com liviu.pislaru at gmail.com
Wed Apr 18 02:50:06 EDT 2007


hello robert,

you can try to obtain automatically (with the same monitoring script) 
neighbors ip adresses (ipv4 or ipv6);

EXAMPLE (perl):

- you have router X with the ip adress $iprouter:

$comm="xxxxxxxx"; # put here your own password
$oid="1.3.6.1.2.1.15.3.1.7";

($session,$error) = Net::SNMP->session(
                          -timeout    => 2,
                          -retries    => 1,
                          -hostname   => "$iprouter",
                          -community  => "$comm",    

        if (!defined($session)) {
                print "Error fetching informations from $iprouter: $error\n";
                exit(-1);                                                    
        }                
        $result =  $session->get_table(-baseoid => $oid);
        %all = %{$result};                               
        @ktmp=keys %all;  
        foreach (@ktmp) {
                $remote_peer=$result->{$_};
                print "$remote_peer\n";    
	}

even if you have IPV6 neighbors on the router, $remote_peer will be printed 
IPV4 style and you can combine it later with others OIDs:
(for example)
$oid_as="1.3.6.1.2.1.15.3.1.9.$remote_peer"
$oid_lpeer="1.3.6.1.2.1.15.3.1.5.$remote_peer"
$oid_state="1.3.6.1.2.1.15.3.1.2.$remote_peer"
        1 -> Idle
        2 -> Connect
        3 -> Active
        4 -> OpenSent
        5 -> OpenConfirm
        6 -> Established

etc.

OUTPUT EXAMPLE:
Router X has 3 BGP neighbors:
1. 213.154.97.240
2. 213.154.97.241
3. 2001:1518:0:3000::2

the script above will return 3 values for $remote_peer:
1. 213.154.97.240
2. 213.154.97.241
3. 32.1.21.24

you can see that even if the third neighbor is IPV6, the $remote_peer is 
printed IPV4 style and you can use it later with the next OIDs.

--
liviu.

On Wednesday 18 April 2007 00:46, Antonio Querubin wrote:
> On Tue, 17 Apr 2007, Robert Boyle wrote:
> > The MIB is:
> >
> > 1.3.6.1.2.1.15.3.1.2.a.b.c.d
> >
> > where a.b.c.d is the IP address of your BGP neighbor.
>
> Anyone know how the 'a.b.c.d' is mapped for an IPv6 BGP neighbor?  I've
> got a bunch of such neighbors but doing an snmpwalk through that OID
> subtree returns only entries that resemble IPv4 octets - some of which
> aren't even configured as actual IPv4 neighbors.
> _______________________________________________
> cisco-nsp mailing list  cisco-nsp at puck.nether.net
> https://puck.nether.net/mailman/listinfo/cisco-nsp
> archive at http://puck.nether.net/pipermail/cisco-nsp/


More information about the cisco-nsp mailing list