Discussion:
[rancid] Mikrotik and last status on email...
Jason Ede
2014-08-04 13:38:46 UTC
Permalink
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=***@birchenallhowden.co.uk<mailto:from=***@birchenallhowden.co.uk> last-status=succeeded password=password port=25 start-tls=yes user=someuser

+ set address=xxx.xxx.xxx.xxx from=***@birchenallhowden.co.uk<mailto:from=***@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).



At last check for config on 1 router we've over 200 config versions all with the same change flipping back and forth...



Jason
Alan McKinnon
2014-08-04 14:14:52 UTC
Permalink
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.
password=password port=25 start-tls=yes user=someuser
+ 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
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
--
Alan McKinnon
***@gmail.com
heasley
2014-08-04 14:28:34 UTC
Permalink
Post by Alan McKinnon
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.
password=password port=25 start-tls=yes user=someuser
+ password=password port=25 start-tls=yes
+ user=someuser
is *any* of that relevant configuration? what does it do? is there
something about your configuration that is causing this for you but not
others, Jason? Is it just a difference in s/w version?
Post by Alan McKinnon
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.
produces that output, identify the sub that deals with the output and
To discard the changing part, something like
/^(set address=/S+/s/S+).*$/ &&
ProcessHistory(xxxxxxxxxxxxxx) && next;
/^(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
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
--
Alan McKinnon
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
Loading...