[rancid] Ignore differences in certain lines?

Alan McKinnon alan.mckinnon at gmail.com
Thu Jul 24 15:30:07 UTC 2014


On 24/07/2014 14:22, Aaron Wasserott wrote:
> Trying to capture ‘show interface status’ output from Cisco IOS
> switches, but ignore the output for diff purposes. Is that possible? I
> guess it would have to be part of the mailer function to not send output
> for certain lines.
> 
>  
> 
> I copied the ShowVLAN sub-routine because it already appends ! in front
> of the lines, so they are not considered config lines. But right now I
> can’t even get the output captured.
> 
>  
> 
> This is the new sub I am using:
> 
>  
> 
>  
> 
> # This routine parses "show interface status"
> 
> sub ShowIntStat {
> 
>     print STDERR "    In ShowIntStat: $_" if ($debug);
> 
>  
> 
>     #($_ = <INPUT>, return(1)) if (!$DO_SHOW_INT_STAT);
> 
>  
> 
>     while (<INPUT>) {
> 
>         tr/\015//d;
> 
>         last if (/^$prompt/);
> 
>         next if (/^(\s*|\s*$cmd\s*)$/);
> 
>         return(1) if /^\s*\^\s*$/;
> 
>         return(1) if /Line has invalid autocommand /;
> 
>         return(1) if /(Invalid input detected|Type help or )/;
> 
>         return(1) if /Ambiguous command/i;
> 
>         # newer releases (~12.1(9)) place the vlan config in the normal
> 
>         # configuration (write term).
> 
>         #return(1) if ($type =~ /^(3550|4500)$/);
> 
>         #return(1) if ($type !~ /^(2900XL|3500XL|6000)$/);
> 
>         return(-1) if (/command authorization failed/i);
> 
>         # the pager can not be disabled per-session on the PIX
> 
>         if (/^(<-+ More -+>)/) {
> 
>             my($len) = length($1);
> 
>             s/^$1\s{$len}//;
> 
>         }
> 
>  
> 
>         ProcessHistory("COMMENTS","keysort","IO","!INT: $_");
> 
>     }
> 
>     ProcessHistory("COMMENTS","keysort","IO","!\n");
> 
>     return(0);
> 
> }


Did you add corresponding entries to @command in the rancid script to
match your new sub? Just follow the existing pattern, it's obvious how
it must work.





-- 
Alan McKinnon
alan.mckinnon at gmail.com



More information about the Rancid-discuss mailing list