{"id":1271,"date":"2010-03-05T21:53:28","date_gmt":"2010-03-05T15:53:28","guid":{"rendered":"http:\/\/www.dotcomunderground.com\/blogs\/?p=1271"},"modified":"2010-03-05T23:51:38","modified_gmt":"2010-03-05T17:51:38","slug":"install-vnstat-network-traffic-monitor-linux","status":"publish","type":"post","link":"https:\/\/www.dotcomunderground.com\/blogs\/2010\/03\/05\/install-vnstat-network-traffic-monitor-linux\/","title":{"rendered":"How to install vnStat &#8211; Network Traffic Monitor for Linux"},"content":{"rendered":"<p><a href=\"http:\/\/humdi.net\/vnstat\/\"><strong>vnStat<\/strong><\/a> is a console-based network traffic monitor for Linux and BSD that keeps a log of network traffic for the selected interface(s). It uses the network interface statistics provided by the kernel as information source. This means that vnStat won&#8217;t actually be sniffing any traffic and also ensures light use of system resources.<\/p>\n<p>You can download the latest version on vnStat <a href=\"http:\/\/humdi.net\/vnstat\/\">here<\/a>.<br \/>\n<!--adsense--><\/p>\n<p><strong>How to install vnStat:<\/strong><br \/>\n<code>wget http:\/\/humdi.net\/vnstat\/vnstat-1.10.tar.gz<\/code><br \/>\n<em>(replace vnstat-<strong>1.10<\/strong>.tar.gz with the latest version number)<\/em><\/p>\n<p><code>tar -zxvf vnstat-1.10.tar.gz<\/code><\/p>\n<p><code>cd vnstat-1.10<\/code><\/p>\n<p><code>make<\/code><\/p>\n<p><code>make install<\/code><\/p>\n<p><!--adsense#LinksSquare--><\/p>\n<p><strong>Create Database for vnStat<\/strong>:<br \/>\nEvery interface that should be monitored needs to be introduced<br \/>\n to vnStat. For that you need to create a database for every interface you want to monitor.<\/p>\n<p>Check for available interface names then run:<br \/>\n<code>vnstat --iflist<\/code><br \/>\nand select a suitable looking interface from the provided list. Usually<br \/>\n &#8216;lo&#8217; isn&#8217;t the one you are looking for. For dedicated servers it should be <strong>eth0<\/strong> and <strong>venet0<\/strong> for VPS.<br \/>\n<!--adsense#LinksLine--><\/p>\n<p>To create database for eth0:<br \/>\n<code>\/usr\/bin\/vnstat -u -i eth0<\/code><\/p>\n<p>Replace &#8216;<strong>eth0<\/strong>&#8216; in the command with any available interface if needed.<\/p>\n<p>Repeat that for every other interface you wish to use.<\/p>\n<p><strong>Set init Script for vnStat:<\/strong><br \/>\n<code>cp examples\/init.d\/redhat\/vnstat \/etc\/init.d<\/code><br \/>\n<code>chkconfig --add vnstat<\/code><br \/>\n<code>chkconfig vnstat on<\/code><br \/>\n<code>service vnstat start<\/code><\/p>\n<p>vnStat should now be running on your system.<\/p>\n<p><strong>Using vnStat<\/strong>:<br \/>\nAfter installation, it take some time to generate bandwidth usage stats. So you need to wait few hours before you can check the stats. During the time, vnstat cronjob runs and collect data from your server to generate the report.<\/p>\n<p>To see the bandwidth usage stat:<br \/>\n<code>vnstat<\/code><br \/>\n<code>vnstat -d<\/code><br \/>\n<code>vnstat -m<\/code><\/p>\n<p>Here is an sample vnstat report:<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.dotcomunderground.com\/blogs\/wp-content\/uploads\/2010\/03\/vnStat-Network-Traffic-Monitor-for-Linux.jpg\" alt=\"\" title=\"vnStat - Network Traffic Monitor for Linux\" width=\"500\" height=\"313\" class=\"alignnone size-full wp-image-1272\" srcset=\"https:\/\/www.dotcomunderground.com\/blogs\/wp-content\/uploads\/2010\/03\/vnStat-Network-Traffic-Monitor-for-Linux.jpg 500w, https:\/\/www.dotcomunderground.com\/blogs\/wp-content\/uploads\/2010\/03\/vnStat-Network-Traffic-Monitor-for-Linux-300x187.jpg 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>vnStat is a console-based network traffic monitor for Linux and BSD that keeps a log of network traffic for the selected interface(s). It uses the network interface statistics provided by the kernel as information source. This means that vnStat won&#8217;t actually be sniffing any traffic and also ensures light use of system resources. You can [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,9,13],"tags":[211,126,212,127],"class_list":["post-1271","post","type-post","status-publish","format-standard","hentry","category-tech","category-tips","category-tutorials","tag-cenoos","tag-linux","tag-root","tag-unix"],"_links":{"self":[{"href":"https:\/\/www.dotcomunderground.com\/blogs\/wp-json\/wp\/v2\/posts\/1271","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dotcomunderground.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dotcomunderground.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dotcomunderground.com\/blogs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dotcomunderground.com\/blogs\/wp-json\/wp\/v2\/comments?post=1271"}],"version-history":[{"count":0,"href":"https:\/\/www.dotcomunderground.com\/blogs\/wp-json\/wp\/v2\/posts\/1271\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dotcomunderground.com\/blogs\/wp-json\/wp\/v2\/media?parent=1271"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dotcomunderground.com\/blogs\/wp-json\/wp\/v2\/categories?post=1271"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dotcomunderground.com\/blogs\/wp-json\/wp\/v2\/tags?post=1271"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}