Parse ping result

Hello. In my script I want parse ping result.

:global tempping [/ping 192.168.100.89 count=2]
[bkmz@MikroTik] > :put $tempping
2

And I want receive ping result with percent and time
sent=2 received=2 packet-loss=0% min-rtt=0ms avg-rtt=0ms max-rtt=0ms

How can i do this?

packet loss/success percent is easy to pull off:

:local totalsent 10
:local success [/ping count=$totalsent x.x.x.x ]
:put ($success * 100 / $totalsent)

due to the nature of mikrotik’s scripting, the numerical values are always integer (64bit signed integer)

time is a harder nut to crack

This helps me a lot, thx

Have a look at getRTT function here http://forum.mikrotik.com/t/script-implementing-active-congestion-control/115302/1