'Getting count of established connections to a host on apache server
Lets say I have 5 sites hosted on apache server. Now to get the total established connections to apache I can use:
netstat -anp | grep :80 | grep ESTABLISHED | wc -l
Which will show that I have about xx established connections.
Now if I want to know the count of connections to each of 5 sites/hosts is there any way for me to check this?
Thanks.
Solution 1:[1]
Since all your sites are hosted by the same apache server which is listening on the same port, it's difficult to distinguish the established connections for individual sites.
If the sites are hosted on application servers, you can try using netstat to individual JVM http ports which should give you the data for each jvm. That is if the sites are hosted on different JVMs.
So let's say if the Apache server is routing requests to 5 different JVMs for 5 sites, each JVM would be listening for HTTP connection on different host:port combination. If these JVMs are running on different machines, try to use following:
netstat -a|grep <JVM http port>|grep ESTABLISHED|wc -l
Please note, netstat would not give you exact number of client connections as there might be more than one entry for a particular port from the same client connection.
Thanks!
Solution 2:[2]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Puggan Se |
Solution 2 | sxn |