Build precise queries to find exactly what you need
Press ESC to close
Nagios World Conference 2026: Sept. 14-17 in St. Paul, MN | Learn More
1) for me, at least, the arp command is /usr/sbin/arp
2) it might be better to just replace everything from the gta= line to the ttl= line with something like:
ttl=$( /usr/sbin/arp -n | grep ether | awk ‘{ print $3 }’ | sort | uniq -d | wc -l )
This is 10 times faster (on my relatively small net), but only counts 1 for each mac that appears two or more times. If you want a MAC appearing three times to give a count of two, try:
gta=`/usr/sbin/arp -n | grep ether | awk ‘{ print $3 }’` gtl=`echo “$gta” | sort -u | wc -l` tot=`echo “$gta” | wc -l` ttl=$(( $tot – $gtl ))