CPU, Memory Usage by Apache

APACHE PROCESSES THAT CPU OR MEMORY IS LARGER THAN 0

ps -A --sort -rss -o pid,comm,pcpu,pmem,lstart | grep httpd | awk '($3>0) || ($4>0)'

TOTAL CPU USED BY THE APACHE PROCESS

ps -A --sort -rss -o pid,comm,pcpu,pmem | grep httpd | awk '{n+=$3} END {print $2" total cpu: "n"%"}'

TOTAL MEMORY USED BY THE APACHE PROCESS

ps -A --sort -rss -o pid,comm,pcpu,pmem | grep httpd | awk '{n+=$4} END {print $2" total mem: "n"%"}'

TOTAL CPU AND MEMORY USED BY THE APACHE PROCESS

ps -A --sort -rss -o pid,comm,pcpu,pmem | grep httpd | awk '{x+=$3} {y+=$4} END {print $2" total cpu: "x"% mem: "y"%"}'

You can use server-status module to monitoring apache

lynx http://localhost/server-status?refresh=5
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s