I'm trying to create a script in RouterOS that does a bandwidth test (see below). The purpose of the script is to check if the bandwidth to another mikrotik router gets below a certain threshold (in my example I use 700 Mbps). If it does, the script has to raise an error. The $"tx-current" has to get above 700 Mbps before it can check if it gets below 700 Mbps.
Code: Select all
/tool {
:local a false
bandwidth-test 10.10.10.1 duration=60s direction=transmit do={
:if ($status = "running") do={
:if ($a = false) do={
:if ($"tx-current" > 700) do={
:set $a true
}
} if ($a = true) do={
:if ($"tx-current" < 700) do={
:error "bandwidth not enough"
}
}
}
}
}
I'm wondering if this can also be done through the RouterOS PHP API?