Marc Hauswirth writes:
> I wrote a small monitor usefull if you run BGP (Border
> Gateway Protocol) on your network.
> This monitor permit you to check that all your BGP peer are up and
> running.
Marc, this is extremely useful! Thank you for the contribution!
However, in my environment, we have several BGP sessions that are
in "shutdown" status, i.e. the line
neighbor 10.2.2.2 shutdown
is in the Cisco config. bgp.monitor, as originally released, thinks
those sessions are broken, rather than ignoring them. Attached
is a patch that will check for:
bgp.bgpPeerTable.bgpPeerEntry.bgpPeerAdminStatus = stop
and not complain about a session that has been administratively
shut down. Note that if you have a buggy version of Cisco IOS
(like some 12.0(S) versions) where this MIB variable is not supported
properly this patch will only make things worse for you. Marc, perhaps
it should be an option?
One other quibble, I think the summary output of the script is too verbose -
how about something like:
routername(BGP 20.2.3.44/AS 1234/idle)
so it can fit on a pager screen?
Thanks again,
-- Ed
--- bgp.monitor 2002/04/08 21:25:21 1.1
+++ bgp.monitor 2002/04/08 21:25:39
@@ -109,6 +109,11 @@
6 => "established"
);
+my %BgpAdminStatus = (
+ 1 => "stop",
+ 2 => "start",
+ );
+
my %state;
@@ -121,7 +126,7 @@
$details .= "Router: $router (AS $bgpLocalAs) Id : $bgpIdentifier\n";
# Get trougnt the SNMP tree to fetch all peer infos
- my $vars = new
SNMP::VarList([$oids{bgpPeerIdentifier}],[$oids{bgpPeerRemoteAs}],[$oids{bgpPeerState}],[$oids{bgpPeerFsmEstablishedTime}]);
+ my $vars = new
+SNMP::VarList([$oids{bgpPeerIdentifier}],[$oids{bgpPeerRemoteAs}],[$oids{bgpPeerState}],[$oids{bgpPeerFsmEstablishedTime}],[$oids{bgpPeerAdminStatus}]);
for (my @vals = $sess->getnext($vars);
$vars->[0]->tag =~ /15\.3\.1\.1/ # still in table (Did
you have a cleaner solutions ?)
and
@@ -132,8 +137,9 @@
my $texttime = sectotime($vals[3]);
$details .= sprintf(" Neighbor %-16s AS %-5u status : %-15s
since : %-16s\n",$vals[0], $vals[1], $textState, $texttime);
- if ($vals[2] != 6) {
- $summary .= "Neighbor relation : $router - $vals[0] (AS
$vals[1]) is in state $textState";
+ # if bgpPeerState != established and bgpAdminStatus == start
+ if ($vals[2] != 6 and $vals[4] == 2) {
+ $summary .= "Neighbor relation : $router - $vals[0] (AS
+$vals[1]) is in state $textState ";
};
}
$details .= "\n";
@@ -178,4 +184,4 @@
$texttime .= int($sec/60) . "min";
return ($texttime);
-};
\ No newline at end of file
+};