Skip to content

Instantly share code, notes, and snippets.

@yevrah
Last active November 24, 2015 05:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yevrah/1b19171c8eb4483bc71d to your computer and use it in GitHub Desktop.
Save yevrah/1b19171c8eb4483bc71d to your computer and use it in GitHub Desktop.
Apache: Mem Summary
#!/bin/bash
printf "\nMemory Status\n"
ps aux | grep '^apache' | awk '{print $1, $2, $11, $6/1024 " MB";}'
printf "\nSum: "
ps aux | grep '^apache' | awk '{sum+= $6;} END {print sum/1024 " MB";}'
printf "Average: "
ps aux | grep '^apache' | awk '{print $6/1024;}' | awk '{avg += ($1 - avg) / NR;} END {print avg " MB";}'
printf "Total Processes: "
ps aux | grep 'httpd' | awk '{sum+= 1;} END {print sum;}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment