New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Mechanized ping
Microlinux
Member
in Help
I thought I'd share this in case anyone else finds it useful.
I modified (with a dull chainsaw) the standard ping tool to print output in an easily parsed format.
You can do things like this:
ping -c10 -i.2 -W1 -q yahoo.com
1466055205 yahoo.com 206.190.36.45 10 10 0 47 47 48 0
(timestamp finished, target, resolved ip, sent, recvd, pctloss, min, avg, max, mdev)
Or this:
ping -c10 -i.2 -W1 yahoo.com
1 28
2 28
3 28
4 28
5 29
6 28
7 28
8 28
9 27
10 28
1466055264 yahoo.com 98.139.183.24 10 10 0 27 28 29 0
Or this:
cat list-of-targets.txt | xargs -n1 -I^ -P100 ping -c10 -i.2 -W1 -q ^ 2> /dev/null
It's easy to do thousands of targets per minute with the above.
I don't know if I've covered every corner case, but it works for what I need to do . . . so far.
https://github.com/microlinux/iputils/tree/mechanized
Standard build process then sudo setcap cap_net_raw+p ./ping
Thanked by 1ElChile