<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Person @ CREATIVEDESK &#187; vnstat</title>
	<atom:link href="http://hardik.in/tag/vnstat/feed/" rel="self" type="application/rss+xml" />
	<link>http://hardik.in</link>
	<description>Hardik Dalwadi</description>
	<lastBuildDate>Fri, 06 Jan 2012 10:04:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Keep track  of your bandwidth usage using vnstat on Ubuntu</title>
		<link>http://hardik.in/2009/07/12/keep-track-of-your-bandwidth-usage-using-vnstat-on-ubuntu/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://hardik.in/2009/07/12/keep-track-of-your-bandwidth-usage-using-vnstat-on-ubuntu/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 18:30:15 +0000</pubDate>
		<dc:creator>Hardik Dalwadi</dc:creator>
				<category><![CDATA[9.04]]></category>
		<category><![CDATA[Archives]]></category>
		<category><![CDATA[GNU / Linux]]></category>
		<category><![CDATA[Jaunty]]></category>
		<category><![CDATA[Bandwidth]]></category>
		<category><![CDATA[Broadband]]></category>
		<category><![CDATA[Reliance]]></category>
		<category><![CDATA[Reports]]></category>
		<category><![CDATA[Service]]></category>
		<category><![CDATA[Track]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[vnstat]]></category>

		<guid isPermaLink="false">http://hardik.in/?p=180</guid>
		<description><![CDATA[I have already covered My User Experience with Reliance Netconnect – Broadband+ service and Ubuntu 9.04. Now as i said in previous article it&#8217;s very hard to track bandwidth usage with Reliance Netconnect – Broadband+ service using on-line facility  Reliance Mycare. I don&#8217;t have any single word to praise that service. We all know the [...]]]></description>
			<content:encoded><![CDATA[<p>I have already covered <a href="http://hardik.in/2009/07/01/reliance-netconnect-broadband-service-on-ubuntu-9-04-and-my-experience/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">My User Experience with Reliance Netconnect – Broadband+ service and Ubuntu 9.04</a>. Now as i said in previous article it&#8217;s very hard to track bandwidth usage with Reliance Netconnect – Broadband+ service using on-line facility  <a href="http://www.rcom.co.in/RNetconnect/RNC/ecaremyusage.jsp">Reliance Mycare</a>. I don&#8217;t have any single word to praise that service. We all know the Reliance Netconnect – Broadband+ service is not offering any unlimited bandwidth usage package. So INTERNET  savvy should keep track their bandwidth usage or else you would be jump in 5 digit monthly bill (Imagine @ 2 INR / MB). Which nobody can afford. I have 10 GB Day + 10 GB Night plan.</p>
<p>So, here is my way to keep track of bandwidth usage using <a href="http://humdi.net/vnstat/">vnstat</a> in Ubuntu.</p>
<pre>Q. What is vnstat?
A. vnStat is a console-based network traffic monitor for Linux and BSD that keeps a log of network traffic for the selected
    interface(s).</pre>
<p>Simply install the vnstat from Ubuntu repository with you favorite installation method ( synaptic / aptitude / apt-get / &#8230;). I am <a href="http://en.wikipedia.org/wiki/Advanced_Packaging_Tool">apt-get</a> fan.</p>
<pre>person@CANONICALDESK:~$ sudo apt-get install vnstat</pre>
<p>Now, as i said i want to keep track  of  bandwidth usage of my Reliance Netconnect Broadband+ service. Which is always running to &#8216;ppp0&#8242; interface. So first create the database of &#8216;ppp0&#8242; for vnstat.</p>
<pre>person@CANONICALDESK:~$ sudo vnstat -u -i ppp0

Error:

Unable to read database "/var/lib/vnstat/ppp0".

-&gt; A new database has been created.

person@CANONICALDESK:~$</pre>
<p>You can also discover more option using &#8220;vnstat -h&#8221;.  Now every five minutes vnstat will run through cron to track the detail usage of bandwidth  (TX + RX @ ppp0). I am not sure when i am going to shutdown / hibernate / sleep my machine. Still i want as much accurate result as i can. Because of that i have decreased the default 5 minutes schedule time to 1 minute for vnstat. Here is my modified vnstat cron script.</p>
<pre>person@CANONICALDESK:~$ cat /etc/cron.d/vnstat

# /etc/cron.d/vnstat: crontab entries for the vnstat package

* *	* * *	root	if [ -x /usr/bin/vnstat ] &amp;&amp; [ `ls /var/lib/vnstat/ | wc -l` -ge 1 ]; then /usr/bin/vnstat -u; fi

person@CANONICALDESK:~$</pre>
<p>Time to take reports. We can also check / compare bandwidth usage with <a href="http://www.rcom.co.in/RNetconnect/RNC/ecaremyusage.jsp">Reliance Mycare</a> on-line report, which never generated for me <img src='http://hardik.in/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>Monthly Rport:</p>
<pre>
person@CANONICALDESK:~$ vnstat -i ppp0 -m

 ppp0  /  monthly

   month         rx      |      tx      |   total
-------------------------+--------------+--------------------------------------
  Jul '09       1.00 GB  |    63.47 MB  |     1.06 GB   %%%%%%%%%%%%%%%%%%%%%:
-------------------------+--------------+--------------------------------------
 estimated      2.69 GB  |      169 MB  |     2.85 GB
person@CANONICALDESK:~$
</pre>
<p>Weekly Report:</p>
<pre>
person@CANONICALDESK:~$ vnstat -i ppp0 -w

	ppp0  /  weekly

	                    rx      |       tx      |    total
	----------------------------+---------------+--------------
	  last 7 days    418.01 MB  |     39.00 MB  |    457.01 MB
	    last week    606.37 MB  |     24.46 MB  |    630.83 MB
	 current week    418.01 MB  |     39.00 MB  |    457.01 MB
	----------------------------+---------------+--------------
	    estimated       447 MB  |        41 MB  |       488 MB
person@CANONICALDESK:~$
</pre>
<p>Daily Report:</p>
<pre>
person@CANONICALDESK:~$ vnstat -i ppp0 -d

 ppp0  /  daily

    day         rx      |     tx      |  total
------------------------+-------------+----------------------------------------
   03.07.    251.93 MB  |   11.99 MB  |  263.92 MB   %%%%%%%%%%%%%%%%:
   04.07.    354.43 MB  |   12.48 MB  |  366.91 MB   %%%%%%%%%%%%%%%%%%%%%%%%:
   09.07.    140.25 MB  |   19.11 MB  |  159.36 MB   %%%%%%%%%:
   10.07.     60.12 MB  |   10.25 MB  |   70.37 MB   %%%:
   11.07.    148.81 MB  |    6.27 MB  |  155.08 MB   %%%%%%%%%%
   12.07.     68.83 MB  |    3.39 MB  |   72.22 MB   %%%%
------------------------+-------------+----------------------------------------
 estimated      124 MB  |       5 MB  |     129 MB
person@CANONICALDESK:~$
</pre>
<p>Hourly Report:</p>
<pre>
person@CANONICALDESK:~$ vnstat -i ppp0 -h
 ppp0                                                                     13:09
  ^                                                                    r
  |                                                                    r
  |                                                                    r
  |                                                                    r
  |                                                                    r
  |                                                                    r
  |                                                                    r
  |                                                                    r
  |                                                                    r
  |                                                                    r
 -+--------------------------------------------------------------------------->
  |  14 15 16 17 18 19 20 21 22 23 00 01 02 03 04 05 06 07 08 09 10 11 12 13    

 h   rx (kB)    tx (kB)      h   rx (kB)    tx (kB)      h   rx (kB)    tx (kB)
14          0          0    22          0          0    06          0          0
15          0          0    23          0          0    07          0          0
16          0          0    00          0          0    08          0          0
17          0          0    01          0          0    09          0          0
18          0          0    02          0          0    10          0          0
19          0          0    03          0          0    11          0          0
20          0          0    04          0          0    12      70595       3506
21          0          0    05          0          0    13        311        108
person@CANONICALDESK:~$
</pre>
<p>I think above reports are sufficient to make argument against unfair bill right <img src='http://hardik.in/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . There is also web base support for this application. Please do &#8220;Google&#8221; for more information.</p>
<p><strong>Update:</strong></p>
<p>If you want to stick with latest version of vnstat. Then please follow <a href="http://tronprog.blogspot.com/2009/10/keep-track-of-your-network-usage-using.html">this</a></p>
]]></content:encoded>
			<wfw:commentRss>http://hardik.in/2009/07/12/keep-track-of-your-bandwidth-usage-using-vnstat-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

