Check Apache Server Status From a Web Page
More on Apache Server
Sometimes you want to see how your server is doing without SSH'ing into the system. One way to do this is to set up a Web page that shows Apache status. Sound difficult? Not really, it's a default module for Apache and easy to enable.Want to see how your server is doing without SSH'ing into the system? One way to do this is to set up a Web page that shows the status of your Apache server. Here's how to get started.
What you can see from the status page, assuming you enable the extended status directive, is the server time, uptime, CPU usage, number of requests per second, and which VHosts are getting requests and for what pages. You'll also see the server version, and some of the modules (e.g., mod_python and PHP), but you shouldn't need a page to tell you that!
You'll also see a "scoreboard" that visualizes what the Apache workers are doing. At a glance you'll know if Apache has a relatively light load or if the server is being taxed. Now, obviously, this is not going to be very helpful if Apache is down or your site is being hammered so badly you can't get a decent response from Apache. But I like having a quick and easy way to eyeball Apache's status without logging into the server.
Note that Apache is configured differently, depending on which Linux or Unix distribution/flavor you happen to use. I'm going to show how to set it up on Debian/Ubuntu, but if you're using Red Hat, Fedora, OpenSUSE, or a BSD, the configuration files may be located in different spots.
You'll want to add the following to
ExtendedStatus On <Location /server-status> SetHandler server-status Order deny,allow Deny from all Allow from localhost ip6-localhost XX.XX.XX.XX # Allow from .example.com </Location>
Obviously, you'll want to replace XX.XX.XX.XX with the IP address of the system you'll be hitting the server from. If you view this from a bunch of locations, you can use htaccess to restrict it with a username and password. Or if you're feeling very open about your Apache status, you could switch the
Restart Apache and head to http://myserver.tld/server-status, and you'll see something like Figure 1. Simple, but effective. Now you'll be able to see your Apache status at a glance, from anywhere.
|Apache Server Status|
Joe 'Zonker' Brockmeier is a freelance writer and editor with more than 10 years covering IT. Formerly the openSUSE Community Manager for Novell, Brockmeier has written for Linux Magazine, Sys Admin, Linux Pro Magazine, IBM developerWorks, Linux.com, CIO.com, Linux Weekly News, ZDNet, and many other publications. You can reach Zonker at email@example.com and follow him on Twitter.