#!/bin/bash # # Monitors memory usage in openVZ or Virtuozzo # based on http://www.huschi.net/archiv/speicher-anzeigen-mit-vzfree.html # Author: Michael Richter, http://osor.de/ # Cleaned up and translated to english by: Marian Sigler , 2010-08-13 # #%# capabilities=autoconf BEANCOUNTERS=/proc/user_beancounters if [ "$1" == "autoconf" ]; then if [ -e $BEANCOUNTERS ]; then echo yes else echo no fi exit 0 fi if [ ! -r $BEANCOUNTERS ]; then echo "$BEANCOUNTERS not readable" >&2 exit 1 fi if [ "$1" == "config" ]; then limit=$(awk '/privvmpages/ {print $5*4096}' $BEANCOUNTERS) cut -c9- <&2 exit 1 fi awk '/privvmpages/ {print "held.value", $2*4096 "\nmaxheld.value", $3*4096 "\nbarrier.value", $4*4096 "\nlimit.value", $5*4096}' $BEANCOUNTERS awk '/oomguarpages/ { print "oomguar.value", $4*4096 }' $BEANCOUNTERS