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.
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
Works perfect. Thank you so much!