Community discussions

MikroTik App
 
galleon2006
just joined
Topic Author
Posts: 22
Joined: Fri Jan 17, 2014 7:59 am

Ping statistics

Fri Jan 17, 2014 8:11 am

Hello. I need a script that will be ping remote host and write information into log file.
For example:
I define IP address and ping count.
And script should write in log.txt something like this:
Jan 17 05:00:00 sent=555 received=545 packet-loss=0% min-rtt=49ms avg-rtt=52ms max-rtt=54ms
Thanks for help and sorry for bad english.
 
nikolasc
just joined
Posts: 11
Joined: Wed Jun 04, 2008 10:30 am

Re: Ping statistics

Sat Jan 18, 2014 11:03 am

You can try this
:local aptime
:local mxptime
:local mnptime
:local se
:local re

/tool flood-ping 1xx.x.x.x count=10 do={
   :set aptime ($"avg-rtt");
   :set mxptime ($"max-rtt");
   :set mnptime ($"min-rtt");
   :set re ($received);
   :set se ($sent);
}

 log info "Avg $aptime Max $mxptime Min $mnptime    Received $re/ from $se"
make a scheduler to run every x minute
set up logging to save logs for script to a file
you can increase count= but you will have biggest traffic
and you will take this output
 DATE & 10:50:11 script,info Avg 3 Max 6 Min 1    Received 10/ from 10 
 
galleon2006
just joined
Topic Author
Posts: 22
Joined: Fri Jan 17, 2014 7:59 am

Re: Ping statistics

Mon Jan 20, 2014 7:30 am

Works perfect. Thank you so much!

Who is online

Users browsing this forum: No registered users and 20 guests