Page 1 of 1

Hysteresis watchdog

Posted: Sun Oct 28, 2018 4:59 pm
by petrb
Hi, the example implementation of the watchdog with the hysteresis (for the OSPF routing protocol, it can be easily modified for any other purpose). How it works: - start the cycle in the background that sends ICMP each second to the target. When packet loss is detected, the trigger is called. A script can be stopped with the command: :set hysteresis stop
:local DSTIP ""
:local INTERFACE "ether4-wifi60G"
:local timer 0
:local pause false
:global hysteresis start

while ($hysteresis != "stop") do={
  if ($timer = 0) do={
    if ([/ping $DSTIP count=1] = 0) do={
      if ($pause = false) do={
        :set timer 30
        :set pause true
        :log info "60G backup activated"
        /routing ospf interface set [find where interface=$INTERFACE] passive=yes
    } else={
      if ($pause = true) do={
        :set pause false
        /routing ospf interface set [find where interface=$INTERFACE] passive=no
        :log info "60G restored"
  if ($timer > 0) do={:set timer ($timer-1)}
  delay 1