[rancid] Re: ProcessHistory filter

john heasley heas at shrubbery.net
Thu Jul 23 17:50:25 UTC 2009


Thu, Jul 23, 2009 at 06:19:12PM +0400, Smirnoff Alexander:
> Hello!
> 
>  
> 
> Now I find some information about these symbols, but until can't
> correctly work with them. For example zyxP791Rlogin must send command,
> and wait for prompt before send next command - and this feature work in
> one case and not word for another. I can't understand why. May be some
> of RANCID scripts already solve this problem with scroll-like terminals
> and scrolling symbols?

there are a bunch of vt/screen manipulation code in the o/p.  this is
probably the issue that you're facing because it makes a mess for
regex matches/etc.

you can try setting the terminal type to something that doesnt support
it (like agmrancid), which might cause the device to stop sending this
junk or try hlogin (or adapt it) to filter it out.

>  
> 
>  
> 
> ________________________________
> 
> From: rancid-discuss-bounces at shrubbery.net
> [mailto:rancid-discuss-bounces at shrubbery.net] On Behalf Of Smirnoff
> Alexander
> Sent: Wednesday, July 22, 2009 5:17 PM
> To: rancid-discuss at shrubbery.net
> Subject: [rancid] Re: ProcessHistory filter
> 
>  
> 
> And I have some other question about ProcessHistory - I make sub for
> parsing  commands, and in output I see for every first line this:
> 
>  
> 
> !HOSTNAME: 777777777777Prestige_
> !AUTOEXEC.NET: 777777777777777777777sys errctl 0
> !AUTOEXEC.NET: sys trcl level 5
> !AUTOEXEC.NET: sys trcl type 1180
> !AUTOEXEC.NET: sys trcp cr 64 96
> !AUTOEXEC.NET: sys trcl sw off
> !AUTOEXEC.NET: sys trcp sw off
> !AUTOEXEC.NET: ip tcp mss 512
> !AUTOEXEC.NET: ip tcp limit 2
> !AUTOEXEC.NET: ip tcp irtt 65000
> !AUTOEXEC.NET: ip tcp window 2
> !AUTOEXEC.NET: ip tcp ceiling 6000
> !AUTOEXEC.NET: ip rip activate
> !AUTOEXEC.NET: ip rip merge on
> !AUTOEXEC.NET: ip icmp discovery enif0 off
> !AUTOEXEC.NET: ppp ipcp compress off
> !AUTOEXEC.NET: sys wdog sw on
> !AUTOEXEC.NET: sys quick enable
> !SYS FEATURE: 77777777777IPX: yes
> !SYS FEATURE: IP ONLY: no
> !SYS FEATURE: AUI: no
> !SYS FEATURE: AB ADAPTER: no
> 
>  
> 
> e.g. I am ask about 777777777 symbols.
> 
>  
> 
> And this is my sub:
> 
>  
> 
> # is routine processes a "sys view autoexec.net"
> 
> sub ShowAutoexec {
> 
>     print STDERR "    In ShowAutoexec: $_" if ($debug);
> 
>     while (<INPUT>) {
> 
>     
> 
>         if (/^$prompt/) { $found_env=1; last};
> 
>  
> 
>                 if (/>/) {
> 
>                 $found_end = 1;
> 
>                 ProcessHistory("","","","!AUTOEXEC.NET: $_");
> 
>                 return(1);
> 
>                 }
> 
>                  $found_end = 1;
> 
>     
> 
>         ProcessHistory("","","","!AUTOEXEC.NET: $_");
> 
>     }   
> 
>     return(0);
> 
> }       
> 
>  
> 
> May be somebody know about this problem?
> 
>  
> 
> ________________________________
> 
> From: rancid-discuss-bounces at shrubbery.net
> [mailto:rancid-discuss-bounces at shrubbery.net] On Behalf Of Smirnoff
> Alexander
> Sent: Wednesday, July 22, 2009 11:29 AM
> To: rancid-discuss at shrubbery.net
> Subject: [rancid] ProcessHistory filter
> 
>  
> 
> Hello all RANCID people!
> 
>  
> 
> I try to filter interface counters from output of Zyxel Prestige 791R ip
> route status :
> 
> - !IP ROUTE: default         01 0   mpoa01     172.17.100.1      2
> 00ab 0      409683
> 
> + !IP ROUTE: default         01 0   mpoa01     172.17.100.1      2
> 00ab 0      412140
> 
>  
> 
>  using these definitions:
> 
>  
> 
> if (/^(default)/)
> 
>         { ProcessHistory("","","","!IP ROUTE: default $1 $2$3 mpoa01
> $5$6<___>\n") && next;    }
> 
>  
> 
> but  something wrong - i receive this:
> 
>  
> 
> !IP ROUTE: default default  mpoa01     <___>
> 
>  
> 
> How I can correctly setup this filter? 
> 
>  
> 
>  
> 
>  
> 
>  
> 
> -- 
> Regards,
> Alexandr Smirnov
> +7(812)3468600 # 54682
> Head of Data Transmission Networks Monitoring Service
> mailto:asmirnoff at office.beeline.ru <mailto:asmirnoff at office.beeline.ru> 
> 
>  
> 




> _______________________________________________
> 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