Improvement for connection_info.sh script to show complete IPv6 addresses

JosKlever

Verified User
Joined
Jun 7, 2015
Messages
52
When a server gets a high load a report is created using the connection_info.sh script, but it cuts off the IPv6 addresses at the first colon.

Right now it uses:
Code:
netstat --numeric --tcp --udp | awk '/udp|tcp/ {split($5,p,/:/); print p[1]}'

Can that be replaced with this?
Code:
netstat --numeric --tcp --udp --wide | awk '/udp|tcp/ { sub(/:[0-9]+$/, "", $5); print $5 }'

The --wide parameter displays the complete IP address and replacing the split command with the sub command cuts off only the last part with the port number.
 
Back
Top