Editing Monitoring bandwidth of containers
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | Use the /proc/net | + | {{DISPLAYTITLE:Monitoring bandwith of containers}} |
+ | |||
+ | Use the /proc/dev/net inside a container, dump stats into a round robin database (rrd) | ||
<pre> | <pre> | ||
Line 24: | Line 26: | ||
BWDIR=var/rrd/vz | BWDIR=var/rrd/vz | ||
− | |||
− | |||
− | |||
Line 36: | Line 35: | ||
# Define the full path to the bandwidth VE directory and the storage dir. | # Define the full path to the bandwidth VE directory and the storage dir. | ||
− | CBWDIR= | + | CBWDIR=/vz/private/$BWVE/$BWDIR |
# Test and make sure that directory is there, if not create it. | # Test and make sure that directory is there, if not create it. | ||
Line 53: | Line 52: | ||
# Delete the .rrd file because its obviously not needed anymore. | # Delete the .rrd file because its obviously not needed anymore. | ||
− | if ! test -d | + | if ! test -d /vz/private/$VES; then |
echo $i will be deleted | echo $i will be deleted | ||
rm -rf $CBWDIR/vps-$VES.rrd | rm -rf $CBWDIR/vps-$VES.rrd | ||
Line 84: | Line 83: | ||
X=`/usr/sbin/vzctl exec $i "grep venet0 /proc/net/dev"` | X=`/usr/sbin/vzctl exec $i "grep venet0 /proc/net/dev"` | ||
− | eval `echo $X | cut -f2 -d: | awk '{printf"IN=% | + | eval `echo $X | cut -f2 -d: | awk '{printf"IN=%-11d\nOUT=%-11d\n", $1, $9}'` |
for g in IN OUT;do | for g in IN OUT;do | ||
Line 97: | Line 96: | ||
[[Category: HOWTO]] | [[Category: HOWTO]] | ||
+ | |||
[[Category: Monitoring]] | [[Category: Monitoring]] | ||
− |