[rancid] excluding output from cisco routers and switches relating to Flash: bootflash:

Lee ler762 at gmail.com
Thu Jan 14 15:54:10 UTC 2016


On 1/14/16, Ian Stong <istong at costar.com> wrote:
> I'm running an older version of rancid and was wondering if there is
> something I can edit to prevent the daily emails for changes I don't care
> about as mentioned below.  I edited rancid and tried excluding various model
> routers giving me the unwanted output (return(1) if ($type =~
> /^(12[40]|7|4|2|1)/);) but it didn't change anything

What I had in rancid 2.8:

# This routine parses "show flash"
sub ShowFlash {
    # skip if this is 7000, 7200, 7500, or 12000; else we end up with
    # redundant data from dir /all slot0:
    print STDERR "    In ShowFlash: $_" if ($debug);
    $redacted = 0;      # -LR- set if a file listing is suppressed

    while (<INPUT>) {
        tr/\015//d;
        last if (/^$prompt/);
        next if (/^(\s*|\s*$cmd\s*)$/);
        ### -LR- ideal would be to ignore filesystem changes like date
& time, but I'm not there yet
        ### -LR- so ignore the whole thing
        if (/startup-config\s*$/)       {$redacted = 1; next; } # -LR-
        if (/private-config\.text\s*$/) {$redacted = 1; next; } # -LR-
        if (/config\.text\s*$/)         {$redacted = 1; next; } # -LR-
        if (/dhcp[-_]database\s*$/)     {$redacted = 1; next; } # -LR-
ignore dhcp database changes
        if (/dhcp-snooping(-data)?\s*$/){$redacted = 1; next; } # -LR-
ignore dhcp snooping database changes
        if (/lic_uom\.dat\s*$/)         {$redacted = 1; next; } # -LR-
ignore .private/lic_uom.dat changes
        if (/.*\(\d+ bytes (free|used)\)/) {            # -LR- want to
show bytes used?
           if ($redacted) { next; }                     # -LR-   not
when there are files that haven't been shown
        }                                               # -LR-


Regards,
Lee


>
> # This routine parses "show flash"
> sub ShowFlash {
>     # skip if this is 7000, 7200, 7500, or 12000; else we end up with
>     # redundant data from dir /all slot0:
>     print STDERR "    In ShowFlash: $_" if ($debug);
>
>     while (<INPUT>) {
>         tr/\015//d;
>         last if (/^$prompt/);
>         next if (/^(\s*|\s*$cmd\s*)$/);
>         return(1) if ($type =~ /^(12[40]|7|4|2|1)/);
>         return(-1) if (/command authorization failed/i);
>         return(1) if /^\s*\^\s*$/;
>         return(1) if /(Invalid input detected|Type help or )/;
>         # the pager can not be disabled per-session on the PIX
>         s/^<-+ More -+>\s*//;
>         /\s+vlan\.dat$/ && next;
>         ProcessHistory("FLASH","","","!Flash: $_");
>     }
>     ProcessHistory("","","","!\n");
>     return;
>
>
>
> -----Original Message-----
> From: Rancid-discuss [mailto:rancid-discuss-bounces at shrubbery.net] On Behalf
> Of heasley
> Sent: Monday, January 11, 2016 6:03 PM
> To: Alan McKinnon
> Cc: rancid-discuss at shrubbery.net
> Subject: Re: [rancid] excluding output from cisco routers and switches
> relating to Flash: bootflash:
>
> Sun, Jan 03, 2016 at 06:24:34PM +0200, Alan McKinnon:
>> On 03/01/2016 16:50, Ian Stong wrote:
>> > Hi,
>> >
>> >
>> >
>> > I need to exclude the following output from rancid as it always
>> > shows changes to the Flash: bootflash:
>> >
>> >
>> >
>> > Sample below of what it is seeing as a change
>> >
>> >
>> >
>> > - !Flash: bootflash: 273633  drwx             8192  Dec 31 2015
>> > 06:27:53
>> > -04:00  tracelogs
>> >
>> > + !Flash: bootflash: 273633  drwx             8192  Dec 31 2015
>> > 13:55:48
>> > -04:00  tracelogs
>>
>>
>> modify the perl code with a suitable regex to detect the line you want
>> removed. The form is usually something like this:
>>
>> next if /insert some regex here/;
>>
>> The code is peppered with 10s of examples, and the question has been
>> asked and answered many times here. It's somewhat of an FAQ.
>
> There already is a filter for this w/ ios-xe, which had a bug in some old
> version causing this to endlessly change.
> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss at shrubbery.net
> http://www.shrubbery.net/mailman/listinfo/rancid-discuss
> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss at shrubbery.net
> http://www.shrubbery.net/mailman/listinfo/rancid-discuss
>


More information about the Rancid-discuss mailing list