[rancid] Re: Monitoring Route Table with RANCID.

georg.naggies at r-it.at georg.naggies at r-it.at
Fri Jul 21 12:16:02 UTC 2006


Shekar, look into "rancid" in the bin directory, the places where to make 
the additions are pretty obvious. (from line 1532 onwards)

Alternatively, try the "patch"-utility, by copying David's code in a file 
and running, roughly  patch <file> rancid

David, merci beaucoup, very useful.

Made this addition which I'd like to share because I spent some time in 
trial & error with escaping the "*" in "show ip route vrf * bgp",

sub ShowIPRouteVrfBGP {
    print STDERR "    In ShowIPRouteVrfBGP: $_" if ($debug);
    while (<INPUT>) {
        tr/\015//d;
        last if(/^$prompt/);
        next if (/^\s*$/);
        return(1) if /(Invalid input detected|Type help or )/;
        return(-1) if (/command authorization failed/i);
        if ($_ =~ /^B|^\s+\[/) {
          $_ = (split(",",$_,2))[0]."\n";
        } else {
          next;
        }
        ProcessHistory("ROUTES","numsort","","!MBGP Routes: $_");
    }
    ProcessHistory("","","","!\n");
    return(0);
}

'show ip route vrf * bgp'   => "ShowIPRouteVrfBGP",

"show ip route vrf \\* bgp",


Georg




shekhar at mos.com.np 
Gesendet von: rancid-discuss-bounces at shrubbery.net
21.07.2006 13:08

An
david_laporte at harvard.edu
Kopie
Rancid-discuss at shrubbery.net
Thema
[rancid] Re: Monitoring Route Table with RANCID.






Thanks for the patch. One thing I am not clear is how to apply it? Do I
just append these config lines to the rancid file? 

Thanks
Shekhar.

On Thu, 2006-07-20 at 18:25, David LaPorte wrote:
> My diff against 2.3.1 is attached.  We only run one instance of RANCID,
> but this is just one of several patches we apply to customize it.
> 
> Dave
> 
> Shekhar Basnet wrote:
> > How does one do it? I would love to do that kind of thing too. Would I
> > have to run a different instance of RANCID and tweak the software too?
> > Can you also post your diffs?
> > 
> > Thanks
> > Shekhar.
> 
> 
> ______________________________________________________________________
> *** rancid-2.3.1/bin/rancid            Thu Oct  6 22:40:22 2005
> --- /usr/local/rancid/bin/rancid               Sat Oct  8 22:23:41 2005
> ***************
> *** 578,583 ****
> --- 578,698 ----
>       return;
>   }
> 
> + # Local modification - 02/18/03 - dlp
> + # This routine prints the IP routing table on core, non-border routers
> + sub ShowIPRouteConnected {
> +     print STDERR "    In ShowIPRouteConnected: $_" if ($debug);
> +     while (<INPUT>) {
> +         tr/\015//d;
> +         last if(/^$prompt/);
> +         next if (/^\s*$/);
> +         return(1) if /(Invalid input detected|Type help or )/;
> +         return(-1) if (/command authorization failed/i); 
> +         if ($_ =~ /^C|^\s+\[/) {
> +           #$_ = (split(",",$_,2))[0]."\n"; 
> +         } else {
> +           next;
> +         } 
> +         ProcessHistory("ROUTES","numsort","","!Connected Routes: $_");
> +     }
> +     ProcessHistory("","","","!\n");
> +     return(0);
> + }
> + 
> + sub ShowIPRouteStatic {
> +     print STDERR "    In ShowIPRouteStatic: $_" if ($debug);
> +     while (<INPUT>) {
> +         tr/\015//d;
> +         last if(/^$prompt/);
> +         next if (/^\s*$/);
> +         return(1) if /(Invalid input detected|Type help or )/;
> +         return(-1) if (/command authorization failed/i);
> +         if ($_ =~ /^S|^\s+\[/) {
> +           #$_ = (split(",",$_,2))[0]."\n";
> +         } else {
> +           next;
> +         }
> +         ProcessHistory("ROUTES","numsort","","!Static Routes: $_");
> +     }
> +     ProcessHistory("","","","!\n");
> +     return(0);
> + }
> + 
> + sub ShowIPRouteRIP {
> +     print STDERR "    In ShowIPRouteRIP: $_" if ($debug);
> +     while (<INPUT>) {
> +         tr/\015//d;
> +         last if(/^$prompt/);
> +         next if (/^\s*$/);
> +         return(1) if /(Invalid input detected|Type help or )/;
> +         return(-1) if (/command authorization failed/i);
> +         if ($_ =~ /^R|^\s+\[/) {
> +           $_ = (split(",",$_,2))[0]."\n";
> +         } else {
> +           next;
> +         }
> +         ProcessHistory("ROUTES","numsort","","!RIP Routes: $_");
> +     }
> +     ProcessHistory("","","","!\n");
> +     return(0);
> + }
> + 
> + sub ShowIPRouteIGRP {
> +     print STDERR "    In ShowIPRouteIGRP: $_" if ($debug);
> +     while (<INPUT>) {
> +         tr/\015//d;
> +         last if(/^$prompt/);
> +         next if (/^\s*$/);
> +         return(1) if /(Invalid input detected|Type help or )/;
> +         return(-1) if (/command authorization failed/i);
> +         if ($_ =~ /^I|^\s+\[/) {
> +           $_ = (split(",",$_,2))[0]."\n";
> +         } else {
> +           next;
> +         }
> +         ProcessHistory("ROUTES","keysort","","!IGRP Routes: $_");
> +     }
> +     ProcessHistory("","","","!\n");
> +     return(0);
> + }
> + sub ShowIPRouteEIGRP {
> +     print STDERR "    In ShowIPRouteEIGRP: $_" if ($debug);
> +     while (<INPUT>) {
> +         tr/\015//d;
> +         last if(/^$prompt/);
> +         next if (/^\s*$/);
> +         return(1) if /(Invalid input detected|Type help or )/;
> +         return(-1) if (/command authorization failed/i);
> +         if ($_ =~ /^D|^\s+\[/) {
> +           $_ = (split(",",$_,2))[0]."\n";
> +         } else {
> +           next;
> +         }
> +         ProcessHistory("ROUTES","numsort","","!EIGRP Routes: $_");
> +     }
> +     ProcessHistory("","","","!\n");
> +     return(0);
> + }
> + 
> + sub ShowIPRouteOSPF {
> +     print STDERR "    In ShowIPRouteOSPF: $_" if ($debug);
> +     while (<INPUT>) {
> +         tr/\015//d;
> +         last if(/^$prompt/);
> +         next if (/^\s*$/);
> +         return(1) if /(Invalid input detected|Type help or )/;
> +         return(-1) if (/command authorization failed/i);
> +         if ($_ =~ /^O|^\s+\[/) {
> +           $_ = (split(",",$_,2))[0]."\n";
> +         } else {
> +           next;
> +         }
> +         ProcessHistory("ROUTES","numsort","","!OSPF Routes: $_");
> +     }
> +     ProcessHistory("","","","!\n");
> +     return(0);
> + }
> + 
>   # This routine parses "dir /all ((disk|slot)N|bootflash|nvram):"
>   sub DirSlotN {
>       # Skip if this is not a 3600, 7000, 7200, 7500, or 12000.
> ***************
> *** 1465,1470 ****
> --- 1580,1591 ----
>                'show controllers cbus'                 => 
"ShowContCbus",
>                'show diagbus'                          => "ShowDiagbus",
>                'show diag'                             => "ShowDiag",
> +         'show ip route connected' => "ShowIPRouteConnected", 
> +         'show ip route static'  => "ShowIPRouteStatic",
> +         'show ip route rip'     => "ShowIPRouteRIP", 
> +         'show ip route igrp'    => "ShowIPRouteIGRP", 
> +         'show ip route eigrp'   => "ShowIPRouteEIGRP",
> +         'show ip route ospf'    => "ShowIPRouteOSPF",
>                'show module'                           => "ShowModule",  
 # cat 6500-ios
>                'show spe version'              => "ShowSpeVersion",
>                'show c7200'                            => "ShowC7200",
> ***************
> *** 1521,1526 ****
> --- 1642,1653 ----
>                "show controllers cbus",
>                "show diagbus",
>                "show diag",
> +         "show ip route connected",
> +         "show ip route static",
> +         "show ip route rip",
> +         "show ip route igrp",
> +         "show ip route eigrp",
> +         "show ip route ospf",
>                "show module",
>                "show spe version",
>                "show c7200",

_______________________________________________
Rancid-discuss mailing list
Rancid-discuss at shrubbery.net
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss





More information about the Rancid-discuss mailing list