{"id":3293,"date":"2010-07-05T11:19:29","date_gmt":"2010-07-05T15:19:29","guid":{"rendered":"http:\/\/g33kinfo.com\/info\/?p=3293"},"modified":"2010-07-05T11:19:29","modified_gmt":"2010-07-05T15:19:29","slug":"monitoring-bandwidth-usage-using-vnstat","status":"publish","type":"post","link":"https:\/\/g33kinfo.com\/info\/monitoring-bandwidth-usage-using-vnstat\/","title":{"rendered":"Monitoring bandwidth usage using vnstat"},"content":{"rendered":"<p>From webhostingwalk.com<\/p>\n<p>vnStat is a console-based network traffic monitor. It keeps a log of hourly, daily and monthly network traffic for the selected interface(s). However, it isn&#8217;t a packet sniffer. The traffic information is analyzed from the proc(5) and sys filesystems depending on availability. That way vnStat can be used even without root permissions on most systems.<\/p>\n<p><strong> A new database can be created with the following command:<\/strong><br \/>\n<code><br \/>\nvnstat -u -i eth0<br \/>\n<\/code><\/p>\n<p><strong> Show traffic for days.<\/strong><br \/>\n<code><br \/>\n# vnstat -d<\/p>\n<p>eth0  \/  daily<\/p>\n<p>         day         rx      |     tx      |    total    |   avg. rate<br \/>\n     ------------------------+-------------+-------------+---------------<br \/>\n      06\/30\/10      3.84 MiB |    3.29 MiB |    7.13 MiB |    1.22 kbit\/s<br \/>\n     ------------------------+-------------+-------------+---------------<br \/>\n     estimated         5 MiB |       5 MiB |      10 MiB |<br \/>\n<\/code><\/p>\n<p><strong> To list additional debug output:<\/strong><br \/>\n<code><br \/>\n# vnstat -D <\/p>\n<p>Config file: \/etc\/vnstat.conf<br \/>\n  c: Interface \"eth0\"<br \/>\n   -> \"Interface\": \"eth0\"<br \/>\n  c: DatabaseDir \"\/var\/lib\/vnstat\"<br \/>\n   -> \"DatabaseDir\": \"\/var\/lib\/vnstat\"<br \/>\n  c: Locale \"-\"<br \/>\n   -> \"Locale\": \"-\"<br \/>\n<\/code><\/p>\n<p><strong> To show traffic for the last 24 hours:<\/strong><br \/>\n<code><br \/>\n# vnstat -h <\/p>\n<p>eth0                                                                     13:19<br \/>\n  ^                                                                       r<br \/>\n  |                                                                       r<br \/>\n  |                                                                       rt<br \/>\n  |                                                                       rt<br \/>\n  |                                                                       rt<br \/>\n  |                                                                       rt<br \/>\n  |                                                                       rt<br \/>\n  |                                                                       rt<br \/>\n  |                                                                       rt<br \/>\n  |                                                                       rt<br \/>\n-+---------------------------------------------------------------------------><br \/>\n  |  14 15 16 17 18 19 20 21 22 23 00 01 02 03 04 05 06 07 08 09 10 11 12 13<\/p>\n<p>h  rx (KiB)   tx (KiB)      h  rx (KiB)   tx (KiB)      h  rx (KiB)   tx (KiB)<br \/>\n14          0          0    22          0          0    06          0          0<br \/>\n15          0          0    23          0          0    07          0          0<br \/>\n16          0          0    00          0          0    08          0          0<br \/>\n17          0          0    01          0          0    09          0          0<br \/>\n18          0          0    02          0          0    10          0          0<br \/>\n19          0          0    03          0          0    11          0          0<br \/>\n20          0          0    04          0          0    12        153        195<br \/>\n21          0          0    05          0          0    13       3779       3174<br \/>\n<\/code><\/p>\n<p><strong> Select one specific interface and apply actions to only it.<\/strong><br \/>\n<code><br \/>\n# vnstat -i eth0<br \/>\n<\/code><br \/>\n<strong> Show list of currently available interfaces.<\/strong><br \/>\n<code><br \/>\n# vnstat -iflist<\/p>\n<p>Available interfaces: lo eth0 eth1 sit0 vmnet1 vmnet8<br \/>\n<\/code><\/p>\n<p><strong> To Display current transfer rate for the selected interface in real time until interrupted.<\/strong> Statistics will be shown after interruption if the run- time was more than 10 seconds.<br \/>\n<code><br \/>\n# vnstat -l<\/p>\n<p>Monitoring eth0...    (press CTRL-C to stop)<\/p>\n<p>   rx:        4 kbit\/s     2 p\/s          tx:        4 kbit\/s     3 p\/s<br \/>\n<\/code><\/p>\n<p><strong> To show traffic for months.<\/strong><br \/>\n<code><br \/>\n# vnstat -m <\/p>\n<p>eth0  \/  monthly<\/p>\n<p>       month        rx      |     tx      |    total    |   avg. rate<br \/>\n    ------------------------+-------------+-------------+---------------<br \/>\n      Jun '10      3.84 MiB |    3.29 MiB |    7.13 MiB |    0.02 kbit\/s<br \/>\n    ------------------------+-------------+-------------+---------------<br \/>\n    estimated         3 MiB |       3 MiB |       6 MiB |<br \/>\n<\/code><\/p>\n<p><strong> To show traffic summary for selected interface using one line with a parseable format.<\/strong><br \/>\n<code><br \/>\n# vnstat --oneline<\/p>\n<p>1;eth0;06\/30\/10;3.84 MiB;3.29 MiB;7.13 MiB;1.22 kbit\/s;Jun '10;3.84 MiB;3.29 MiB;7.13 MiB;0.02 kbit\/s;3.84 MiB;3.29 MiB;7.13 MiB<br \/>\n<\/code><\/p>\n<p><strong> Show all time top10 traffic days.<\/strong><br \/>\n<code><br \/>\n# vnstat -t<br \/>\n<\/code><br \/>\n<strong> To calculate how much traffic goes through the selected interface during the given time seconds.<\/strong> The time will be 5 seconds if a number parameter isn&#8217;t included.<br \/>\n<code><br \/>\n54 packets sampled in 5 seconds<br \/>\nTraffic average for eth0<\/p>\n<p>      rx         6.40 kbit\/s             5 packets\/s<br \/>\n      tx         6.40 kbit\/s             5 packets\/s<br \/>\n<\/code><\/p>\n<p><strong> To update all enabled databases.<\/strong><br \/>\n<code><br \/>\n# vnstat -u<br \/>\n<\/code><br \/>\n<strong> To show traffic for 7 days, current and previous week.<\/strong><br \/>\n<code><br \/>\n# vnstat -w<\/p>\n<p>eth0  \/  weekly<\/p>\n<p>                      rx      |     tx      |    total    |   avg. rate<br \/>\n   ---------------------------+-------------+-------------+---------------<br \/>\n    last 7 days      3.84 MiB |    3.29 MiB |    7.13 MiB |    0.10 kbit\/s<br \/>\n   current week      3.84 MiB |    3.29 MiB |    7.13 MiB |    0.26 kbit\/s<br \/>\n   ---------------------------+-------------+-------------+---------------<br \/>\n      estimated         8 MiB |       8 MiB |      16 MiB |<br \/>\n<\/code><\/p>\n<p><strong> To delete database of interface eth2 and stop monitoring it.<\/strong><br \/>\n<code><br \/>\n# vnstat -i eth2 --delete<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>From webhostingwalk.com vnStat is a console-based network traffic monitor. It keeps a log of hourly, daily and monthly network traffic for the selected interface(s). However, it isn&#8217;t a packet sniffer. The traffic information is analyzed from the proc(5) and sys filesystems depending on availability. That way vnStat can be used even without root permissions on&#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"https:\/\/g33kinfo.com\/info\/monitoring-bandwidth-usage-using-vnstat\/\">Read More<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-3293","post","type-post","status-publish","format-standard","hentry","category-info"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Monitoring bandwidth usage using vnstat - Linux Shtuff<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/g33kinfo.com\/info\/monitoring-bandwidth-usage-using-vnstat\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Monitoring bandwidth usage using vnstat - Linux Shtuff\" \/>\n<meta property=\"og:description\" content=\"From webhostingwalk.com vnStat is a console-based network traffic monitor. It keeps a log of hourly, daily and monthly network traffic for the selected interface(s). However, it isn&#8217;t a packet sniffer. The traffic information is analyzed from the proc(5) and sys filesystems depending on availability. That way vnStat can be used even without root permissions on... Read More\" \/>\n<meta property=\"og:url\" content=\"https:\/\/g33kinfo.com\/info\/monitoring-bandwidth-usage-using-vnstat\/\" \/>\n<meta property=\"og:site_name\" content=\"Linux Shtuff\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/fb.me\/g33kinf0\" \/>\n<meta property=\"article:author\" content=\"https:\/\/fb.me\/g33kinf0\" \/>\n<meta property=\"article:published_time\" content=\"2010-07-05T15:19:29+00:00\" \/>\n<meta name=\"author\" content=\"g33kadmin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/drsinger1111\" \/>\n<meta name=\"twitter:site\" content=\"@drsinger1111\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/monitoring-bandwidth-usage-using-vnstat\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/monitoring-bandwidth-usage-using-vnstat\\\/\"},\"author\":{\"name\":\"g33kadmin\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"headline\":\"Monitoring bandwidth usage using vnstat\",\"datePublished\":\"2010-07-05T15:19:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/monitoring-bandwidth-usage-using-vnstat\\\/\"},\"wordCount\":211,\"publisher\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"articleSection\":[\"General Info\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/monitoring-bandwidth-usage-using-vnstat\\\/\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/monitoring-bandwidth-usage-using-vnstat\\\/\",\"name\":\"Monitoring bandwidth usage using vnstat - Linux Shtuff\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#website\"},\"datePublished\":\"2010-07-05T15:19:29+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/monitoring-bandwidth-usage-using-vnstat\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/g33kinfo.com\\\/info\\\/monitoring-bandwidth-usage-using-vnstat\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/monitoring-bandwidth-usage-using-vnstat\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Monitoring bandwidth usage using vnstat\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#website\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/\",\"name\":\"Linux Shtuff\",\"description\":\"Because I have CRS Syndrome...\",\"publisher\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\",\"name\":\"g33kadmin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"contentUrl\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"width\":512,\"height\":512,\"caption\":\"g33kadmin\"},\"logo\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\"},\"description\":\"I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com\\\/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....\",\"sameAs\":[\"https:\\\/\\\/thelinuxreport.com\",\"https:\\\/\\\/fb.me\\\/g33kinf0\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/drsinger1111\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Monitoring bandwidth usage using vnstat - Linux Shtuff","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/g33kinfo.com\/info\/monitoring-bandwidth-usage-using-vnstat\/","og_locale":"en_US","og_type":"article","og_title":"Monitoring bandwidth usage using vnstat - Linux Shtuff","og_description":"From webhostingwalk.com vnStat is a console-based network traffic monitor. It keeps a log of hourly, daily and monthly network traffic for the selected interface(s). However, it isn&#8217;t a packet sniffer. The traffic information is analyzed from the proc(5) and sys filesystems depending on availability. That way vnStat can be used even without root permissions on... Read More","og_url":"https:\/\/g33kinfo.com\/info\/monitoring-bandwidth-usage-using-vnstat\/","og_site_name":"Linux Shtuff","article_publisher":"https:\/\/fb.me\/g33kinf0","article_author":"https:\/\/fb.me\/g33kinf0","article_published_time":"2010-07-05T15:19:29+00:00","author":"g33kadmin","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/drsinger1111","twitter_site":"@drsinger1111","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/g33kinfo.com\/info\/monitoring-bandwidth-usage-using-vnstat\/#article","isPartOf":{"@id":"https:\/\/g33kinfo.com\/info\/monitoring-bandwidth-usage-using-vnstat\/"},"author":{"name":"g33kadmin","@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"headline":"Monitoring bandwidth usage using vnstat","datePublished":"2010-07-05T15:19:29+00:00","mainEntityOfPage":{"@id":"https:\/\/g33kinfo.com\/info\/monitoring-bandwidth-usage-using-vnstat\/"},"wordCount":211,"publisher":{"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"articleSection":["General Info"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/g33kinfo.com\/info\/monitoring-bandwidth-usage-using-vnstat\/","url":"https:\/\/g33kinfo.com\/info\/monitoring-bandwidth-usage-using-vnstat\/","name":"Monitoring bandwidth usage using vnstat - Linux Shtuff","isPartOf":{"@id":"https:\/\/g33kinfo.com\/info\/#website"},"datePublished":"2010-07-05T15:19:29+00:00","breadcrumb":{"@id":"https:\/\/g33kinfo.com\/info\/monitoring-bandwidth-usage-using-vnstat\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/g33kinfo.com\/info\/monitoring-bandwidth-usage-using-vnstat\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/g33kinfo.com\/info\/monitoring-bandwidth-usage-using-vnstat\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/g33kinfo.com\/info\/"},{"@type":"ListItem","position":2,"name":"Monitoring bandwidth usage using vnstat"}]},{"@type":"WebSite","@id":"https:\/\/g33kinfo.com\/info\/#website","url":"https:\/\/g33kinfo.com\/info\/","name":"Linux Shtuff","description":"Because I have CRS Syndrome...","publisher":{"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/g33kinfo.com\/info\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547","name":"g33kadmin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","url":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","contentUrl":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","width":512,"height":512,"caption":"g33kadmin"},"logo":{"@id":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif"},"description":"I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com\/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....","sameAs":["https:\/\/thelinuxreport.com","https:\/\/fb.me\/g33kinf0","https:\/\/x.com\/https:\/\/twitter.com\/drsinger1111"]}]}},"_links":{"self":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts\/3293","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/comments?post=3293"}],"version-history":[{"count":0,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts\/3293\/revisions"}],"wp:attachment":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/media?parent=3293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/categories?post=3293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/tags?post=3293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}