Since MikroTik still hasn't implemented 'state changed from Down to Up' i've written a script to simulate it in the meantime. It isn't perfect but it does the job. It relies on running as a script so it doesn't notify you immediately
And messages show up under the 'script,info' category not 'route,ospf,info' so if you are doing remote syslog monitoring you need to send that
The script is set to look at log files going back 1 minute and stores any ospf, info messages. It then enumerates through and compares the active OSPF adjacencies, if it see's that there was a Down message but that Router-ID is currently active, it's assumed the link is back up and sends a log message "OSPFv2 neighbor [ID]: state change from Down to Up on [interface]"
I suggest to schedule this to run once per minute. If you want to run it less frequently then adjust the time on line 3 of the script to look further back through the log messages
:global OSPFNeighborList
:if ($OSPFNeighborList != [/routing ospf neighbor find]) do={
:local OSPFDownMessages [/log find where topics=route,ospf,info time>=([/system clock get time]-00:01:00)]
:foreach i in=[$OSPFDownMessages] do={
:local m [/log get $i message]
:local t [:pick $m ([find $m "r"]+2) [find $m ":"]]
:local r [/routing ospf neighbor find where router-id=$t]
:local r [:pick $r 0]
:local ri [/routing ospf neighbor get $r interface]
:if ($r != "") do={:log info "OSPFv2 neighbor $t: state change from Down to Up on $ri"};
};
};
:global OSPFNeighborList [/routing ospf neighbor find];
I've had to include some extra checks for duplicate router ID's (i.e. backup paths) as that was causing an issue. The script will fire off a 'Down to Up' message if at least 1 path to a router is still active. This is not strictly correct because an already active link has not transitioned from the Down to Up state
i.e. you have ether1 <-> ether1 and ether2 <-> ether2 on RouterA and RouterB respectively
If the link on ether2 went down, technically you should only get 1 message 'Up to Down'
However this script compares Router-ID's and see's that infact there is a path still to the ID of RouterB so it will say 'Down to Up'
'Down to Up' is also not the actual state, it's just assumed. Technically a router could be stuck in the init/exstart/2way state and it will show 'Up', it's not looking at the actual state
This could be scripted out but I don't want to go any further with the script making it significantly more complicated. I'd rather MikroTik just implement this properly in the first place...................
In addition the script mentions the interface, Again I wish this was included by default in the log message. Because with multiple/redundant paths between routers I like to know which interface went down, not just the adjacency. It's nice to know if the low bandwidth backup link goes down and it doesn't affect anybody, or the high bandwidth primary one goes and there's likely to be congestion and latency increases