Community discussions

MikroTik App
 
Pizzarty
just joined
Topic Author
Posts: 1
Joined: Wed Apr 26, 2017 12:50 pm

Ping test

Wed Apr 26, 2017 3:38 pm

Hello,

I start in the mikrotik. I'm trying to know if the maximum ping is higher than 20ms but it does not work.
Here is my piece of code
if([/ping 8.8.8.8 max-rtt>20]) do={:beep frequency=550 length=494ms;}

Thanks you for your assistance.
 
mikronsultiK
just joined
Posts: 23
Joined: Wed Feb 01, 2017 12:57 am
Location: Italy
Contact:

Re: Ping test

Mon May 01, 2017 2:43 am

Hi there
within script the ping command will return a numer >=0 representing the number of successful pinged packet. So one legal usage is as in the following code snipet:
[mikronsultik@AP TestUfficio] > :if ([/ping 196.25.1.1 interval=2  count=3]=3) do={:put "DESTINATION IS ALIVE"}          
  SEQ HOST                                     SIZE TTL TIME  STATUS                                                                                                        
    0 196.25.1.1                                 56 246 219ms
    1 196.25.1.1                                 56 246 218ms
    2 196.25.1.1                                 56 246 218ms
    sent=3 received=3 packet-loss=0% min-rtt=218ms avg-rtt=218ms max-rtt=219ms 

DESTINATION IS ALIVE
In that code , the condition will be true as soon as all the ping requests packets are answered back.

On the other hand what can be useful for your case , maybe , is the /tool flood-ping command , in which you can , during the loop, use the properties values of the ping like the max-rtt. Here is an example :

[mikronsultik@AP TestUfficio] > /tool flood-ping 8.8.8.8 count=10 do={ :set $maxRtt $"max-rtt" }
      sent: 10
  received: 10
   min-rtt: 75
   avg-rtt: 79
   max-rtt: 112
[mikronsultik@AP TestUfficio] > :put $maxRtt                                                    
112
For further informations on /tool flood-ping and scripting, please search on the forum there are very good examples around on how to use it .

Hoping this helps

have a nice day

Who is online

Users browsing this forum: No registered users and 23 guests