rvnstat 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (271) hide show
  1. checksums.yaml +7 -0
  2. data/._README.md +0 -0
  3. data/._ss.png +0 -0
  4. data/.gitignore +17 -0
  5. data/Gemfile +6 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +34 -0
  8. data/Rakefile +1 -0
  9. data/bin/._rvnstat +0 -0
  10. data/bin/rvnstat +9 -0
  11. data/config.ru +4 -0
  12. data/config.yml +3 -0
  13. data/lib/._app.rb +0 -0
  14. data/lib/._config.rb +0 -0
  15. data/lib/._require.rb +0 -0
  16. data/lib/._rvnstat.rb +0 -0
  17. data/lib/._vnstat.rb +0 -0
  18. data/lib/app.rb +102 -0
  19. data/lib/config.rb +13 -0
  20. data/lib/require.rb +10 -0
  21. data/lib/rvnstat.rb +5 -0
  22. data/lib/rvnstat/._version.rb +0 -0
  23. data/lib/rvnstat/version.rb +3 -0
  24. data/lib/vnstat.rb +74 -0
  25. data/public/CNAME +1 -0
  26. data/public/CONTRIBUTING.md +192 -0
  27. data/public/Gruntfile.js +418 -0
  28. data/public/LICENSE +21 -0
  29. data/public/README.md +173 -0
  30. data/public/_config.yml +35 -0
  31. data/public/bower.json +24 -0
  32. data/public/browserstack.json +44 -0
  33. data/public/composer.json +25 -0
  34. data/public/dist/css/._custom.css +0 -0
  35. data/public/dist/css/bootstrap-theme.css +347 -0
  36. data/public/dist/css/bootstrap-theme.css.map +1 -0
  37. data/public/dist/css/bootstrap-theme.min.css +7 -0
  38. data/public/dist/css/bootstrap.css +5831 -0
  39. data/public/dist/css/bootstrap.css.map +1 -0
  40. data/public/dist/css/bootstrap.min.css +7 -0
  41. data/public/dist/css/custom.css +20 -0
  42. data/public/dist/fonts/glyphicons-halflings-regular.eot +0 -0
  43. data/public/dist/fonts/glyphicons-halflings-regular.svg +229 -0
  44. data/public/dist/fonts/glyphicons-halflings-regular.ttf +0 -0
  45. data/public/dist/fonts/glyphicons-halflings-regular.woff +0 -0
  46. data/public/dist/js/bootstrap.js +1951 -0
  47. data/public/dist/js/bootstrap.min.js +6 -0
  48. data/public/docs/LICENSE +319 -0
  49. data/public/docs/_data/glyphicons.yml +203 -0
  50. data/public/docs/_data/showcase.yml +19 -0
  51. data/public/docs/_includes/ads.html +1 -0
  52. data/public/docs/_includes/customizer-variables.html +1690 -0
  53. data/public/docs/_includes/footer.html +70 -0
  54. data/public/docs/_includes/header.html +42 -0
  55. data/public/docs/_includes/nav-about.html +9 -0
  56. data/public/docs/_includes/nav-components.html +138 -0
  57. data/public/docs/_includes/nav-css.html +127 -0
  58. data/public/docs/_includes/nav-customize.html +46 -0
  59. data/public/docs/_includes/nav-getting-started.html +62 -0
  60. data/public/docs/_includes/nav-javascript.html +89 -0
  61. data/public/docs/_includes/nav-main.html +36 -0
  62. data/public/docs/_includes/nav-migration.html +12 -0
  63. data/public/docs/_includes/social-buttons.html +16 -0
  64. data/public/docs/_layouts/default.html +55 -0
  65. data/public/docs/_layouts/home.html +18 -0
  66. data/public/docs/about.html +149 -0
  67. data/public/docs/assets/css/docs.css +1394 -0
  68. data/public/docs/assets/css/docs.min.css +6 -0
  69. data/public/docs/assets/css/pygments-manni.css +66 -0
  70. data/public/docs/assets/ico/apple-touch-icon-144-precomposed.png +0 -0
  71. data/public/docs/assets/ico/favicon.ico +0 -0
  72. data/public/docs/assets/img/components.png +0 -0
  73. data/public/docs/assets/img/devices.png +0 -0
  74. data/public/docs/assets/img/sass-less.png +0 -0
  75. data/public/docs/assets/js/application.js +101 -0
  76. data/public/docs/assets/js/customize.min.js +49 -0
  77. data/public/docs/assets/js/customizer.js +348 -0
  78. data/public/docs/assets/js/docs.min.js +16 -0
  79. data/public/docs/assets/js/ie8-responsive-file-warning.js +12 -0
  80. data/public/docs/assets/js/raw-files.min.js +8 -0
  81. data/public/docs/assets/js/vendor/blob.js +166 -0
  82. data/public/docs/assets/js/vendor/filesaver.js +236 -0
  83. data/public/docs/assets/js/vendor/holder.js +645 -0
  84. data/public/docs/assets/js/vendor/jszip.js +1474 -0
  85. data/public/docs/assets/js/vendor/less.min.js +16 -0
  86. data/public/docs/assets/js/vendor/uglify.min.js +14 -0
  87. data/public/docs/components.html +3001 -0
  88. data/public/docs/css.html +3346 -0
  89. data/public/docs/customize.html +356 -0
  90. data/public/docs/customizer-nav.jade +15 -0
  91. data/public/docs/customizer-variables.jade +21 -0
  92. data/public/docs/dist/css/bootstrap-theme.css.map +1 -0
  93. data/public/docs/dist/css/bootstrap-theme.min.css +7 -0
  94. data/public/docs/dist/css/bootstrap.css.map +1 -0
  95. data/public/docs/dist/css/bootstrap.min.css +7 -0
  96. data/public/docs/dist/fonts/glyphicons-halflings-regular.eot +0 -0
  97. data/public/docs/dist/fonts/glyphicons-halflings-regular.svg +229 -0
  98. data/public/docs/dist/fonts/glyphicons-halflings-regular.ttf +0 -0
  99. data/public/docs/dist/fonts/glyphicons-halflings-regular.woff +0 -0
  100. data/public/docs/dist/js/bootstrap.min.js +7 -0
  101. data/public/docs/examples/blog/blog.css +168 -0
  102. data/public/docs/examples/blog/index.html +171 -0
  103. data/public/docs/examples/carousel/carousel.css +148 -0
  104. data/public/docs/examples/carousel/index.html +206 -0
  105. data/public/docs/examples/cover/cover.css +161 -0
  106. data/public/docs/examples/cover/index.html +75 -0
  107. data/public/docs/examples/dashboard/dashboard.css +93 -0
  108. data/public/docs/examples/dashboard/index.html +243 -0
  109. data/public/docs/examples/grid/grid.css +28 -0
  110. data/public/docs/examples/grid/index.html +152 -0
  111. data/public/docs/examples/jumbotron-narrow/index.html +82 -0
  112. data/public/docs/examples/jumbotron-narrow/jumbotron-narrow.css +79 -0
  113. data/public/docs/examples/jumbotron/index.html +99 -0
  114. data/public/docs/examples/jumbotron/jumbotron.css +5 -0
  115. data/public/docs/examples/justified-nav/index.html +84 -0
  116. data/public/docs/examples/justified-nav/justified-nav.css +88 -0
  117. data/public/docs/examples/navbar-fixed-top/index.html +91 -0
  118. data/public/docs/examples/navbar-fixed-top/navbar-fixed-top.css +4 -0
  119. data/public/docs/examples/navbar-static-top/index.html +92 -0
  120. data/public/docs/examples/navbar-static-top/navbar-static-top.css +7 -0
  121. data/public/docs/examples/navbar/index.html +90 -0
  122. data/public/docs/examples/navbar/navbar.css +8 -0
  123. data/public/docs/examples/non-responsive/index.html +105 -0
  124. data/public/docs/examples/non-responsive/non-responsive.css +120 -0
  125. data/public/docs/examples/offcanvas/index.html +130 -0
  126. data/public/docs/examples/offcanvas/offcanvas.css +51 -0
  127. data/public/docs/examples/offcanvas/offcanvas.js +5 -0
  128. data/public/docs/examples/screenshots/blog.jpg +0 -0
  129. data/public/docs/examples/screenshots/carousel.jpg +0 -0
  130. data/public/docs/examples/screenshots/cover.jpg +0 -0
  131. data/public/docs/examples/screenshots/dashboard.jpg +0 -0
  132. data/public/docs/examples/screenshots/grid.jpg +0 -0
  133. data/public/docs/examples/screenshots/jumbotron-narrow.jpg +0 -0
  134. data/public/docs/examples/screenshots/jumbotron.jpg +0 -0
  135. data/public/docs/examples/screenshots/justified-nav.jpg +0 -0
  136. data/public/docs/examples/screenshots/navbar-fixed.jpg +0 -0
  137. data/public/docs/examples/screenshots/navbar-static.jpg +0 -0
  138. data/public/docs/examples/screenshots/navbar.jpg +0 -0
  139. data/public/docs/examples/screenshots/non-responsive.jpg +0 -0
  140. data/public/docs/examples/screenshots/offcanvas.jpg +0 -0
  141. data/public/docs/examples/screenshots/sign-in.jpg +0 -0
  142. data/public/docs/examples/screenshots/starter-template.jpg +0 -0
  143. data/public/docs/examples/screenshots/sticky-footer-navbar.jpg +0 -0
  144. data/public/docs/examples/screenshots/sticky-footer.jpg +0 -0
  145. data/public/docs/examples/screenshots/theme.jpg +0 -0
  146. data/public/docs/examples/signin/index.html +50 -0
  147. data/public/docs/examples/signin/signin.css +40 -0
  148. data/public/docs/examples/starter-template/index.html +68 -0
  149. data/public/docs/examples/starter-template/starter-template.css +7 -0
  150. data/public/docs/examples/sticky-footer-navbar/index.html +91 -0
  151. data/public/docs/examples/sticky-footer-navbar/sticky-footer-navbar.css +45 -0
  152. data/public/docs/examples/sticky-footer/index.html +55 -0
  153. data/public/docs/examples/sticky-footer/sticky-footer.css +38 -0
  154. data/public/docs/examples/theme/index.html +384 -0
  155. data/public/docs/examples/theme/theme.css +14 -0
  156. data/public/docs/getting-started.html +773 -0
  157. data/public/docs/grunt/bs-glyphicons-data-generator.js +33 -0
  158. data/public/docs/grunt/bs-lessdoc-parser.js +236 -0
  159. data/public/docs/grunt/bs-raw-files-generator.js +31 -0
  160. data/public/docs/index.html +72 -0
  161. data/public/docs/javascript.html +2141 -0
  162. data/public/docs/migration.html +423 -0
  163. data/public/fonts/glyphicons-halflings-regular.eot +0 -0
  164. data/public/fonts/glyphicons-halflings-regular.svg +229 -0
  165. data/public/fonts/glyphicons-halflings-regular.ttf +0 -0
  166. data/public/fonts/glyphicons-halflings-regular.woff +0 -0
  167. data/public/js/._exporting.js +0 -0
  168. data/public/js/._highcharts-all.js +0 -0
  169. data/public/js/._jquery-min.js +0 -0
  170. data/public/js/.jscs.json +15 -0
  171. data/public/js/.jshintrc +14 -0
  172. data/public/js/affix.js +137 -0
  173. data/public/js/alert.js +88 -0
  174. data/public/js/bootstrap.min.js +6 -0
  175. data/public/js/button.js +107 -0
  176. data/public/js/carousel.js +205 -0
  177. data/public/js/collapse.js +170 -0
  178. data/public/js/dropdown.js +147 -0
  179. data/public/js/highcharts.js +294 -0
  180. data/public/js/jquery-1.11.0.min.js +4 -0
  181. data/public/js/modal.js +243 -0
  182. data/public/js/popover.js +110 -0
  183. data/public/js/scrollspy.js +153 -0
  184. data/public/js/tab.js +125 -0
  185. data/public/js/tests/index.html +54 -0
  186. data/public/js/tests/unit/affix.js +50 -0
  187. data/public/js/tests/unit/alert.js +62 -0
  188. data/public/js/tests/unit/button.js +122 -0
  189. data/public/js/tests/unit/carousel.js +110 -0
  190. data/public/js/tests/unit/collapse.js +164 -0
  191. data/public/js/tests/unit/dropdown.js +218 -0
  192. data/public/js/tests/unit/modal.js +195 -0
  193. data/public/js/tests/unit/phantom.js +69 -0
  194. data/public/js/tests/unit/popover.js +133 -0
  195. data/public/js/tests/unit/scrollspy.js +36 -0
  196. data/public/js/tests/unit/tab.js +86 -0
  197. data/public/js/tests/unit/tooltip.js +432 -0
  198. data/public/js/tests/vendor/jquery.js +6 -0
  199. data/public/js/tests/vendor/qunit.css +245 -0
  200. data/public/js/tests/vendor/qunit.js +2210 -0
  201. data/public/js/tooltip.js +399 -0
  202. data/public/js/transition.js +48 -0
  203. data/public/less/.csscomb.json +297 -0
  204. data/public/less/.csslintrc +19 -0
  205. data/public/less/alerts.less +67 -0
  206. data/public/less/badges.less +55 -0
  207. data/public/less/bootstrap.less +49 -0
  208. data/public/less/breadcrumbs.less +26 -0
  209. data/public/less/button-groups.less +226 -0
  210. data/public/less/buttons.less +155 -0
  211. data/public/less/carousel.less +232 -0
  212. data/public/less/close.less +33 -0
  213. data/public/less/code.less +63 -0
  214. data/public/less/component-animations.less +29 -0
  215. data/public/less/dropdowns.less +213 -0
  216. data/public/less/forms.less +419 -0
  217. data/public/less/glyphicons.less +233 -0
  218. data/public/less/grid.less +100 -0
  219. data/public/less/input-groups.less +157 -0
  220. data/public/less/jumbotron.less +44 -0
  221. data/public/less/labels.less +64 -0
  222. data/public/less/list-group.less +110 -0
  223. data/public/less/media.less +56 -0
  224. data/public/less/mixins.less +926 -0
  225. data/public/less/modals.less +138 -0
  226. data/public/less/navbar.less +616 -0
  227. data/public/less/navs.less +242 -0
  228. data/public/less/normalize.less +423 -0
  229. data/public/less/pager.less +55 -0
  230. data/public/less/pagination.less +88 -0
  231. data/public/less/panels.less +230 -0
  232. data/public/less/popovers.less +133 -0
  233. data/public/less/print.less +101 -0
  234. data/public/less/progress-bars.less +80 -0
  235. data/public/less/responsive-utilities.less +93 -0
  236. data/public/less/scaffolding.less +134 -0
  237. data/public/less/tables.less +233 -0
  238. data/public/less/theme.less +247 -0
  239. data/public/less/thumbnails.less +36 -0
  240. data/public/less/tooltip.less +95 -0
  241. data/public/less/type.less +296 -0
  242. data/public/less/utilities.less +56 -0
  243. data/public/less/variables.less +827 -0
  244. data/public/less/wells.less +29 -0
  245. data/public/package.json +71 -0
  246. data/public/test-infra/README.md +100 -0
  247. data/public/test-infra/npm-shrinkwrap.canonical.json +1 -0
  248. data/public/test-infra/requirements.txt +1 -0
  249. data/public/test-infra/s3_cache.py +107 -0
  250. data/public/test-infra/sauce_browsers.yml +83 -0
  251. data/public/test-infra/shrinkwrap.js +24 -0
  252. data/public/test-infra/uncached-npm-install.sh +4 -0
  253. data/rvnstat.gemspec +26 -0
  254. data/rvnstat.yml +3 -0
  255. data/ss.png +0 -0
  256. data/untitled.txt +0 -0
  257. data/views/._hourly.erb +0 -0
  258. data/views/._index.erb +0 -0
  259. data/views/._live_traffic.erb +0 -0
  260. data/views/._monthly.erb +0 -0
  261. data/views/._top_ten.erb +0 -0
  262. data/views/day_detail.erb +44 -0
  263. data/views/day_total.erb +42 -0
  264. data/views/graph_test.erb +2 -0
  265. data/views/hourly.erb +19 -0
  266. data/views/index.erb +71 -0
  267. data/views/layout.erb +28 -0
  268. data/views/live_traffic.erb +57 -0
  269. data/views/monthly.erb +21 -0
  270. data/views/top_ten.erb +21 -0
  271. metadata +385 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c9cf2701027ba4e7f0239a849ceb24d47240c8b8
4
+ data.tar.gz: ca96d754fde08f1d0c7f53784a6efa8eef5e2834
5
+ SHA512:
6
+ metadata.gz: 790e2547931e84c1c868440f0f088d594d1d3d5e575f46b35e7799e27d8c444e5f556962675d323deadb965d1901b3d0f32104ab3bb64e45ce7f2a8e917e8c24
7
+ data.tar.gz: f8398c3c4d86863d00972c3835a19b70390bba015fd829aebd5c50bd3df0d736fc34baa8ea8a1da77927c1aace59d7dbba354aaf36916ee43b125c8e732ef9de
Binary file
Binary file
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rvnstat.gemspec
4
+ gem 'groupdate'
5
+ gem 'filesize'
6
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 TODO: Write your name
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,34 @@
1
+ # Rvnstat
2
+
3
+ Ruby + Sinatra + Bootstrap + Highcharts + vnstat = awesome sauce!
4
+
5
+ ## Requirements
6
+ - vnstat
7
+ - sinatra
8
+ - vidibus-sysinfo
9
+ - filesize
10
+ - sinatra
11
+
12
+ ## Installation
13
+ gem install rvnstat or clone this repo for running with passenger.
14
+
15
+ ## Usage
16
+
17
+ You can run it via nginx/apache with passenger or with rackup.
18
+
19
+ - Add your path to vnstat, port and the interface you want to pull data from in the rvnstat.yml file.
20
+ - Place your rvnstat.yml in the folder where you run the binary:
21
+ - Run 'rvnstat' to start
22
+ - Access it via http://IP:port
23
+
24
+ ## Screen Shot
25
+
26
+ ![Alt text](ss.png "Screen Shot")
27
+
28
+ ## Contributing
29
+
30
+ 1. Fork it
31
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
32
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
33
+ 4. Push to the branch (`git push origin my-new-feature`)
34
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
Binary file
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ require 'require.rb'
3
+ project_root = ENV['GEM_HOME']+"/gems/rvnstat"
4
+ Dir.glob(project_root + '/views/*', &method(:require))
5
+
6
+ Rack::Handler::WEBrick.run(
7
+ App.new,
8
+ :Port => Rconfig.port
9
+ )
@@ -0,0 +1,4 @@
1
+ require './lib/app'
2
+
3
+
4
+ run App.new
@@ -0,0 +1,3 @@
1
+ vnstat_path: /usr/bin/vnstat
2
+ interface: eth0
3
+ port: 9000
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,102 @@
1
+ #!/usr/bin/env ruby
2
+ require "require.rb"
3
+
4
+ set :views, './views'
5
+ set :public_dir, './public'
6
+
7
+ class App < Sinatra::Application
8
+
9
+ set :static, true # set up static file routing
10
+ set :public, ENV['GEM_HOME']+'/gems/rvnstat-1.0.4/public'
11
+
12
+ set :views, ENV['GEM_HOME']+'/gems/rvnstat-1.0.4/views'
13
+
14
+ get '/' do
15
+ erb :index
16
+ end
17
+
18
+ get '/live_traffic' do
19
+ erb :live_traffic, :layout => false
20
+ end
21
+
22
+ get '/live' do
23
+ newVnstat = Vnstat.new
24
+ @x = newVnstat.live_traffic
25
+ content_type :json
26
+ results = []
27
+ time = Time.now.to_i * 1000
28
+ json = results.push(time,@x).to_json
29
+ end
30
+
31
+ get '/day_detail' do
32
+ newVnstat = Vnstat.new
33
+ x = newVnstat.run(Rconfig.vnstat_path,Rconfig.interface)
34
+ y = x[:day]
35
+ @dates = []
36
+ @rx = []
37
+ @tx = []
38
+ y.each do |z|
39
+ z.each do |x|
40
+ @dates.push(x[:date])
41
+ @rx.push(x[:rx].to_i / 1024)
42
+ @tx.push(x[:tx].to_i / 1024)
43
+ end
44
+ end
45
+ erb :day_detail, :layout => false
46
+ end
47
+
48
+ get '/day_total' do
49
+ newVnstat = Vnstat.new
50
+ x = newVnstat.run(Rconfig.vnstat_path,Rconfig.interface)
51
+ y = x[:day]
52
+ @total = []
53
+ @dates = []
54
+ y.each do |z|
55
+ z.each do |x|
56
+ @total.push(x[:total].to_i / 1024)
57
+ @dates.push(x[:date])
58
+ end
59
+ end
60
+ erb :day_total, :layout => false
61
+ end
62
+
63
+ get '/top_ten' do
64
+ newVnstat = Vnstat.new
65
+ x = newVnstat.run(Rconfig.vnstat_path,Rconfig.interface)
66
+ y = x[:top]
67
+ @top = []
68
+ y.each do |z|
69
+ z.each do |x|
70
+ @top.push(:date => x[:date],:rx => x[:rx],:tx => x[:tx],:total => x[:total])
71
+ end
72
+ end
73
+ erb :top_ten, :layout => false
74
+ end
75
+
76
+ get '/monthly' do
77
+ newVnstat = Vnstat.new
78
+ x = newVnstat.run(Rconfig.vnstat_path,Rconfig.interface)
79
+ y = x[:month]
80
+ @top = []
81
+ y.each do |z|
82
+ z.each do |x|
83
+ @top.push(:date => x[:date],:rx => x[:rx],:tx => x[:tx],:total => x[:total])
84
+ end
85
+ end
86
+ erb :monthly, :layout => false
87
+ end
88
+
89
+ get '/hourly' do
90
+ newVnstat = Vnstat.new
91
+ x = newVnstat.run(Rconfig.vnstat_path,Rconfig.interface)
92
+ y = x[:hour]
93
+ @hour = []
94
+ y.each do |z|
95
+ z.each do |x|
96
+ @hour.push(:date => x[:date],:rx => x[:krx],:tx => x[:ktx])
97
+ end
98
+ end
99
+ erb :hourly, :layout => false
100
+ end
101
+
102
+ end
@@ -0,0 +1,13 @@
1
+ require 'require.rb'
2
+ require 'yaml'
3
+
4
+ class Rconfig
5
+ config = YAML.load_file("rvnstat.yml")
6
+ class << self; attr_accessor :vnstat_path end
7
+ class << self; attr_accessor :interface end
8
+ class << self; attr_accessor :port end
9
+
10
+ @vnstat_path = config["vnstat_path"]
11
+ @interface = config["interface"]
12
+ @port = config["port"]
13
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'sinatra'
3
+ require 'config.rb'
4
+ require 'app.rb'
5
+ require 'vnstat'
6
+ require 'yaml'
7
+ require 'date'
8
+ require 'vidibus-sysinfo'
9
+ require 'json'
10
+ require 'filesize'
@@ -0,0 +1,5 @@
1
+ require "rvnstat/version"
2
+
3
+ module Rvnstat
4
+ # Your code goes here...
5
+ end
Binary file
@@ -0,0 +1,3 @@
1
+ module Rvnstat
2
+ VERSION = "1.0.4"
3
+ end
@@ -0,0 +1,74 @@
1
+ require 'require.rb'
2
+
3
+ class Vnstat
4
+ #run vmstat and grab data
5
+ def live_traffic
6
+ traffic = nil
7
+ traffic = Vidibus::Sysinfo.throughput
8
+ return traffic
9
+ end
10
+
11
+ def run(vnstat_path,interface)
12
+ v = %x[#{vnstat_path} --dumpdb -i #{interface}]
13
+ hash = {}
14
+ day = []
15
+ month =[]
16
+ hour = []
17
+ date = nil
18
+ rx = nil
19
+ tx = nil
20
+ total = nil
21
+ array = []
22
+ top = []
23
+ x = v.each_line.each do |y|
24
+ array.push(y)
25
+ end
26
+
27
+ array.each do |y|
28
+ if y[0] == "d"
29
+ x = y.split(';')
30
+ if x[7].chomp == '1'
31
+ date = x[2].chomp.to_i
32
+ rx = x[3].to_i
33
+ tx = x[4].to_i
34
+ total = rx + tx
35
+ b = [{:date => Time.at(date).strftime("%D"),:rx => Filesize.from("#{rx} MB").to_f('KB'),:tx => Filesize.from("#{tx} MB").to_f('KB'),:total => Filesize.from("#{total} MB").to_f('KB')}]
36
+ day.push(b)
37
+ end
38
+
39
+ elsif y[0] == "m"
40
+ x = y.split(';')
41
+ if x[7].chomp == '1'
42
+ date = x[2].chomp.to_i
43
+ rx = x[3].to_i
44
+ tx = x[4].to_i
45
+ total = rx + tx
46
+ b = [{:date => Time.at(date).strftime("%B"),:rx => Filesize.from("#{rx} MB").pretty,:tx => Filesize.from("#{tx} MB").pretty,:total => Filesize.from("#{total} MB").pretty}]
47
+ month.push(b)
48
+ end
49
+
50
+
51
+ elsif y[0] == "h"
52
+ x = y.split(';')
53
+ date = x[2].chomp.to_i
54
+ krx = x[3].chomp
55
+ ktx = x[4].chomp
56
+ b = [{:date => Time.at(date).strftime("%D - %l%P"),:krx => Filesize.from("#{krx} KB").pretty,:ktx => Filesize.from("#{ktx} KB").pretty}]
57
+ hour.push(b)
58
+ end
59
+ end
60
+ array[55...65].each do |y|
61
+ x = y.split(';')
62
+ if x[7].chomp == '1'
63
+ date = x[2].chomp.to_i
64
+ rx = x[3].to_i
65
+ tx = x[4].to_i
66
+ total = rx + tx
67
+ b = [{:date => Time.at(date).strftime("%D"),:rx => Filesize.from("#{rx} MB").pretty,:tx => Filesize.from("#{tx} MB").pretty,:total => Filesize.from("#{total} MB").pretty}]
68
+ top.push(b)
69
+ end
70
+ end
71
+ hash = { :day => day,:month => month, :hour => hour,:top => top}
72
+ return hash
73
+ end
74
+ end
@@ -0,0 +1 @@
1
+ getbootstrap.com
@@ -0,0 +1,192 @@
1
+ # Contributing to Bootstrap
2
+
3
+ Looking to contribute something to Bootstrap? **Here's how you can help.**
4
+
5
+ Please take a moment to review this document in order to make the contribution
6
+ process easy and effective for everyone involved.
7
+
8
+ Following these guidelines helps to communicate that you respect the time of
9
+ the developers managing and developing this open source project. In return,
10
+ they should reciprocate that respect in addressing your issue or assessing
11
+ patches and features.
12
+
13
+
14
+ ## Using the issue tracker
15
+
16
+ The [issue tracker](https://github.com/twbs/bootstrap/issues) is
17
+ the preferred channel for [bug reports](#bug-reports), [features requests](#feature-requests)
18
+ and [submitting pull requests](#pull-requests), but please respect the following
19
+ restrictions:
20
+
21
+ * Please **do not** use the issue tracker for personal support requests. Stack
22
+ Overflow ([`twitter-bootstrap-3`](http://stackoverflow.com/questions/tagged/twitter-bootstrap-3) tag) or [IRC](https://github.com/twbs/bootstrap/blob/master/README.md#community) are better places to get help.
23
+
24
+ * Please **do not** derail or troll issues. Keep the discussion on topic and
25
+ respect the opinions of others.
26
+
27
+ * Please **do not** open issues or pull requests regarding the code in
28
+ [`Normalize`](https://github.com/necolas/normalize.css) (open them in
29
+ their respective repositories).
30
+
31
+
32
+ ## Bug reports
33
+
34
+ A bug is a _demonstrable problem_ that is caused by the code in the repository.
35
+ Good bug reports are extremely helpful, so thanks!
36
+
37
+ Guidelines for bug reports:
38
+
39
+ 1. **Use the GitHub issue search** &mdash; check if the issue has already been
40
+ reported.
41
+
42
+ 2. **Check if the issue has been fixed** &mdash; try to reproduce it using the
43
+ latest `master` or development branch in the repository.
44
+
45
+ 3. **Isolate the problem** &mdash; ideally create a [reduced test
46
+ case](http://css-tricks.com/6263-reduced-test-cases/) and a live example.
47
+ [This JS Bin](http://jsbin.com/EBAwOkOK/1) is a helpful template.
48
+
49
+
50
+ A good bug report shouldn't leave others needing to chase you up for more
51
+ information. Please try to be as detailed as possible in your report. What is
52
+ your environment? What steps will reproduce the issue? What browser(s) and OS
53
+ experience the problem? Do other browsers show the bug differently? What
54
+ would you expect to be the outcome? All these details will help people to fix
55
+ any potential bugs.
56
+
57
+ Example:
58
+
59
+ > Short and descriptive example bug report title
60
+ >
61
+ > A summary of the issue and the browser/OS environment in which it occurs. If
62
+ > suitable, include the steps required to reproduce the bug.
63
+ >
64
+ > 1. This is the first step
65
+ > 2. This is the second step
66
+ > 3. Further steps, etc.
67
+ >
68
+ > `<url>` - a link to the reduced test case
69
+ >
70
+ > Any other information you want to share that is relevant to the issue being
71
+ > reported. This might include the lines of code that you have identified as
72
+ > causing the bug, and potential solutions (and your opinions on their
73
+ > merits).
74
+
75
+
76
+ ## Feature requests
77
+
78
+ Feature requests are welcome. But take a moment to find out whether your idea
79
+ fits with the scope and aims of the project. It's up to *you* to make a strong
80
+ case to convince the project's developers of the merits of this feature. Please
81
+ provide as much detail and context as possible.
82
+
83
+
84
+ ## Pull requests
85
+
86
+ Good pull requests—patches, improvements, new features—are a fantastic
87
+ help. They should remain focused in scope and avoid containing unrelated
88
+ commits.
89
+
90
+ **Please ask first** before embarking on any significant pull request (e.g.
91
+ implementing features, refactoring code, porting to a different language),
92
+ otherwise you risk spending a lot of time working on something that the
93
+ project's developers might not want to merge into the project.
94
+
95
+ Please adhere to the [coding guidelines](#code-guidelines) used throughout the
96
+ project (indentation, accurate comments, etc.) and any other requirements
97
+ (such as test coverage).
98
+
99
+ Adhering to the following process is the best way to get your work
100
+ included in the project:
101
+
102
+ 1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork,
103
+ and configure the remotes:
104
+
105
+ ```bash
106
+ # Clone your fork of the repo into the current directory
107
+ git clone https://github.com/<your-username>/bootstrap.git
108
+ # Navigate to the newly cloned directory
109
+ cd bootstrap
110
+ # Assign the original repo to a remote called "upstream"
111
+ git remote add upstream https://github.com/twbs/bootstrap.git
112
+ ```
113
+
114
+ 2. If you cloned a while ago, get the latest changes from upstream:
115
+
116
+ ```bash
117
+ git checkout master
118
+ git pull upstream master
119
+ ```
120
+
121
+ 3. Create a new topic branch (off the main project development branch) to
122
+ contain your feature, change, or fix:
123
+
124
+ ```bash
125
+ git checkout -b <topic-branch-name>
126
+ ```
127
+
128
+ 4. Commit your changes in logical chunks. Please adhere to these [git commit
129
+ message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
130
+ or your code is unlikely be merged into the main project. Use Git's
131
+ [interactive rebase](https://help.github.com/articles/interactive-rebase)
132
+ feature to tidy up your commits before making them public.
133
+
134
+ 5. Locally merge (or rebase) the upstream development branch into your topic branch:
135
+
136
+ ```bash
137
+ git pull [--rebase] upstream master
138
+ ```
139
+
140
+ 6. Push your topic branch up to your fork:
141
+
142
+ ```bash
143
+ git push origin <topic-branch-name>
144
+ ```
145
+
146
+ 7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
147
+ with a clear title and description against the `master` branch.
148
+
149
+ **IMPORTANT**: By submitting a patch, you agree to allow the project owners to
150
+ license your work under the terms of the [MIT License](LICENSE.md).
151
+
152
+
153
+ ## Code guidelines
154
+
155
+ ### HTML
156
+
157
+ - Two spaces for indentation, never tabs.
158
+ - Double quotes only, never single quotes.
159
+ - Always use proper indentation.
160
+ - Use tags and elements appropriate for an HTML5 doctype (e.g., self-closing tags).
161
+ - Use CDNs and HTTPS for third-party JS when possible. We don't use protocol-relative URLs in this case because they break when viewing the page locally via `file://`.
162
+ - Use [WAI-ARIA](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA) attributes in documentation examples to promote accessibility.
163
+
164
+ ### CSS
165
+
166
+ - CSS changes must be done in `.less` files first, never just in the compiled `.css` files.
167
+ - Adhere to the [CSS property order](http://markdotto.com/2011/11/29/css-property-order/).
168
+ - Multiple-line approach (one property and value per line).
169
+ - Always a space after a property's colon (e.g., `display: block;` and not `display:block;`).
170
+ - End all lines with a semi-colon.
171
+ - For multiple, comma-separated selectors, place each selector on its own line.
172
+ - Attribute selectors, like `input[type="text"]` should always wrap the attribute's value in double quotes, for consistency and safety (see this [blog post on unquoted attribute values](http://mathiasbynens.be/notes/unquoted-attribute-values) that can lead to XSS attacks).
173
+ - Attribute selectors should only be used where absolutely necessary (e.g., form controls) and should be avoided on custom components for performance and explicitness.
174
+ - Series of classes for a component should include a base class (e.g., `.component`) and use the base class as a prefix for modifier and sub-components (e.g., `.component-lg`).
175
+ - Avoid inheritance and over nesting—use single, explicit classes whenever possible.
176
+ - When feasible, default color palettes should comply with [WCAG color contrast guidelines](http://www.w3.org/TR/WCAG20/#visual-audio-contrast).
177
+
178
+ ### JS
179
+
180
+ - No semicolons
181
+ - Comma first
182
+ - 2 spaces (no tabs)
183
+ - strict mode
184
+ - "Attractive"
185
+
186
+
187
+ ## License
188
+
189
+ By contributing your code, you agree to license your contribution under the [MIT license](https://github.com/twbs/bootstrap/blob/master/LICENSE).
190
+
191
+ Prior to v3.1.0, Bootstrap was released under the Apache License v2.0.
192
+