2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00
contrib-munin/plugins/openvz/vpsmem

65 lines
1.7 KiB
Plaintext
Raw Normal View History

2008-07-25 11:33:11 +02:00
#!/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/
2010-08-13 15:46:30 +02:00
# Cleaned up and translated to english by: Marian Sigler <m@qjym.de>, 2010-08-13
2008-07-25 11:33:11 +02:00
#
#%# capabilities=autoconf
2010-08-13 15:46:30 +02:00
BEANCOUNTERS=/proc/user_beancounters
2008-07-25 11:33:11 +02:00
if [ "$1" == "autoconf" ]; then
2010-08-16 01:54:01 +02:00
if [ -e $BEANCOUNTERS ]; then
echo yes
exit 0
else
echo no
exit 1
fi
2008-07-25 11:33:11 +02:00
fi
2010-08-13 15:46:30 +02:00
if [ ! -r $BEANCOUNTERS ]; then
echo "$BEANCOUNTERS not readable" >&2
exit 1
fi
2008-07-25 11:33:11 +02:00
if [ "$1" == "config" ]; then
2010-08-13 15:46:30 +02:00
limit=$(awk '/privvmpages/ {print $5*4096}' $BEANCOUNTERS)
cut -c9- <<EOF
graph_args --base 1024 -l 0 --vertical-label bytes --upper-limit $limit
graph_title VPS memory usage
graph_category memory
2010-08-13 15:46:30 +02:00
graph_info Shows memory usage and VPS memory limits.
graph_order maxheld held oomguar barrier limit
held.label held
held.draw AREA
held.info currently held memory
maxheld.label maxheld
maxheld.draw AREA
maxheld.info maximum held memory
oomguar.label guaranteed
oomguar.draw LINE2
oomguar.info memory guaranteed for OOM
barrier.label barrier
barrier.draw LINE2
barrier.info memory usage barrier
limit.label limit
limit.draw LINE2
limit.info memory usage limit
EOF
2010-08-16 01:54:01 +02:00
exit 0
2008-07-25 11:33:11 +02:00
fi
2010-08-16 01:54:01 +02:00
if [ -n "$1" ]; then
2010-08-13 15:46:30 +02:00
echo "Invalid argument: $1" >&2
exit 1
fi
2008-07-25 11:33:11 +02:00
2010-08-13 15:46:30 +02:00
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