1
edit
Changes
no edit summary
= Extended plugin from Jan Tomasek =
* Jan has posted another plugin on http://forum.openvz.org/index.php?t=msg&goto=15122, where I've fixed two things:*# "exit 0" in the "config" block*# Replaced "vals=($str); echo ${vals[0]}" with "echo ${str%% *}" (the former was causing problems I don't remember anymore)* v1.3.2 (2008/08/09)*# If only 1 variable is graphed, also display maxheld, barrier and limit
<source lang="bash">
#!/bin/sh
# - "exit 0" in "config" block
# - Use "echo ${str%% *}" in "suggest", instead of "vals=($str); echo ${vals[0]}"
#
# Revision 1.3.2 2008/08/09 12:30:00 Christian Rubbert <crubbert@xrc.de>
# * Feature
# - If only 1 variable is graphed, also display maxheld, barrier and limit
#
# Original revision taken from:
#%# family=auto
#%# capabilities=autoconf suggest
VEID=`basename $0 | sed -e 's/^vebc_.*_//'`;
STATS=`basename $0 | sed -e 's/^vebc_//' -e 's/_[0-9]*$//' -e 's/_/ /g'`
x=0; STATSCNT=`for i in $STATS; do x=$[$x+1]; done; echo $x`
if [ "$1" = "autoconf" ]; then
if [ -r /proc/bc/0/resources ]; then
fi
fi
if [ "$1" = "suggest" ]; then
if [ -r /proc/bc/0/resources ]; then
fi
fi
if [ ! -f /proc/bc/$VEID/resources ]; then
exit 0;
fi
if [ "$1" = "config" ]; then
#echo "graph_order down up"
echo "graph_vlabel bean counters"
echo "graph_category VE$VEID"
# Note on URLs. General graph info is by munin version 1.2.5
# accepted even with HTML code. But for value.info it escapes URL,
echo "graph_info VE bean counters info. Documentation of the OpenVZ resource management is located at <a href=\"
http://wiki.openvz.org/UBC\">http://wiki.openvz.org/UBC</a>."
cat /proc/bc/$VEID/resources | while read name value top warn max stuff ; do
for statname in $STATS; do
done
done
if [ "$STATSCNT" == "1" ]; then
echo maxheld.label Maxheld
echo maxheld.draw LINE2
echo maxheld.info Maximum value
echo barrier.label Barrier
echo barrier.draw LINE2
echo barrier.info Barrier
echo limit.label Limit
echo limit.draw LINE2
echo limit.info Limit
fi
exit 0
fi;
cat /proc/bc/$VEID/resources | while read name value top warn max stuff ; do
for statname in $STATS; do
if [ "$name" = "$statname" ]; then
echo $name".value "$value;
if [ "$STATSCNT" == "1" ]; then
echo maxheld.value $top
echo barrier.value $warn
echo limit.value $max
fi
fi
done
done</source>
= Munin plugin setup =