{"id":266,"date":"2008-07-03T14:31:10","date_gmt":"2008-07-03T13:31:10","guid":{"rendered":"http:\/\/cyberelk.net\/tim\/?p=266"},"modified":"2014-05-20T09:09:13","modified_gmt":"2014-05-20T08:09:13","slug":"monitoring-bandwidth-during-peak-hours","status":"publish","type":"post","link":"https:\/\/cyberelk.net\/tim\/2008\/07\/03\/monitoring-bandwidth-during-peak-hours\/","title":{"rendered":"Monitoring bandwidth during peak hours"},"content":{"rendered":"<p>Like many ISPs in Britain, mine allows me unlimited downloads during off-peak hours but has a monthly restriction on downloads during peak hours.\u00a0 Peak currently means 6pm until midnight, although next month it will be changing to 9am until 11pm.\u00a0 I thought it would be a good idea to monitor how close to my quota I am, to see if this will affect me.<\/p>\n<p><!--more--><\/p>\n<p>I found the <a href=\"http:\/\/humdi.net\/vnstat\/\">vnstat<\/a> project, which is already packaged for Fedora, and this is almost exactly what I needed.\u00a0 After installing the package, I just needed to configure it:<\/p>\n<ol>\n<li>Edit <tt>\/etc\/sysconfig\/vnstat<\/tt> to make sure the correct network interface is monitored.<\/li>\n<li>Edit <tt>\/etc\/cron.d\/vnstat<\/tt> and uncomment the line that enables network interface monitoring (not sure why this comes commented out).<\/li>\n<li>Edit <tt>\/etc\/vnstat.conf<\/tt> and check that everything looks right.  I changed the locale, but I&#8217;m not sure why it doesn&#8217;t use the system locale.\u00a0 Maybe something to do with cron?<\/li>\n<\/ol>\n<p>It works by gathering data from the proc filesystem and using it to update a simple database file each time it is run from cron.<\/p>\n<p>The only missing piece was the ability to examine network usage during peak hours only.\u00a0 I&#8217;ve sent a patch for this to the maintainer, and put a small git repository here:<\/p>\n<pre>git clone <a href=\"https:\/\/cyberelk.net\/tim\/data\/vnstat.git\">https:\/\/cyberelk.net\/tim\/data\/vnstat.git<\/a><\/pre>\n<p>If you&#8217;re reading this from the future and that link doesn&#8217;t work, hopefully it&#8217;s because the patch has been accepted&#8230;<\/p>\n<p>I can now see my actual peak usage so far, as well as the estimated total for this month.\u00a0 Here&#8217;s an example of the output (not real data):<\/p>\n<pre> eth0  \/  monthly\r\n\r\n   month         rx      |      tx      |   total\r\n-------------------------+--------------+--------------------------------------\r\n  Jul '08       1.34 GB  |   103.00 MB  |     1.44 GB   %%%%%%%%%%%%%%%%%%%%::\r\n   (peak)      32.57 MB  |     1.71 MB  |    34.28 MB\r\n-------------------------+--------------+--------------------------------------\r\n estimated     16.10 GB  |     1.21 GB  |    17.31 GB\r\n   (peak)        384 MB  |       12 MB  |      396 MB<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Like many ISPs in Britain, mine allows me unlimited downloads during off-peak hours but has a monthly restriction on downloads during peak hours.\u00a0 Peak currently means 6pm until midnight, although next month it will be changing to 9am until 11pm.\u00a0 I thought it would be a good idea to monitor how close to my quota [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[3],"tags":[],"class_list":["post-266","post","type-post","status-publish","format-standard","hentry","category-software"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Monitoring bandwidth during peak hours - PRINT HEAD<\/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:\/\/cyberelk.net\/tim\/2008\/07\/03\/monitoring-bandwidth-during-peak-hours\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Monitoring bandwidth during peak hours - PRINT HEAD\" \/>\n<meta property=\"og:description\" content=\"Like many ISPs in Britain, mine allows me unlimited downloads during off-peak hours but has a monthly restriction on downloads during peak hours.\u00a0 Peak currently means 6pm until midnight, although next month it will be changing to 9am until 11pm.\u00a0 I thought it would be a good idea to monitor how close to my quota [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cyberelk.net\/tim\/2008\/07\/03\/monitoring-bandwidth-during-peak-hours\/\" \/>\n<meta property=\"og:site_name\" content=\"PRINT HEAD\" \/>\n<meta property=\"article:published_time\" content=\"2008-07-03T13:31:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2014-05-20T08:09:13+00:00\" \/>\n<meta name=\"author\" content=\"Tim Waugh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Tim Waugh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/cyberelk.net\\\/tim\\\/2008\\\/07\\\/03\\\/monitoring-bandwidth-during-peak-hours\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/cyberelk.net\\\/tim\\\/2008\\\/07\\\/03\\\/monitoring-bandwidth-during-peak-hours\\\/\"},\"author\":{\"name\":\"Tim Waugh\",\"@id\":\"https:\\\/\\\/cyberelk.net\\\/tim\\\/#\\\/schema\\\/person\\\/23b749f30a67f1b1c6af17024fc94bf6\"},\"headline\":\"Monitoring bandwidth during peak hours\",\"datePublished\":\"2008-07-03T13:31:10+00:00\",\"dateModified\":\"2014-05-20T08:09:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/cyberelk.net\\\/tim\\\/2008\\\/07\\\/03\\\/monitoring-bandwidth-during-peak-hours\\\/\"},\"wordCount\":267,\"publisher\":{\"@id\":\"https:\\\/\\\/cyberelk.net\\\/tim\\\/#\\\/schema\\\/person\\\/23b749f30a67f1b1c6af17024fc94bf6\"},\"articleSection\":[\"Software\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/cyberelk.net\\\/tim\\\/2008\\\/07\\\/03\\\/monitoring-bandwidth-during-peak-hours\\\/\",\"url\":\"https:\\\/\\\/cyberelk.net\\\/tim\\\/2008\\\/07\\\/03\\\/monitoring-bandwidth-during-peak-hours\\\/\",\"name\":\"Monitoring bandwidth during peak hours - PRINT HEAD\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/cyberelk.net\\\/tim\\\/#website\"},\"datePublished\":\"2008-07-03T13:31:10+00:00\",\"dateModified\":\"2014-05-20T08:09:13+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/cyberelk.net\\\/tim\\\/2008\\\/07\\\/03\\\/monitoring-bandwidth-during-peak-hours\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/cyberelk.net\\\/tim\\\/2008\\\/07\\\/03\\\/monitoring-bandwidth-during-peak-hours\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/cyberelk.net\\\/tim\\\/2008\\\/07\\\/03\\\/monitoring-bandwidth-during-peak-hours\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/cyberelk.net\\\/tim\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Monitoring bandwidth during peak hours\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/cyberelk.net\\\/tim\\\/#website\",\"url\":\"https:\\\/\\\/cyberelk.net\\\/tim\\\/\",\"name\":\"PRINT HEAD\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/cyberelk.net\\\/tim\\\/#\\\/schema\\\/person\\\/23b749f30a67f1b1c6af17024fc94bf6\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/cyberelk.net\\\/tim\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/cyberelk.net\\\/tim\\\/#\\\/schema\\\/person\\\/23b749f30a67f1b1c6af17024fc94bf6\",\"name\":\"Tim Waugh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/cyberelk.net\\\/tim\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/printhead.png\",\"url\":\"https:\\\/\\\/cyberelk.net\\\/tim\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/printhead.png\",\"contentUrl\":\"https:\\\/\\\/cyberelk.net\\\/tim\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/printhead.png\",\"width\":731,\"height\":140,\"caption\":\"Tim Waugh\"},\"logo\":{\"@id\":\"https:\\\/\\\/cyberelk.net\\\/tim\\\/wp-content\\\/uploads\\\/2023\\\/01\\\/printhead.png\"},\"sameAs\":[\"http:\\\/\\\/cyberelk.net\\\/tim\"],\"url\":\"https:\\\/\\\/cyberelk.net\\\/tim\\\/author\\\/twaugh\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Monitoring bandwidth during peak hours - PRINT HEAD","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:\/\/cyberelk.net\/tim\/2008\/07\/03\/monitoring-bandwidth-during-peak-hours\/","og_locale":"en_GB","og_type":"article","og_title":"Monitoring bandwidth during peak hours - PRINT HEAD","og_description":"Like many ISPs in Britain, mine allows me unlimited downloads during off-peak hours but has a monthly restriction on downloads during peak hours.\u00a0 Peak currently means 6pm until midnight, although next month it will be changing to 9am until 11pm.\u00a0 I thought it would be a good idea to monitor how close to my quota [&hellip;]","og_url":"https:\/\/cyberelk.net\/tim\/2008\/07\/03\/monitoring-bandwidth-during-peak-hours\/","og_site_name":"PRINT HEAD","article_published_time":"2008-07-03T13:31:10+00:00","article_modified_time":"2014-05-20T08:09:13+00:00","author":"Tim Waugh","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Tim Waugh","Estimated reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/cyberelk.net\/tim\/2008\/07\/03\/monitoring-bandwidth-during-peak-hours\/#article","isPartOf":{"@id":"https:\/\/cyberelk.net\/tim\/2008\/07\/03\/monitoring-bandwidth-during-peak-hours\/"},"author":{"name":"Tim Waugh","@id":"https:\/\/cyberelk.net\/tim\/#\/schema\/person\/23b749f30a67f1b1c6af17024fc94bf6"},"headline":"Monitoring bandwidth during peak hours","datePublished":"2008-07-03T13:31:10+00:00","dateModified":"2014-05-20T08:09:13+00:00","mainEntityOfPage":{"@id":"https:\/\/cyberelk.net\/tim\/2008\/07\/03\/monitoring-bandwidth-during-peak-hours\/"},"wordCount":267,"publisher":{"@id":"https:\/\/cyberelk.net\/tim\/#\/schema\/person\/23b749f30a67f1b1c6af17024fc94bf6"},"articleSection":["Software"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/cyberelk.net\/tim\/2008\/07\/03\/monitoring-bandwidth-during-peak-hours\/","url":"https:\/\/cyberelk.net\/tim\/2008\/07\/03\/monitoring-bandwidth-during-peak-hours\/","name":"Monitoring bandwidth during peak hours - PRINT HEAD","isPartOf":{"@id":"https:\/\/cyberelk.net\/tim\/#website"},"datePublished":"2008-07-03T13:31:10+00:00","dateModified":"2014-05-20T08:09:13+00:00","breadcrumb":{"@id":"https:\/\/cyberelk.net\/tim\/2008\/07\/03\/monitoring-bandwidth-during-peak-hours\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cyberelk.net\/tim\/2008\/07\/03\/monitoring-bandwidth-during-peak-hours\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/cyberelk.net\/tim\/2008\/07\/03\/monitoring-bandwidth-during-peak-hours\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cyberelk.net\/tim\/"},{"@type":"ListItem","position":2,"name":"Monitoring bandwidth during peak hours"}]},{"@type":"WebSite","@id":"https:\/\/cyberelk.net\/tim\/#website","url":"https:\/\/cyberelk.net\/tim\/","name":"PRINT HEAD","description":"","publisher":{"@id":"https:\/\/cyberelk.net\/tim\/#\/schema\/person\/23b749f30a67f1b1c6af17024fc94bf6"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cyberelk.net\/tim\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":["Person","Organization"],"@id":"https:\/\/cyberelk.net\/tim\/#\/schema\/person\/23b749f30a67f1b1c6af17024fc94bf6","name":"Tim Waugh","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/cyberelk.net\/tim\/wp-content\/uploads\/2023\/01\/printhead.png","url":"https:\/\/cyberelk.net\/tim\/wp-content\/uploads\/2023\/01\/printhead.png","contentUrl":"https:\/\/cyberelk.net\/tim\/wp-content\/uploads\/2023\/01\/printhead.png","width":731,"height":140,"caption":"Tim Waugh"},"logo":{"@id":"https:\/\/cyberelk.net\/tim\/wp-content\/uploads\/2023\/01\/printhead.png"},"sameAs":["http:\/\/cyberelk.net\/tim"],"url":"https:\/\/cyberelk.net\/tim\/author\/twaugh\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pnnS2-4i","_links":{"self":[{"href":"https:\/\/cyberelk.net\/tim\/wp-json\/wp\/v2\/posts\/266","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cyberelk.net\/tim\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cyberelk.net\/tim\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cyberelk.net\/tim\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/cyberelk.net\/tim\/wp-json\/wp\/v2\/comments?post=266"}],"version-history":[{"count":1,"href":"https:\/\/cyberelk.net\/tim\/wp-json\/wp\/v2\/posts\/266\/revisions"}],"predecessor-version":[{"id":1073,"href":"https:\/\/cyberelk.net\/tim\/wp-json\/wp\/v2\/posts\/266\/revisions\/1073"}],"wp:attachment":[{"href":"https:\/\/cyberelk.net\/tim\/wp-json\/wp\/v2\/media?parent=266"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cyberelk.net\/tim\/wp-json\/wp\/v2\/categories?post=266"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cyberelk.net\/tim\/wp-json\/wp\/v2\/tags?post=266"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}