[rancid] Mikrotik and last status on email...

Alan McKinnon alan.mckinnon at gmail.com
Mon Aug 4 14:14:52 UTC 2014


On 04/08/2014 15:38, Jason Ede wrote:
> We’re trying to monitor the config in our mikrotiks with rancid.
> However, in the config we’re getting the last-status=succeeded appearing
> and disappearing from the /tool email line as shown below.
> 
>  
> 
>  
> 
> - set address=xxx.xxx.xxx.xxx from=mikrotik at birchenallhowden.co.uk
> <mailto:from=mikrotik at birchenallhowden.co.uk> last-status=succeeded
> password=password port=25 start-tls=yes user=someuser
> 
> + set address=xxx.xxx.xxx.xxx from=mikrotik at birchenallhowden.co.uk
> <mailto:from=mikrotik at birchenallhowden.co.uk>
> 
> + password=password port=25 start-tls=yes
> 
> + user=someuser
> 
>  
> 
> Is there a way I can easily modify mtrancid to ignore whether
> last-status is there or not or even just remove it from the output so it
> doesn’t even go into the CVS (it’s not needed if need to restore configs).

This is an FAQ, check the archives for many requests to do this kind of
thing on many devices.

Basically, check @command table in mtrancid for the command that
produces that output, identify the sub that deals with the output and
add your custom bit in the body of the while loop:

To discard the changing part, something like

/^(set address=/S+/s/S+).*$/ &&
  ProcessHistory(xxxxxxxxxxxxxx) && next;

To discard the line entirely:

/^(set address=/S+/s/S+).*$/ && next;


I'm not familiar with Microtik to be able to say what goes in the
ProcessHistory call marked "xxxxxxxxxxxxxxx". If you want to use that
first snippet, you can probably copy-paste the existing ProcessHistory
call towards the end of the while loop.

It's very obvious with a little perl- and regex-fu how it should all go
together


Disclaimer: Those regexes may or may not work :-)  I typed them without
having a reference handy and we all know that a regex is defined as "a
programming construct that is guaranteed to fail the first 5 times you
try get it right"





> 
>  
> 
> At last check for config on 1 router we’ve over 200 config versions all
> with the same change flipping back and forth…
> 
>  
> 
> Jason
> 
>  
> 
> 
> 
> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss at shrubbery.net
> http://www.shrubbery.net/mailman/listinfo/rancid-discuss
> 


-- 
Alan McKinnon
alan.mckinnon at gmail.com



More information about the Rancid-discuss mailing list