<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Alticon-brian</id>
	<title>OpenVZ Virtuozzo Containers Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Alticon-brian"/>
	<link rel="alternate" type="text/html" href="https://wiki.openvz.org/Special:Contributions/Alticon-brian"/>
	<updated>2026-05-15T20:50:59Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Traffic_accounting_through_proc&amp;diff=3575</id>
		<title>Traffic accounting through proc</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Traffic_accounting_through_proc&amp;diff=3575"/>
		<updated>2007-11-09T23:49:26Z</updated>

		<summary type="html">&lt;p&gt;Alticon-brian: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Traffic Accounting through /proc/net/dev&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;0&amp;quot; align=&amp;quot;right&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|__TOC__&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
Traffic accounting in OpenVZ can be done through data collection against /proc/net/dev in the individual VEs on a HN.&lt;br /&gt;
&lt;br /&gt;
=Prerequisites=&lt;br /&gt;
 * OpenVZ&lt;br /&gt;
 * RRDTool&lt;br /&gt;
 * Gnu AWK&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Script=&lt;br /&gt;
First create a directory to store your RRD files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 # mkdir /var/lib/rrd/&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The install this script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 # Script Name:  vz_direct_traffic_log&lt;br /&gt;
 # Author:       &amp;quot;Brian Harrington, Alticon Inc&amp;quot; &amp;lt;bharrington@alticon.net&amp;gt;&lt;br /&gt;
 # Website:      htty://www.alticon.net&lt;br /&gt;
 &lt;br /&gt;
 # Time to do the data collection.&lt;br /&gt;
 for veid in `/usr/sbin/vzlist -o veid | grep -v VEID | sed 's/ //g'`; do&lt;br /&gt;
  &lt;br /&gt;
                RRDFILE=&amp;quot;/var/lib/rrd/$veid.rrd&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
                if ! test -e $RRDFILE; then&lt;br /&gt;
                        echo $RRDFILE does not exist, creating.&lt;br /&gt;
                        # Place your preferred RRD Creation command here&lt;br /&gt;
                fi&lt;br /&gt;
  &lt;br /&gt;
                # Parse out the inbound/outbound traffic and assign them to the corresponding variables&lt;br /&gt;
                eval `/usr/sbin/vzctl exec $veid &amp;quot;grep venet0 /proc/net/dev&amp;quot;  |  \&lt;br /&gt;
                        awk -F: '{print $2}' | awk '{printf&amp;quot;VEIN=%-15d\nVEOUT=%-15d\n&amp;quot;, $1, $9}'`&lt;br /&gt;
  &lt;br /&gt;
                #Send the data to the corresponding RRD time with (N)now as the update time&lt;br /&gt;
                /usr/bin/rrdtool update $RRDFILE N:$VEIN:$VEOUT&lt;br /&gt;
 done&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
Add this to cron to run every 5 minutes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 # cat &amp;quot;*/5 * * * * root /path/to/script/vz_direct_traffic_log &amp;quot; &amp;gt; /etc/crontab &amp;amp;&amp;amp; /etc/init.d/crontab restart&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the output of this later run:&lt;br /&gt;
&lt;br /&gt;
 # rrdtool fetch /var/lib/rrd/&amp;lt;veid&amp;gt;.rrd AVERAGE -s -3600&lt;br /&gt;
&lt;br /&gt;
__NOEDITSECTION__&lt;/div&gt;</summary>
		<author><name>Alticon-brian</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Traffic_accounting_through_proc&amp;diff=3574</id>
		<title>Traffic accounting through proc</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Traffic_accounting_through_proc&amp;diff=3574"/>
		<updated>2007-11-09T23:44:58Z</updated>

		<summary type="html">&lt;p&gt;Alticon-brian: New page: Traffic Accounting through /proc/net/dev  {|border=&amp;quot;0&amp;quot; align=&amp;quot;right&amp;quot; |- |__TOC__ |}  =Introduction= Traffic accounting in OpenVZ can be done through data collection against /proc/net/dev i...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Traffic Accounting through /proc/net/dev&lt;br /&gt;
&lt;br /&gt;
{|border=&amp;quot;0&amp;quot; align=&amp;quot;right&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|__TOC__&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
Traffic accounting in OpenVZ can be done through data collection against /proc/net/dev in the individual VEs on a HN.&lt;br /&gt;
&lt;br /&gt;
=Prerequisites=&lt;br /&gt;
  * OpenVZ&lt;br /&gt;
  * RRDTool&lt;br /&gt;
  * Gnu AWK&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Script=&lt;br /&gt;
First create a directory to store your RRD files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 # mkdir /var/lib/rrd/&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The install this script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 # Script Name:  vz_direct_traffic_log&lt;br /&gt;
 # Author:       &amp;quot;Brian Harrington, Alticon Inc&amp;quot; &amp;lt;bharrington@alticon.net&amp;gt;&lt;br /&gt;
 # Website:      htty://www.alticon.net&lt;br /&gt;
 &lt;br /&gt;
 # Time to do the data collection.&lt;br /&gt;
 for veid in `/usr/sbin/vzlist -o veid | grep -v VEID | sed 's/ //g'`; do&lt;br /&gt;
  &lt;br /&gt;
                RRDFILE=&amp;quot;/var/lib/rrd/$veid.rrd&amp;quot;&lt;br /&gt;
  &lt;br /&gt;
                if ! test -e $RRDFILE; then&lt;br /&gt;
                        echo $RRDFILE does not exist, creating.&lt;br /&gt;
                        # Place your preferred RRD Creation command here&lt;br /&gt;
                fi&lt;br /&gt;
  &lt;br /&gt;
                # Parse out the inbound/outbound traffic and assign them to the corresponding variables&lt;br /&gt;
                eval `/usr/sbin/vzctl exec $veid &amp;quot;grep venet0 /proc/net/dev&amp;quot;  |  \&lt;br /&gt;
                        awk -F: '{print $2}' | awk '{printf&amp;quot;VEIN=%-15d\nVEOUT=%-15d\n&amp;quot;, $1, $9}'`&lt;br /&gt;
  &lt;br /&gt;
                #Send the data to the corresponding RRD time with (N)now as the update time&lt;br /&gt;
                /usr/bin/rrdtool update $RRDFILE N:$VEIN:$VEOUT&lt;br /&gt;
 done&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Setup=&lt;br /&gt;
Add this to cron to run every 5 minutes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 # cat &amp;quot;*/5 * * * * root /path/to/script/vz_direct_traffic_log &amp;quot; &amp;gt; /etc/crontab &amp;amp;&amp;amp; /etc/init.d/crontab restart&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To check the output of this later run:&lt;br /&gt;
&lt;br /&gt;
 # rrdtool fetch /var/lib/rrd/&amp;lt;veid&amp;gt;.rrd AVERAGE -s -3600&lt;/div&gt;</summary>
		<author><name>Alticon-brian</name></author>
		
	</entry>
</feed>