Wednesday, March 18, 2009

Apache Monitoring From The Command Line

I wanted to get a quick sense of what one of my Apache web servers was up to, so I through together the following:

  1. I ssh'ed to the server
  2. Enabled mod_status, so the URL would work. I did this by adding in the following to my httpd.conf file:
    <Location /server-status>
    SetHandler server-status
    Order Deny,Allow
    Deny from all
    Allow from localhost
  3. Restarted the web server to have the above take effect
  4. Kicked off the command:
     lynx -dump http://localhost/server-status | head -30  

The result is a screen that refreshes every 2 seconds and tells me which processes in Apache are busy, and with what. Here's a sample screenshot:

Gosh I love Unix.

1 comment:

  1. Probably you meant :
    watch 'lynx -dump|head -n 30'