Simple bandwidth monitor and traffic accountant

blov · 2016-02-03 03:44:08 · 621 次点击    
这是一个分享于 2016-02-03 03:44:08 的资源,其中的信息可能已经有所发展或是发生改变。

After a few angry phone calls with my ISP over me blowing past a stupid 300GB month transfer cap, and a few more completely empty threats about switching ISPs (we only have one ISP in my town, they know it, I know it...) I rolled a simple bandwidth monitoring application in golang with a web front end. The DB performance on boltdb was atrocious (only 2-3k get/put per second) when I was running tests, so if someone knows why don't keep it a secret.

Its designed to provide real time throughput as well as a summary by the minute, hour, day, and month. The minutes, hours, and days roll over but months are held forever. I didn't like the available solutions and I am guilty of the NIH as much as the next guy, so I figured I would share.

Not sure what this is going to accomplish, other than allowing me to squabble about the exact byte count when I am forced to call again and play this stupid dance over again...

monitor is at github.com/traetox/gobwmon

sample frontend is at github.com/traetox/bwmonfrontend

screenshot: http://i.imgur.com/SyMPdSo.png


评论:

mwholt:

YES, thank you, this is awesome.

For a couple years now I have been wanting to write something similar except it monitors speed, not transfer. I saw recently that somebody wrote a program for the raspberry pi that tweets to Comcast when their connection is slow, but I think that even just having a graph of connection speed over time would be interesting.

We need more software in the realm of keeping ISPs accountable.

jamra06:

Just shooting ideas...

Maybe you can use a simple proxy with a rate limiter like leaky bucket... Only create a ridiculously high limit. Then, when your leaky bucket rate limiter resets it's limit, which it should on a timer, write out the capacity used to bolt.

TheMerovius:

I'd argue that setting up a real timeseries-database (e.g. Prometheus) with a tiny program exporting bytes throughput would get you better results simpler, but good on you :)


入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

621 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传