08 Juli 2011

 

Mikrotik netwatch routine using global vars

:global wan0Stat
:global wan1Stat
:global wan0LastStat
:global wan1LastStat
:global LastUseBalance

/global UseBalance false
/log info "[+] Netstatus-routine"

:if ($wan0Stat = "UP" and $wan0LastStat="DOWN") do={
 /system script run set-wan0-up
}
:if ($wan0Stat = "DOWN") do={
 /system script run set-wan0-down
}

:if ($wan1Stat = "UP" and $wan1LastStat="DOWN") do={
 /system script run set-wan1-up
}
:if ($wan1Stat = "DOWN") do={
 /system script run set-wan1-down
}

:if ($wan0Stat = "UP" and $wan1Stat = "UP") do={ /global UseBalance true }

:if ($UseBalance = true and $LastUseBalance = false) do={
 /system script run nthbalance-up
} 
:if ($UseBalance=false) do={
 /system script run nthbalance-down
}

/log info "NetStatus | wan0: $wan0Stat"
/log info "NetStatus | wan1: $wan1Stat"
/log info "NetStatus | UseBalance: $UseBalance"

Label:


Arsip

Januari 2009   Oktober 2009   November 2009   Maret 2010   Januari 2011   Februari 2011   Juli 2011   Juni 2012