Changes

Jump to: navigation, search

Monitoring bandwidth of containers

31 bytes added, 12:11, 18 March 2010
m
no need for displaytitle
{{DISPLAYTITLE:Monitoring bandwith of containers}} Use the /proc/net/dev/net inside a container, dump stats into a round robin database (rrd)
<pre>
BWDIR=var/rrd/vz
 
## Default folder for containers
VE_PRIVATE=/var/lib/vz/private
# Define the full path to the bandwidth VE directory and the storage dir.
CBWDIR=/vz/private$VE_PRIVATE/$BWVE/$BWDIR
# Test and make sure that directory is there, if not create it.
# Delete the .rrd file because its obviously not needed anymore.
if ! test -d /vz/private$VE_PRIVATE/$VES; then
echo $i will be deleted
rm -rf $CBWDIR/vps-$VES.rrd
X=`/usr/sbin/vzctl exec $i "grep venet0 /proc/net/dev"`
eval `echo $X | cut -f2 -d: | awk '{printf"IN=%-11ds\nOUT=%-11ds\n", $1, $9}'`
for g in IN OUT;do
[[Category: HOWTO]]
 
[[Category: Monitoring]]
[[Category: Networking]]

Navigation menu