Editing Monitoring bandwidth of containers

Jump to: navigation, search

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/dev inside a container, dump stats into a round robin database (rrd)
+
{{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
 
## Default folder for containers
 
VE_PRIVATE=/var/lib/vz/private
 
  
  
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=$VE_PRIVATE/$BWVE/$BWDIR
+
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 $VE_PRIVATE/$VES; then
+
         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=%s\nOUT=%s\n", $1, $9}'`
+
                 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]]
[[Category: Networking]]
 

Please note that all contributions to OpenVZ Virtuozzo Containers Wiki may be edited, altered, or removed by other contributors. If you don't want your writing to be edited mercilessly, then don't submit it here.
If you are going to add external links to an article, read the External links policy first!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)