rvnstat 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/._README.md +0 -0
- data/._ss.png +0 -0
- data/.gitignore +17 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +34 -0
- data/Rakefile +1 -0
- data/bin/._rvnstat +0 -0
- data/bin/rvnstat +9 -0
- data/config.ru +4 -0
- data/config.yml +3 -0
- data/lib/._app.rb +0 -0
- data/lib/._config.rb +0 -0
- data/lib/._require.rb +0 -0
- data/lib/._rvnstat.rb +0 -0
- data/lib/._vnstat.rb +0 -0
- data/lib/app.rb +102 -0
- data/lib/config.rb +13 -0
- data/lib/require.rb +10 -0
- data/lib/rvnstat.rb +5 -0
- data/lib/rvnstat/._version.rb +0 -0
- data/lib/rvnstat/version.rb +3 -0
- data/lib/vnstat.rb +74 -0
- data/public/CNAME +1 -0
- data/public/CONTRIBUTING.md +192 -0
- data/public/Gruntfile.js +418 -0
- data/public/LICENSE +21 -0
- data/public/README.md +173 -0
- data/public/_config.yml +35 -0
- data/public/bower.json +24 -0
- data/public/browserstack.json +44 -0
- data/public/composer.json +25 -0
- data/public/dist/css/._custom.css +0 -0
- data/public/dist/css/bootstrap-theme.css +347 -0
- data/public/dist/css/bootstrap-theme.css.map +1 -0
- data/public/dist/css/bootstrap-theme.min.css +7 -0
- data/public/dist/css/bootstrap.css +5831 -0
- data/public/dist/css/bootstrap.css.map +1 -0
- data/public/dist/css/bootstrap.min.css +7 -0
- data/public/dist/css/custom.css +20 -0
- data/public/dist/fonts/glyphicons-halflings-regular.eot +0 -0
- data/public/dist/fonts/glyphicons-halflings-regular.svg +229 -0
- data/public/dist/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/public/dist/fonts/glyphicons-halflings-regular.woff +0 -0
- data/public/dist/js/bootstrap.js +1951 -0
- data/public/dist/js/bootstrap.min.js +6 -0
- data/public/docs/LICENSE +319 -0
- data/public/docs/_data/glyphicons.yml +203 -0
- data/public/docs/_data/showcase.yml +19 -0
- data/public/docs/_includes/ads.html +1 -0
- data/public/docs/_includes/customizer-variables.html +1690 -0
- data/public/docs/_includes/footer.html +70 -0
- data/public/docs/_includes/header.html +42 -0
- data/public/docs/_includes/nav-about.html +9 -0
- data/public/docs/_includes/nav-components.html +138 -0
- data/public/docs/_includes/nav-css.html +127 -0
- data/public/docs/_includes/nav-customize.html +46 -0
- data/public/docs/_includes/nav-getting-started.html +62 -0
- data/public/docs/_includes/nav-javascript.html +89 -0
- data/public/docs/_includes/nav-main.html +36 -0
- data/public/docs/_includes/nav-migration.html +12 -0
- data/public/docs/_includes/social-buttons.html +16 -0
- data/public/docs/_layouts/default.html +55 -0
- data/public/docs/_layouts/home.html +18 -0
- data/public/docs/about.html +149 -0
- data/public/docs/assets/css/docs.css +1394 -0
- data/public/docs/assets/css/docs.min.css +6 -0
- data/public/docs/assets/css/pygments-manni.css +66 -0
- data/public/docs/assets/ico/apple-touch-icon-144-precomposed.png +0 -0
- data/public/docs/assets/ico/favicon.ico +0 -0
- data/public/docs/assets/img/components.png +0 -0
- data/public/docs/assets/img/devices.png +0 -0
- data/public/docs/assets/img/sass-less.png +0 -0
- data/public/docs/assets/js/application.js +101 -0
- data/public/docs/assets/js/customize.min.js +49 -0
- data/public/docs/assets/js/customizer.js +348 -0
- data/public/docs/assets/js/docs.min.js +16 -0
- data/public/docs/assets/js/ie8-responsive-file-warning.js +12 -0
- data/public/docs/assets/js/raw-files.min.js +8 -0
- data/public/docs/assets/js/vendor/blob.js +166 -0
- data/public/docs/assets/js/vendor/filesaver.js +236 -0
- data/public/docs/assets/js/vendor/holder.js +645 -0
- data/public/docs/assets/js/vendor/jszip.js +1474 -0
- data/public/docs/assets/js/vendor/less.min.js +16 -0
- data/public/docs/assets/js/vendor/uglify.min.js +14 -0
- data/public/docs/components.html +3001 -0
- data/public/docs/css.html +3346 -0
- data/public/docs/customize.html +356 -0
- data/public/docs/customizer-nav.jade +15 -0
- data/public/docs/customizer-variables.jade +21 -0
- data/public/docs/dist/css/bootstrap-theme.css.map +1 -0
- data/public/docs/dist/css/bootstrap-theme.min.css +7 -0
- data/public/docs/dist/css/bootstrap.css.map +1 -0
- data/public/docs/dist/css/bootstrap.min.css +7 -0
- data/public/docs/dist/fonts/glyphicons-halflings-regular.eot +0 -0
- data/public/docs/dist/fonts/glyphicons-halflings-regular.svg +229 -0
- data/public/docs/dist/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/public/docs/dist/fonts/glyphicons-halflings-regular.woff +0 -0
- data/public/docs/dist/js/bootstrap.min.js +7 -0
- data/public/docs/examples/blog/blog.css +168 -0
- data/public/docs/examples/blog/index.html +171 -0
- data/public/docs/examples/carousel/carousel.css +148 -0
- data/public/docs/examples/carousel/index.html +206 -0
- data/public/docs/examples/cover/cover.css +161 -0
- data/public/docs/examples/cover/index.html +75 -0
- data/public/docs/examples/dashboard/dashboard.css +93 -0
- data/public/docs/examples/dashboard/index.html +243 -0
- data/public/docs/examples/grid/grid.css +28 -0
- data/public/docs/examples/grid/index.html +152 -0
- data/public/docs/examples/jumbotron-narrow/index.html +82 -0
- data/public/docs/examples/jumbotron-narrow/jumbotron-narrow.css +79 -0
- data/public/docs/examples/jumbotron/index.html +99 -0
- data/public/docs/examples/jumbotron/jumbotron.css +5 -0
- data/public/docs/examples/justified-nav/index.html +84 -0
- data/public/docs/examples/justified-nav/justified-nav.css +88 -0
- data/public/docs/examples/navbar-fixed-top/index.html +91 -0
- data/public/docs/examples/navbar-fixed-top/navbar-fixed-top.css +4 -0
- data/public/docs/examples/navbar-static-top/index.html +92 -0
- data/public/docs/examples/navbar-static-top/navbar-static-top.css +7 -0
- data/public/docs/examples/navbar/index.html +90 -0
- data/public/docs/examples/navbar/navbar.css +8 -0
- data/public/docs/examples/non-responsive/index.html +105 -0
- data/public/docs/examples/non-responsive/non-responsive.css +120 -0
- data/public/docs/examples/offcanvas/index.html +130 -0
- data/public/docs/examples/offcanvas/offcanvas.css +51 -0
- data/public/docs/examples/offcanvas/offcanvas.js +5 -0
- data/public/docs/examples/screenshots/blog.jpg +0 -0
- data/public/docs/examples/screenshots/carousel.jpg +0 -0
- data/public/docs/examples/screenshots/cover.jpg +0 -0
- data/public/docs/examples/screenshots/dashboard.jpg +0 -0
- data/public/docs/examples/screenshots/grid.jpg +0 -0
- data/public/docs/examples/screenshots/jumbotron-narrow.jpg +0 -0
- data/public/docs/examples/screenshots/jumbotron.jpg +0 -0
- data/public/docs/examples/screenshots/justified-nav.jpg +0 -0
- data/public/docs/examples/screenshots/navbar-fixed.jpg +0 -0
- data/public/docs/examples/screenshots/navbar-static.jpg +0 -0
- data/public/docs/examples/screenshots/navbar.jpg +0 -0
- data/public/docs/examples/screenshots/non-responsive.jpg +0 -0
- data/public/docs/examples/screenshots/offcanvas.jpg +0 -0
- data/public/docs/examples/screenshots/sign-in.jpg +0 -0
- data/public/docs/examples/screenshots/starter-template.jpg +0 -0
- data/public/docs/examples/screenshots/sticky-footer-navbar.jpg +0 -0
- data/public/docs/examples/screenshots/sticky-footer.jpg +0 -0
- data/public/docs/examples/screenshots/theme.jpg +0 -0
- data/public/docs/examples/signin/index.html +50 -0
- data/public/docs/examples/signin/signin.css +40 -0
- data/public/docs/examples/starter-template/index.html +68 -0
- data/public/docs/examples/starter-template/starter-template.css +7 -0
- data/public/docs/examples/sticky-footer-navbar/index.html +91 -0
- data/public/docs/examples/sticky-footer-navbar/sticky-footer-navbar.css +45 -0
- data/public/docs/examples/sticky-footer/index.html +55 -0
- data/public/docs/examples/sticky-footer/sticky-footer.css +38 -0
- data/public/docs/examples/theme/index.html +384 -0
- data/public/docs/examples/theme/theme.css +14 -0
- data/public/docs/getting-started.html +773 -0
- data/public/docs/grunt/bs-glyphicons-data-generator.js +33 -0
- data/public/docs/grunt/bs-lessdoc-parser.js +236 -0
- data/public/docs/grunt/bs-raw-files-generator.js +31 -0
- data/public/docs/index.html +72 -0
- data/public/docs/javascript.html +2141 -0
- data/public/docs/migration.html +423 -0
- data/public/fonts/glyphicons-halflings-regular.eot +0 -0
- data/public/fonts/glyphicons-halflings-regular.svg +229 -0
- data/public/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/public/fonts/glyphicons-halflings-regular.woff +0 -0
- data/public/js/._exporting.js +0 -0
- data/public/js/._highcharts-all.js +0 -0
- data/public/js/._jquery-min.js +0 -0
- data/public/js/.jscs.json +15 -0
- data/public/js/.jshintrc +14 -0
- data/public/js/affix.js +137 -0
- data/public/js/alert.js +88 -0
- data/public/js/bootstrap.min.js +6 -0
- data/public/js/button.js +107 -0
- data/public/js/carousel.js +205 -0
- data/public/js/collapse.js +170 -0
- data/public/js/dropdown.js +147 -0
- data/public/js/highcharts.js +294 -0
- data/public/js/jquery-1.11.0.min.js +4 -0
- data/public/js/modal.js +243 -0
- data/public/js/popover.js +110 -0
- data/public/js/scrollspy.js +153 -0
- data/public/js/tab.js +125 -0
- data/public/js/tests/index.html +54 -0
- data/public/js/tests/unit/affix.js +50 -0
- data/public/js/tests/unit/alert.js +62 -0
- data/public/js/tests/unit/button.js +122 -0
- data/public/js/tests/unit/carousel.js +110 -0
- data/public/js/tests/unit/collapse.js +164 -0
- data/public/js/tests/unit/dropdown.js +218 -0
- data/public/js/tests/unit/modal.js +195 -0
- data/public/js/tests/unit/phantom.js +69 -0
- data/public/js/tests/unit/popover.js +133 -0
- data/public/js/tests/unit/scrollspy.js +36 -0
- data/public/js/tests/unit/tab.js +86 -0
- data/public/js/tests/unit/tooltip.js +432 -0
- data/public/js/tests/vendor/jquery.js +6 -0
- data/public/js/tests/vendor/qunit.css +245 -0
- data/public/js/tests/vendor/qunit.js +2210 -0
- data/public/js/tooltip.js +399 -0
- data/public/js/transition.js +48 -0
- data/public/less/.csscomb.json +297 -0
- data/public/less/.csslintrc +19 -0
- data/public/less/alerts.less +67 -0
- data/public/less/badges.less +55 -0
- data/public/less/bootstrap.less +49 -0
- data/public/less/breadcrumbs.less +26 -0
- data/public/less/button-groups.less +226 -0
- data/public/less/buttons.less +155 -0
- data/public/less/carousel.less +232 -0
- data/public/less/close.less +33 -0
- data/public/less/code.less +63 -0
- data/public/less/component-animations.less +29 -0
- data/public/less/dropdowns.less +213 -0
- data/public/less/forms.less +419 -0
- data/public/less/glyphicons.less +233 -0
- data/public/less/grid.less +100 -0
- data/public/less/input-groups.less +157 -0
- data/public/less/jumbotron.less +44 -0
- data/public/less/labels.less +64 -0
- data/public/less/list-group.less +110 -0
- data/public/less/media.less +56 -0
- data/public/less/mixins.less +926 -0
- data/public/less/modals.less +138 -0
- data/public/less/navbar.less +616 -0
- data/public/less/navs.less +242 -0
- data/public/less/normalize.less +423 -0
- data/public/less/pager.less +55 -0
- data/public/less/pagination.less +88 -0
- data/public/less/panels.less +230 -0
- data/public/less/popovers.less +133 -0
- data/public/less/print.less +101 -0
- data/public/less/progress-bars.less +80 -0
- data/public/less/responsive-utilities.less +93 -0
- data/public/less/scaffolding.less +134 -0
- data/public/less/tables.less +233 -0
- data/public/less/theme.less +247 -0
- data/public/less/thumbnails.less +36 -0
- data/public/less/tooltip.less +95 -0
- data/public/less/type.less +296 -0
- data/public/less/utilities.less +56 -0
- data/public/less/variables.less +827 -0
- data/public/less/wells.less +29 -0
- data/public/package.json +71 -0
- data/public/test-infra/README.md +100 -0
- data/public/test-infra/npm-shrinkwrap.canonical.json +1 -0
- data/public/test-infra/requirements.txt +1 -0
- data/public/test-infra/s3_cache.py +107 -0
- data/public/test-infra/sauce_browsers.yml +83 -0
- data/public/test-infra/shrinkwrap.js +24 -0
- data/public/test-infra/uncached-npm-install.sh +4 -0
- data/rvnstat.gemspec +26 -0
- data/rvnstat.yml +3 -0
- data/ss.png +0 -0
- data/untitled.txt +0 -0
- data/views/._hourly.erb +0 -0
- data/views/._index.erb +0 -0
- data/views/._live_traffic.erb +0 -0
- data/views/._monthly.erb +0 -0
- data/views/._top_ten.erb +0 -0
- data/views/day_detail.erb +44 -0
- data/views/day_total.erb +42 -0
- data/views/graph_test.erb +2 -0
- data/views/hourly.erb +19 -0
- data/views/index.erb +71 -0
- data/views/layout.erb +28 -0
- data/views/live_traffic.erb +57 -0
- data/views/monthly.erb +21 -0
- data/views/top_ten.erb +21 -0
- metadata +385 -0
checksums.yaml
ADDED
|
@@ -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
|
data/._README.md
ADDED
|
Binary file
|
data/._ss.png
ADDED
|
Binary file
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -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.
|
data/README.md
ADDED
|
@@ -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
|
+

|
|
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
|
data/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/._rvnstat
ADDED
|
Binary file
|
data/bin/rvnstat
ADDED
data/config.ru
ADDED
data/config.yml
ADDED
data/lib/._app.rb
ADDED
|
Binary file
|
data/lib/._config.rb
ADDED
|
Binary file
|
data/lib/._require.rb
ADDED
|
Binary file
|
data/lib/._rvnstat.rb
ADDED
|
Binary file
|
data/lib/._vnstat.rb
ADDED
|
Binary file
|
data/lib/app.rb
ADDED
|
@@ -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
|
data/lib/config.rb
ADDED
|
@@ -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
|
data/lib/require.rb
ADDED
data/lib/rvnstat.rb
ADDED
|
Binary file
|
data/lib/vnstat.rb
ADDED
|
@@ -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
|
data/public/CNAME
ADDED
|
@@ -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** — check if the issue has already been
|
|
40
|
+
reported.
|
|
41
|
+
|
|
42
|
+
2. **Check if the issue has been fixed** — try to reproduce it using the
|
|
43
|
+
latest `master` or development branch in the repository.
|
|
44
|
+
|
|
45
|
+
3. **Isolate the problem** — 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
|
+
|