ApacheExternalStats
Table of content :
Description
Summary: Use this when Apache does not serve requests and you are unable to determine why by other means.
I currently have to deal with a system where Apache is the only (and a massive) resource hog, bringing the system to its knees. As soon as it's serving a certain number of concurrent requests, it will not accept further connections. As such, you cannot use 'server-info' and 'server-status' to determine what's wrong (as you'd need to have apache server another HTTP request). So I use this little script to determine what's causing the many connections to the server.
This is in no way a solution to the original problem (where Apache is very limited in the number of concurrent requests it is able to serve), but helps diagnosing and crafting intermediary fixes.
Script
apache_external_stats.sh:
#!/bin/bash
# Gives some Apache related stats even when server-status is not available
# due to high load
echo ''
echo '-------------------------------------------------------------------------------'
echo ' GENERAL SYSTEM INFORMATION'
echo '-------------------------------------------------------------------------------'
w
echo ''
echo ''
echo '-------------------------------------------------------------------------------'
echo ' SYSTEM RESOURCES'
echo '-------------------------------------------------------------------------------'
vmstat -S M
echo ''
echo ''
echo '-------------------------------------------------------------------------------'
echo ' CURRENT APACHE PROCESSES'
echo '-------------------------------------------------------------------------------'
ps auxw | grep -E '(^USER|apache|httpd)' | grep -Ev "(grep -E|egrep|$0)"
echo ''
echo ''
echo '-------------------------------------------------------------------------------'
echo ' CURRENT APACHE CONNECTIONS'
echo '-------------------------------------------------------------------------------'
lsof -i | egrep ':(www|https)->' | sed 's/^.*->//' | sed 's/:.*$//' | sort | uniq -c | sort -r
echo ''