This scripts’ output show control result for a spesific port number and this ports’ total rate. This script can be helpful to analyze your application sockets’ usage . Just change PortID and run for your server. It can be used for Linux and Unix servers.
#!/bin/ksh totalSocket=netstat -an|wc -l OBSSocket=netstat -an|grep <portID>|wc -l ratio=echo "scale=2 ; ($OBSSocket/$totalSocket)" | bc echo “hostname %$ratio Total $totalSocket <PORTNAME> $OBSSocket”
Output for 22 port:
Ratio Total Port Socket Number %.02 346 8