:if ( [/ping 192.x.y.z ] = 0) do={/interface ethernet cable-test ether2 duration=3}
how can i get result on that on the log, rather than waiting on the terminal for this to happen?
You can use /tool/netwatch instead**, then in the "On Down", do something like this::if ( [/ping 192.x.y.z ] = 0) do={/interface ethernet cable-test ether2 duration=3}
how can i get result on that on the log, rather than waiting on the terminal for this to happen?
:put [/ping 192.168.74.1 as-value count=10]
:if ([/ping 192.168.88.1 as-value count=1]->"status" != "timeout") do={
/log info [/interface ethernet cable-test ether2 duration=3 as-value]
}
Sorry, the "as-value" is what's important – I was typing it without testing it. I fixed the example above.i think the one above is better, the last one that u posted doesn't work on log:
:if ( [/ping 192.x.y.z ] = 0) do={/interface ethernet cable-test ether2 duration=3}
how can i get result on that on the log, rather than waiting on the terminal for this to happen?
{
:local tip 192.168.88.1
:local tif "ether2"
:if ([:ping address=$tip count=1] = 0) do={
:local test [/interface ethernet cable-test $tif once as-value]
:if (($test->"status") = "link-ok") do={
:log warning "reply from $tip NOT received, but the link on $tif appear to be OK"
} else={
:local tcap [:tostr ($test->"cable-pairs")]
:log warning "reply from $tip NOT received, and there is NO link on $tif [$tcap]"
}
} else={
:log info "reply from $tip received"
}
}
{
:local tip 192.168.88.1
:local tif "ether2"
:if ([:typeof ([:ping address=$tip count=1 as-value]->"time")] = "nothing") do={
:local test [/interface ethernet cable-test $tif once as-value]
:if (($test->"status") = "link-ok") do={
:log warning "reply from $tip NOT received, but the link on $tif appear to be OK"
} else={
:local tcap [:tostr ($test->"cable-pairs")]
:log warning "reply from $tip NOT received, and there is NO link on $tif [$tcap]"
}
} else={
:log info "reply from $tip received"
}
}