Community discussions

 
ukzerosniper
Member Candidate
Member Candidate
Topic Author
Posts: 126
Joined: Tue Jul 23, 2013 9:20 pm

Alert on AS Route becomes inactive

Sun Oct 28, 2018 3:54 pm

Hi Guys,

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.
{
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"} 
}
 
ukzerosniper
Member Candidate
Member Candidate
Topic Author
Posts: 126
Joined: Tue Jul 23, 2013 9:20 pm

Re: Alert on AS Route becomes inactive

Sun Oct 28, 2018 8:08 pm

Hi Guys,

Thought I would update the post with what I ended up with. I received assistance from a few users on Facebook groups.
{
:global prevstatus;
:global status [:ip route get value-name=active [:ip route find comment="3.  Recursive lookup for Virgin connection (Via WAN routing table)"]]
:if ( "$status" != "$prevstatus" ) do={
:log warn "Virgin gateway changed status from \"$prevstatus\" -> \"$status\" (true=up, false=down, nothing=unintialized)";
:tool e-mail send to=user1@jdomain1.com subject="Virgin WAN gateway changed status" body=( [ :system clock get date ] . " " . [ :system clock get time ] . " gateway changed status from \"$prevstatus\" -> \"$status\" (true=up, false=down, nothing=unintialized)" )
:tool e-mail send to=user2@domain2.com subject="Virgin WAN gateway changed status" body=( [ :system clock get date ] . " " . [ :system clock get time ] . " gateway changed status from \"$prevstatus\" -> \"$status\" (true=up, false=down, nothing=unintialized)" )
}
:global prevstatus $status
}

Who is online

Users browsing this forum: No registered users and 6 guests