Thursday, October 13, 2011

Display Apache Server Status with mod_status

Q. How do I display Apache server status such as current server activity and performance under Red Hat Enterprise Linux / UNIX / BSD?

A. You can use regular Linux / UNIX commands such as lsof, netstat, top, vmstat and others to view apache server activity, status and performance from a shell prompt. However, I recommend mod_status because it provides good information about Apache server.

mod_status Apache module

There is also mod_status built into Apache web server to get server status from a web browser. With this module you can easily find out how well your server is preforming. All reports are generated in a html format. You can easily find out following type of information:
  1. Total number of worker serving requests
  2. Total number of of idle worker
  3. Find the status of each worker, the number of requests that worker has performed and the total number of bytes served by the worker
  4. Total number byte count served
  5. Other information such as CPU usage, number of requests per second,current hosts and requests being processed etc.

How do I configure mod_status to display Apache web server status?

Open your httpd.conf / apache2.conf file:
# vi httpd.conf
Fnd out (append line) that read as follows to allow access from 10.1.2.5 only:

SetHandler server-status
Order Deny,Allow
Deny from all
Allow from 10.1.2.5
You can also restrict access using a domain name:

SetHandler server-status
Order Deny,Allow
Deny from all
Allow from w1.g2.dc3.helpdesk.nixcraft.com
Save and close the file. Restart web server, enter:
# service httpd restart
Fire a webbrowser and type the url http://your-server-ip/server-status or http://your-corp.com/server-status

Sample Apache Server Status Report



Add Image

Tuesday, February 8, 2011

Fix Apache - No space left on device: Couldn't create accept lock or Cannot create SSLMutex

When dealing with mem-leaks in my mod_perl-apps I ran into a curious apache-problem. After a while apache could not be started but failed with strange errors like: [emerg] (28)No space left on device: Couldn't create accept lock or [crit] (28)No space left on device: mod_rewrite: could not create rewrite_log_lock Configuration Failed or [Wed Dec 07 00:00:09 2005] [error] (28)No space left on device: Cannot create SSLMutex There was definitely enough space on the device where the locks are stored (default /usr/local/apache2/logs/). I tried to explicetely different Lockfiles using the LockFile-directive but this did not help. I also tried a non-default AcceptMutex (flock) which then solved the acceptlock-issue and ended in the rewrite_log_lock-issue. Only reboot of the system helped out of my crisis. Solution: There were myriads of semaphore-arrays left, owned by my apache-user.

ipcs -s | grep apache

Removing this semaphores immediately solved the problem.

ipcs -s | grep apacheipcs -s | grep apache | perl -e 'while () { @a=split(/\s+/); print `ipcrm sem $a[1]`}'


Then restart the Apache. No need to restart the server Just restart the server & enjoy the work.