How to check number of connections to the Apache server?
netstat command will show you the accurate connections to each of your service. In order to check the number of connections to port 80, use the netstat command and grep the Apache port.
List the connections to port 80:
netstat -alntp | grep :80
To check the number of connections to port 80:
netstat -alntp | grep :80 | wc -l
List the remote IPs connecting to your server on port 80:
netstat -alntp | grep :80 | awk ‘{print $5}’ | cut -d: -f1 | sort
List the uniq remote IPs and the number of connections from each IP:
netstat -alntp | grep :80 | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n
Please note: If you copy paste the above commands on your server, the single quote around the {} brackets may change to dots (.) and the command will fail, so make sure you replace those dots with the singe quote and execute the command.
January 5th, 2012 at 11:46 am
If there are two Nic’s on the server, how to find which nic APache is listening on
January 6th, 2012 at 9:34 am
In this case, Apache by default will listen on the first NIC i.e. eth0 unless defined to listen on eth1 or other.