Pastebin is 300% more awesome when you are logged in. Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 26th, 2012  |  syntax: None  |  size: 0.63 KB  |  hits: 29  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # OpenVZ lower memory utilization, according to
  2. # http://wiki.openvz.org/UBC_systemwide_configuration#.E2.80.9CLow_memory.E2.80.9D_.28x86_32_specific.29
  3. #
  4.  
  5. # AWK script to calculate lower memory utilization
  6. lowmem() {
  7.     awk '$1 ~ /kmemsize|tcprcvbuf|tcpsndbuf|dgramrcvbuf|othersockbuf/ { M+=$2 } END { print M  / (0.4 * 832 * 1024 * 1024 ) }' $*
  8. }
  9.  
  10. # Reading user bean counters, low mem usage is: 0.137789
  11. lowmem /proc/user_beancounters
  12.  
  13.  
  14. # Reading all resources files in /proc/bc, low mem usage is: 0.372573
  15. lowmem /proc/bc/*/resources
  16.  
  17. # Only counting running containers, low mem usage is: 0.288026
  18. lowmem /proc/bc/{101..108}/resources