1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 02:51:03 +00:00

arp: use only awk to process ARP cache

Simplify the processing of the output of arp -an to use only awk.
Reduces the needed subprocesses in the pipe.
This commit is contained in:
Sven Hartge 2012-04-20 15:19:22 +02:00
parent fec8686c4e
commit 4a56eb1897
2 changed files with 2 additions and 4 deletions

View file

@ -38,6 +38,5 @@ if [ "$1" = "config" ]; then
exit 0 exit 0
fi fi
echo -n "entries.value " arp -an | awk 'BEGIN { regex="<incomplete>";} { if (!match($4,regex)) { a[$4] }} END{for(i in a){n++};print "entries.value " n}'
arp -an | grep -v "incomplete" | awk '{ print $4; }' | sort -u | wc -l

View file

@ -51,6 +51,5 @@ if [ "$1" = "config" ]; then
exit 0 exit 0
fi fi
echo -n "entries.value " arp -an -i $INTERFACE | awk 'BEGIN { regex="<incomplete>";} { if (!match($4,regex)) { a[$4] }} END{for(i in a){n++};print "entries.value " n}'
arp -an -i $INTERFACE | grep -v "incomplete" | awk '{ print $4; }' | sort -u | wc -l