Community discussions

 
bkmz
just joined
Topic Author
Posts: 1
Joined: Sun Mar 18, 2018 11:18 pm

Parse ping result

Sun Mar 18, 2018 11:40 pm

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?
 
User avatar
doneware
Trainer
Trainer
Posts: 508
Joined: Mon Oct 08, 2012 8:39 pm
Location: Hungary

Re: Parse ping result

Wed Apr 18, 2018 11:58 pm

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
#TR0359
 
User avatar
CZFan
Forum Guru
Forum Guru
Posts: 1361
Joined: Sun Oct 09, 2016 8:25 pm
Location: South Africa, Randburg
Contact:

Re: Parse ping result

Fri Sep 06, 2019 1:28 pm

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
MTCNA, MTCTCE, MTCRE & MTCINE
 
User avatar
sebastia
Forum Guru
Forum Guru
Posts: 1773
Joined: Tue Oct 12, 2010 3:23 am
Location: Antwerp, BE

Re: Parse ping result

Fri Sep 06, 2019 2:50 pm

Have a look at getRTT function here viewtopic.php?t=129294

Who is online

Users browsing this forum: No registered users and 9 guests