vnstat-ruby 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +106 -4
- data/Rakefile +4 -5
- data/VERSION +1 -1
- data/vnstat-ruby.gemspec +8 -8
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1715a5093d7a2a70bf97ff7fdba6841947b757fc
|
4
|
+
data.tar.gz: 36bb4148f065f37f5fddcc86cc030ca17cdb6540
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d4f1d8b0748d356bd2571c61ef35df7993b6ee02d1a5b2dbd755abd8b8b581fca6a700eedd3f856fb38c1fee21f39ce9dc2f7ad10ae488d5fbb31b08ca55f5e
|
7
|
+
data.tar.gz: be614eabb9d0398b3d6725225296dba0416214ba0ac823b79f8c403045efdb818bc7576b959bfd9b48e5cf9b629bd22fa801d11d3a98867a14b5656ba0bc4c1c
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -50,15 +50,117 @@ vnstat executable. If you need to change this path for some reason, you can
|
|
50
50
|
override the default:
|
51
51
|
|
52
52
|
```ruby
|
53
|
-
Vnstat.
|
54
|
-
config.executable_path = '/usr/bin/vnstat'
|
55
|
-
end
|
53
|
+
Vnstat.config.executable_path = '/usr/bin/vnstat'
|
56
54
|
```
|
57
55
|
|
58
56
|
### Usage
|
59
57
|
|
60
|
-
|
58
|
+
#### Network Interfaces
|
59
|
+
|
60
|
+
To retrieve a list of all known network interfaces:
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
Vnstat.interfaces # => #<Vnstat::InterfaceCollection ...>
|
64
|
+
Vnstat.interfaces.ids # => ['eth01', 'eth02']
|
65
|
+
```
|
66
|
+
|
67
|
+
To only retrieve traffic stats for a single interface:
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
Vnstat.interfaces.first # => #<Vnstat::Interface id: "eth01">
|
71
|
+
```
|
72
|
+
|
73
|
+
If you know the name of a network interface, you can also retrieve the
|
74
|
+
stats of that particular one:
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
Vnstat['eth01'] # => #<Vnstat::Interface id: "eth01">
|
78
|
+
```
|
79
|
+
|
80
|
+
#### Traffic Information
|
81
|
+
|
82
|
+
##### Total
|
83
|
+
|
84
|
+
```ruby
|
85
|
+
interface = Vnstat['eth01']
|
86
|
+
```
|
87
|
+
|
88
|
+
```ruby
|
89
|
+
interface.total # => #<Vnstat::Result ...>
|
90
|
+
interface.total.bytes_received # => 1024000
|
91
|
+
interface.total.bytes_sent # => 2048000
|
92
|
+
interface.total.bytes_transmitted # => 3072000
|
93
|
+
```
|
94
|
+
|
95
|
+
##### By Month
|
96
|
+
|
97
|
+
```ruby
|
98
|
+
interface.months # => #<Vnstat::Traffic::Monthly ...>
|
99
|
+
```
|
100
|
+
|
101
|
+
```ruby
|
102
|
+
interface.months.first
|
103
|
+
interface.months[2015, 9]
|
104
|
+
# => #<Vnstat::Result::Month year: 2015, month: 9, ...>
|
105
|
+
```
|
106
|
+
|
107
|
+
```ruby
|
108
|
+
interface.months[2015, 10].bytes_received # => 3072000
|
109
|
+
```
|
61
110
|
|
111
|
+
##### By Day
|
112
|
+
|
113
|
+
```ruby
|
114
|
+
interface.days # => #<Vnstat::Traffic::Daily ...>
|
115
|
+
```
|
116
|
+
|
117
|
+
```ruby
|
118
|
+
interface.days.first
|
119
|
+
interface.days[Date.new(2015, 11, 23)]
|
120
|
+
interface.days[2015, 11, 23]
|
121
|
+
# => #<Vnstat::Result::Day date: #<Date: 2015-11-23>, ...>
|
122
|
+
```
|
123
|
+
|
124
|
+
```ruby
|
125
|
+
interface.days[2015, 11, 23].bytes_received # => 2048000
|
126
|
+
```
|
127
|
+
|
128
|
+
##### By Hour
|
129
|
+
|
130
|
+
```ruby
|
131
|
+
interface.hours # => #<Vnstat::Traffic::Hourly ...>
|
132
|
+
```
|
133
|
+
|
134
|
+
```ruby
|
135
|
+
interface.hours.first
|
136
|
+
interface.hours[Date.new(2015, 9, 22), 10]
|
137
|
+
interface.hours[2015, 9, 22, 10]
|
138
|
+
# => #<Vnstat::Result::Hour date: #<Date: 2015-11-23>, hour: 10>
|
139
|
+
```
|
140
|
+
|
141
|
+
```ruby
|
142
|
+
interface.hours[2015, 9, 22, 10].bytes_received # => 2048000
|
143
|
+
```
|
144
|
+
|
145
|
+
##### Tops
|
146
|
+
|
147
|
+
```ruby
|
148
|
+
interface.tops #=> #<Vnstat::Traffic::Tops ...>
|
149
|
+
interface.tops.count #=> 10
|
150
|
+
interface.tops.each do |top|
|
151
|
+
# ...
|
152
|
+
end
|
153
|
+
```
|
154
|
+
|
155
|
+
```ruby
|
156
|
+
interface.tops.first
|
157
|
+
interface.tops[2]
|
158
|
+
# => #<Vnstat::Result::Minute time: #<DateTime: 2015-11-05T09:03:42+00:00>>
|
159
|
+
```
|
160
|
+
|
161
|
+
```ruby
|
162
|
+
interface.tops[1].bytes_received # => 1024000
|
163
|
+
```
|
62
164
|
|
63
165
|
### Contributing to vnstat-ruby
|
64
166
|
|
data/Rakefile
CHANGED
@@ -10,19 +10,18 @@ rescue Bundler::BundlerError => e
|
|
10
10
|
exit e.status_code
|
11
11
|
end
|
12
12
|
require 'rake'
|
13
|
-
|
14
13
|
require 'jeweler'
|
14
|
+
|
15
15
|
Jeweler::Tasks.new do |gem|
|
16
16
|
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
17
17
|
gem.name = 'vnstat-ruby'
|
18
18
|
gem.homepage = 'http://github.com/tlux/vnstat-ruby'
|
19
19
|
gem.license = 'MIT'
|
20
|
-
gem.summary = 'A Ruby wrapper for vnstat'
|
21
|
-
gem.description =
|
20
|
+
gem.summary = 'A Ruby wrapper for vnstat.'
|
21
|
+
gem.description = 'Uses the the vnstat CLI to track your network traffic.'
|
22
22
|
gem.email = 'tobias.casper@gmail.com'
|
23
23
|
gem.authors = ['Tobias Casper']
|
24
24
|
# dependencies defined in Gemfile
|
25
25
|
end
|
26
|
-
Jeweler::RubygemsDotOrgTasks.new
|
27
26
|
|
28
|
-
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.1
|
data/vnstat-ruby.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: vnstat-ruby 1.0.
|
5
|
+
# stub: vnstat-ruby 1.0.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "vnstat-ruby"
|
9
|
-
s.version = "1.0.
|
9
|
+
s.version = "1.0.1"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Tobias Casper"]
|
14
|
-
s.date = "2015-11-
|
15
|
-
s.description = "
|
14
|
+
s.date = "2015-11-24"
|
15
|
+
s.description = "Uses the the vnstat CLI to track your network traffic."
|
16
16
|
s.email = "tobias.casper@gmail.com"
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"LICENSE.txt",
|
@@ -81,20 +81,20 @@ Gem::Specification.new do |s|
|
|
81
81
|
s.homepage = "http://github.com/tlux/vnstat-ruby"
|
82
82
|
s.licenses = ["MIT"]
|
83
83
|
s.rubygems_version = "2.4.5.1"
|
84
|
-
s.summary = "A Ruby wrapper for vnstat"
|
84
|
+
s.summary = "A Ruby wrapper for vnstat."
|
85
85
|
|
86
86
|
if s.respond_to? :specification_version then
|
87
87
|
s.specification_version = 4
|
88
88
|
|
89
89
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
90
|
-
s.add_runtime_dependency(%q<nokogiri>, ["
|
90
|
+
s.add_runtime_dependency(%q<nokogiri>, ["~> 1.6"])
|
91
91
|
s.add_development_dependency(%q<rspec>, ["~> 3.0"])
|
92
92
|
s.add_development_dependency(%q<yard>, [">= 0"])
|
93
93
|
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
94
94
|
s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
|
95
95
|
s.add_development_dependency(%q<codeclimate-test-reporter>, [">= 0"])
|
96
96
|
else
|
97
|
-
s.add_dependency(%q<nokogiri>, ["
|
97
|
+
s.add_dependency(%q<nokogiri>, ["~> 1.6"])
|
98
98
|
s.add_dependency(%q<rspec>, ["~> 3.0"])
|
99
99
|
s.add_dependency(%q<yard>, [">= 0"])
|
100
100
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
@@ -102,7 +102,7 @@ Gem::Specification.new do |s|
|
|
102
102
|
s.add_dependency(%q<codeclimate-test-reporter>, [">= 0"])
|
103
103
|
end
|
104
104
|
else
|
105
|
-
s.add_dependency(%q<nokogiri>, ["
|
105
|
+
s.add_dependency(%q<nokogiri>, ["~> 1.6"])
|
106
106
|
s.add_dependency(%q<rspec>, ["~> 3.0"])
|
107
107
|
s.add_dependency(%q<yard>, [">= 0"])
|
108
108
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vnstat-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Casper
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1.6'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '1.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,7 +94,7 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
description:
|
97
|
+
description: Uses the the vnstat CLI to track your network traffic.
|
98
98
|
email: tobias.casper@gmail.com
|
99
99
|
executables: []
|
100
100
|
extensions: []
|
@@ -183,5 +183,5 @@ rubyforge_project:
|
|
183
183
|
rubygems_version: 2.4.5.1
|
184
184
|
signing_key:
|
185
185
|
specification_version: 4
|
186
|
-
summary: A Ruby wrapper for vnstat
|
186
|
+
summary: A Ruby wrapper for vnstat.
|
187
187
|
test_files: []
|