1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-25 18:38:30 +00:00

cleaned up, translated to english

This commit is contained in:
Michael Richter, Marian Sigler 2010-08-13 15:46:30 +02:00 committed by Steve Schnepp
parent 2d2d3d609f
commit cc0439f102

View file

@ -3,11 +3,14 @@
# Monitors memory usage in openVZ or Virtuozzo # Monitors memory usage in openVZ or Virtuozzo
# based on http://www.huschi.net/archiv/speicher-anzeigen-mit-vzfree.html # based on http://www.huschi.net/archiv/speicher-anzeigen-mit-vzfree.html
# Author: Michael Richter, http://osor.de/ # Author: Michael Richter, http://osor.de/
# Cleaned up and translated to english by: Marian Sigler <m@qjym.de>, 2010-08-13
# #
#%# capabilities=autoconf #%# capabilities=autoconf
BEANCOUNTERS=/proc/user_beancounters
if [ "$1" == "autoconf" ]; then if [ "$1" == "autoconf" ]; then
if [ -e /proc/user_beancounters ]; then if [ -e $BEANCOUNTERS ]; then
echo yes echo yes
exit 0 exit 0
else else
@ -16,46 +19,46 @@ if [ "$1" == "autoconf" ]; then
fi fi
fi fi
x=$(cat /proc/user_beancounters | grep privvmpages| awk 'BEGIN{ cur=max=bar=lim=fail=0; }{ cur+=$2; max+=$3;bar+=$4;lim+=$5;fail+=$6 } END {print cur*4*1024,max*4*1024,bar*4*1024,lim*4*1024,fail}') if [ ! -r $BEANCOUNTERS ]; then
echo "$BEANCOUNTERS not readable" >&2
momentan=$(echo $x| awk '{print $1}') exit 1
maximalgenutzt=$(echo $x| awk '{print $2}') fi
barriere=$(echo $x| awk '{print $3}')
maximalnutzbar=$(echo $x| awk '{print $4}')
fehler=$(echo $x| awk '{print $5}')
zu=$(cat /proc/user_beancounters | grep oomguarpages | awk 'BEGIN{ bar=0; }{ bar+=$4 } END { print bar*4*1024}')
zugesichert=$(echo $zu| awk '{print $1}')
if [ "$1" == "config" ]; then if [ "$1" == "config" ]; then
echo "graph_args --base 1024 -l 0 --vertical-label Speicher --upper-limit $maximalnutzbar"; limit=$(awk '/privvmpages/ {print $5*4096}' $BEANCOUNTERS)
echo "graph_title VPS Speichernutzung" cut -c9- <<EOF
echo "graph_category system" graph_args --base 1024 -l 0 --vertical-label bytes --upper-limit $limit
echo "graph_info Diese Grafik zeigt die Speichernutzung." graph_title VPS memory usage
echo "graph_order maximal momentan zugesichert barriere limit" graph_category system
graph_info Shows memory usage and VPS memory limits.
echo "momentan.label Momentan" graph_order maxheld held oomguar barrier limit
echo "momentan.draw AREA"
echo "momentan.info Aktueller Speicherverbrauch" held.label held
echo "maximal.label Maximal" held.draw AREA
echo "maximal.draw AREA" held.info currently held memory
echo "maximal.info Maximaler Speicherverbrauch" maxheld.label maxheld
echo "zugesichert.label Zugesichert" maxheld.draw AREA
echo "zugesichert.draw LINE2" maxheld.info maximum held memory
echo "zugesichert.info Zugesicherter Speicher" oomguar.label guaranteed
echo "barriere.label Barriere" oomguar.draw LINE2
echo "barriere.draw LINE2" oomguar.info memory guaranteed for OOM
echo "barriere.info Maximal erlaubter Speicher" barrier.label barrier
echo "limit.label Limit" barrier.draw LINE2
echo "limit.draw LINE2" barrier.info memory usage barrier
echo "limit.info Maximal nutzbarer Speicher" limit.label limit
limit.draw LINE2
limit.info memory usage limit
EOF
exit 0 exit 0
fi fi
echo "momentan.value $momentan" if [ $# -gt 0 ]; then
echo "maximal.value $maximalgenutzt" echo "Invalid argument: $1" >&2
echo "zugesichert.value $zugesichert" exit 1
echo "barriere.value $barriere" fi
echo "limit.value $maximalnutzbar"
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