WAN Failover detection

Hi all,

I’m unsure where to start the next project step and hope someone can give me an advise or give me a direction.

Searching: A mechanism that helps me report/detect/monitor when the failover has been initiated/taken place.

Given: A router with WAN-Failover configured, default-WAN goes via ether1 to a DSL-Router and backup-WAN goes via ether2 to a SXT for LTE backup
Additionaly: Prometheus/Grafana with alarming, Raspi-Boxes with Shell / Script capabilities…

Ideas:

  • Monitor in Prometheus when the Default-Gateway changes → not feasible as I can’t extract/see what the default gateway is in Prometheus, neither using mikrotik_exporter nor snmp_exporter
  • Script: Write a script on the Router that is triggered when a switch of the gateway occurs → haven’t found a clue where to trigger scripts on events
  • Alternatives: I can monitor the availability of the DSL-Line or the DSL-Router, or I can monitor if the traffic on the LTE-interface is > 0. → But both examples don’t show the fact, whether the default route has changed or not. Maybe due to a bad configuration, traffic leaks through the LTE device, although DSL is available. Or maybe the failover didn’t work although the monitoring shows that the DSL-Line is down

Goal: I would like to monitor the fact that the default route has changed and not a series of data that conclude that it is highly probable that the default route might have changed.

Does anybody know of such a solution or have any ideas where to start implementing?

Cheers,
plani

Guten Morgen Plani,

I had to solve a similar WAN-Failover for a Phone-System Network.
Because of the High requirements of the Client, we used a Scheduler (every 60 seconds on Startup)

Basic Parameters of Failover:

  • ISP1 default, ISP2 as automatic Failover after MAX 60sec.
  • Manually be able to set ISP2 as Default for the Day or Week (for maintenance)
  • Expandable for possible WAN3
  • Notification via Email
  • Notification via Log / Syslog
  • HTTP-Post to change Settings on Phone-Gateway-Server
  • Update DynDNS
  • No ISP Ping-Pong
    if ISP2 is active and ISP1 is back online, it will only automatic switch back if ISP2 is offline
    At the end of the day, the Router would always reset back to ISP1.



    I attached to this Post my old Scheduler-Code…
    It isn’t perfect, but maybe it can help you find a better Solution!
    Mikrotik_ISP_Checker.txt (2.93 KB)

Found another Script, maybe it can help !

http://forum.mikrotik.com/t/failover-script-with-2-dhcp-client-interfaces-sharing-my-working-script/151350/1