Changes

Jump to: navigation, search

Monitoring openvz resources using munin

714 bytes added, 23:55, 12 May 2008
Wikified (at least some more), added reference to another plugin, which uses vzlist
[[Category: Monitoring]]
{{wikify}}There are several plugins available on this page to monitor beancounter values in [http://munin.projects.linpro.no/ Munin].The third one tries to combine the other two.
== "Simple" munin plugin ==
The plugin listed below grabs all the beancounters' values.
if [ "$1" = "suggest" ]; then
 
if [ -r /proc/bc/0/resources ]; then
cat /proc/bc/0/resources |
while read str; do
 
vals=($str)
echo ${vals[0]}
done
 
exit 0
else
fi
fi
 
if [ "$1" = "config" ]; then
 
# echo "graph_order down up"
echo "graph_title $ATTR beancounter for containers"
echo 'graph_category system'
echo "graph_info 'Containers beancounters info'"
 
for CTID in `ls -d1 /proc/bc/???`; do
fi;
  for CTID in `ls -d1 /proc/bc/???`; do id=`basename $CTID` grep $ATTR $CTID/resources | while read str; do  vals=($str) name=${vals[0]} echo "$id.value ${vals[1]}" done done 
</source>
Please note, you have to configure plugin to run as root: <code>[vebc*]user root</code> at /etc/munin/plugin-conf.d/ somewhere.  = Extended Version for old system using user_beancounter.=
Put it with the munin plugins and make a link for every
if [ "$1" = "suggest" ]; then
 
if [ -r /proc/bc/0/resources ]; then
cat /proc/bc/0/resources |
while read str; do
 
vals=($str)
echo ${vals[0]}
done
 
exit 0
else
if [ "$1" = "config" ]; then
 
# echo "graph_order down up"
echo "graph_title beancounter for CT$ATTR: $STATS"
readme="false"
cat /proc/user_beancounters | while read myid stuff; do
 
line=""
 
if [ "$myid" == "$ATTR:" ]; then
 
readme="true"
line="$stuff"
echo $line
else
 
loid=`echo $myid | sed -e 's/.*:/:/'`
 
if [ "$loid" == ":" ]; then
 
readme="false"
fi
if [ "$readme" == "true" ]; then
 
line="$myid $stuff"
echo $line
fi
fi
 
done | while read name value top warn max; do
 
okname="dummy"
 
for statname in $STATS; do
 
if [ "$name" == "$statname" ]; then
 
okname=$name
fi
 
done
if [ "$okname" != "dummy" ]; then
 
echo $okname.label $name
echo $okname.warning $warn
fi
done
 
exit 0
fi;
 
readme="false"
cat /proc/user_beancounters | while read myid stuff; do
 
line=""
 
if [ "$myid" == "$ATTR:" ]; then
 
readme="true"
line="$stuff"
echo $line
else
 
loid=`echo $myid | sed -e 's/.*:/:/'`
 
if [ "$loid" == ":" ]; then
 
readme="false"
fi
 
if [ "$readme" == "true" ]; then
 
line="$myid $stuff"
echo $line
fi
done | while read name value x; do
 
okname="dummy"
 
for statname in $STATS; do
 
if [ "$name" == "$statname" ]; then
 
okname=$name
fi
done
 
if [ "$okname" != "dummy" ]; then
 
echo $okname.value $value
fi
done
 
</source>
== Another 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:
1. # "exit 0" in the "config" block2. # Replaced "vals=($str); echo ${vals[0]}" with "echo ${str%% *}" (the former was causing problems I don't remember anymore)
<source lang="bash">
</source>
 
= Munin plugin setup =
== Run as root ==
Please note, you have to configure plugin to run as root. Therefore, add the following to /etc/munin/plugin-conf.d/ somewhere:
[vebc*]
user root
 
== Installing the plugins ==
There's a single plugin file, which can be installed several times and can put several values into the same graph.
You should install the plugin from above to e.g. <code>/usr/local/share/munin/plugins/vebc_</code> and then put symlinks to there from /etc/munin/plugins.
The following script allows you to handle this easily:
To install this, you can use the following script:
<source lang="bash">
rm $FILE
</source>
 
 
= Notes =
== Another plugin, using vzlist ==
There is another plugin available at http://muninexchange.projects.linpro.no/?view&phid=249 - using vzlist and PHP.
Especially using "vzlist" to only gather the requested fields might be a faster approach.
3
edits

Navigation menu