Linux – Check the Number of active connections on port 80

apache-2.2linux

I have a webserver, i need to check number of connections in my server at that given time,

i used following

netstat -anp |grep 80 |wc -l

this returned with

2542

but from my google analytics's i know that simultaneous users is not more than 100.

is this correct ? 
if not how to i get the active number of connections ? 
is this sign of a victim of DOS attack how do i know that ?

Best Answer

Try just counting the ESTABLISHED connections:

netstat -anp | grep :80 | grep ESTABLISHED | wc -l

Also, be careful about not using a colon in your port grep statement. Just looking for 80 can lead to erroneous results from pids and other ports that happen to have the characters 80 in their output.