Skip to topic | Skip to bottom
Home
Sysadmin
Sysadmin.ApacheExternalStatsr1.1 - 04 Nov 2006 - 04:10 - AlsteRtopic end
You are here: Sysadmin > ApacheExternalStats

Start of topic | Skip to actions

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 ''

to top

You are here: Sysadmin > ApacheExternalStats

to top

Copyright © 1999-2008 by the contributing authors.
All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding this tool? Send feedback (in English, Francais, Deutsch or Dutch).