How do get apache display url request in Top and PS?

Is there a way to get apache to display the url that it is handling in top and ps? This would help us nail down performance issues much more faster.

Thanks.


Solution 1:

I believe this is not possible (without modifying source code/writing a module), but besides mod_status, there is also apachetop utility: enter image description here

Howewer, I've never worked with it and not sure, but it might be just a cli interface to mod_status output.

Solution 2:

Not with topor psbut you could enable mod_status in Apache. It wil give you this output:

Srv PID Acc M   CPU SS  Req Conn    Child   Slot    Client  VHost   Request
0-0 -   0/0/2680    .   74.29   49  316168  0.0 0.00    330.47  180.79.191.73   www.apache.org  GET /dist//nutch/apache-nutch-1.2-bin.tar.gz HTTP/1.1
0-0 -   0/0/2576    .   74.04   49  0   0.0 0.00    212.42  2.2.208.99  www.apache.org  GET /images/solaris.png HTTP/1.1
0-0 -   0/0/2766    .   74.02   49  0   0.0 0.00    202.77  82.193.224.70   mail-archives.apache.org    GET /mod_mbox/tuscany-dev/200704.mbox/raw/_3Cc0c051b50704201042
0-0 -   0/0/3158    .   74.01   49  0   0.0 0.00    214.33  60.218.27.26    www.apache.org  GET /1.3.8/struts-taglib/images/FreemarkerResult.html HTTP/1.0
0-0 -   0/0/2473    .   74.23   49  317004  0.0 0.00    79.76   180.79.191.73   www.apache.org  GET /dist//nutch/apache-nutch-1.2-bin.tar.gz HTTP/1.1
0-0 -   0/0/3303    .   74.70   49  378802  0.0 0.00    157.20  115.249.106.133 archive.apache.org  GET /dist/ant/binaries/apache-ant-1.8.0-bin.zip HTTP/1.1
0-0 -   0/0/2730    .   74.33   49  317609  0.0 0.00    106.99  180.79.191.73   www.apache.org  GET /dist//nutch/apache-nutch-1.2-bin.tar.gz HTTP/1.1
0-0 -   0/0/2694    .   74.02   49  626 0.0 0.00    432.47  61.135.184.212  wiki-online.apache.org  GET /velocity/HilfeZurAdministration HTTP/1.0
0-0 -   0/0/2542    .   74.27   49  308546  0.0 0.00    69.17   180.79.191.73   www.apache.org  GET /dist//nutch/apache-nutch-1.2-bin.tar.gz HTTP/1.1
0-0 -   0/0/3241    .   74.67   49  324949  0.0 0.00    264.43  180.79.191.73   www.apache.org  GET /dist//nutch/apache-nutch-1.2-bin.tar.gz HTTP/1.1
0-0 -   0/0/2804    .   74.47   49  304178  0.0 0.00    211.43  180.79.191.73   www.apache.org  GET /dist//nutch/apache-nutch-1.2-bin.tar.gz HTTP/1.1

Enabling it is easy:

a2enmod info

add these lines to your config (/etc/apache2/apache2.conf):

ExtendedStatus On
<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from .your_domain.com
</Location>

then restart your server

/etc/init.d/apache2 force-reload

If you enabled it, you can monitor the page at http://example.com/server-status?refresh=5 (if you want it to refresh every 5 sec)