I am trying to generate alerts for when certain routes become inactive. I have two WANs, one of them is an LTE with limited data. Therefore I want to know when it's in use so that I can investigate.
I have used the script below to successfully detect my WAN outage by running the script on a schedule, however, I obviously get a notification for each time the schedule runs whilst the outage is in play.
Is there a way I could do this and only get a single notification for this as I intend to email the notifications and don't want to spam myself. I also don't want to slow down the schedule as that would potentially leave it longer before I receive a notification of the outage and use more of the expensive data.
Code: Select all
{
local status [ip route get value-name=active [find comment="3. Recursive lookup for Virgin connection (Via WAN routing table)"]]
if ($status= false) do={/log info "gateway is down"}
}