A few apache one liners

Here are a few command used daily to check on apache and what it’s doing…

watch "netstat -plan|grep :80|awk {'print \$5'} | cut -d: -f 1 | sort | uniq -c | sort -nk 1"

output

Every 2.0s: netstat -plan|grep :80|awk {'print $5'} | cut -d: -f 1 | sort | uniq -c | sort -nk 1 Tue Mar 16 02:49:31 2010

1 0.0.0.0
1 69.167.132.171
1 71.2.208.233
3 98.238.142.3

To check the number of site connections, you can use:

/usr/bin/lynx -dump -width 500 http://127.0.0.1/whm-server-status | awk 'BEGIN { FS = " " } ; { print $12 }' | sed '/^$/d' | sort | uniq -c

output looks like

2 host.myserver.com
5 domain.com
1 process
1 slot
1 VHost

To check for the busiest site on the server;

/usr/bin/lynx -dump -width 500 http://127.0.0.1/whm-server-status | grep GET | awk '{print $12}' | sort | uniq -c | sort -rn | head

output looks like

69 domain.com
33 host.domain.com

To check for the busiest script on the server;

/usr/bin/lynx -dump -width 500 http://127.0.0.1/whm-server-status | grep GET | awk '{print $14}' | sort | uniq -c | sort -rn | head

output looks like

4 /whm-server-status
3 /info/wp-content/plugins/syntaxhighlighter/third-party-brus
2 /info/wp-content/plugins/syntaxhighlighter/syntaxhighlighte
1 /info/?p=338
1 /info/?p=2812
1 /info/2009/05/19/how-do-i-capture-the-output-of-%E2%80%9Cto
1 /info/2009/03/22/dns-error-important-do-not-ignore-this-ema

g33kadmin

I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.