I found a great script to test for changes in the status of a route but needed to make a couple of changes:
1) Check for changes in multiple routes -- so I made the variables unique for each route by add 3 numbers that have significance to me to the ends of the var names
2) Change TRUE and FALSE to UP and DOWN
Here's what I came up with (after hiking the learning curve):
Code: Select all
{
:global prevstatus355;
:global updown355;
:global status355 [:ip route get value-name=active [:ip route find comment="355"]]
:global true true
:global false false
:log info $status355;
:log info $prevstatus355;
:log info $true
:log info $false
:if ( "$status355" != "$prevstatus355" ) do={
:if ( "$status355" = $true ) do={
:log info "works";
:set $updown355 UP;
log info $status355;
}
:log warn "355 connectivity changed status from \"$prevstatus355\" -> \"$status355\" (true=up, false=down, nothing=unintialized)";
:tool e-mail send to=xxxxxxxx subject="355 Connectivity now \"$updown355\"" body=( [ :system clock get date ] . " " . [ :system clock get time ] . " 355 connectivity changed status from \"$prevstatus355\" -> \"$updown355\" (true=up, false=down, nothing=unintialized)" )
}
:set $prevstatus $updownstatus
:global prevstatus355 $status355
}
How bad is this?
Also, will this check for connectivity (that's really what I was looking for)?
Thanks!