usagewatch 0.0.4.pre → 0.0.5
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.
- data/LICENSE.txt +1 -1
- data/README.md +53 -44
- data/examples/example.rb +1 -1
- data/lib/usagewatch/version.rb +1 -1
- data/lib/usagewatch.rb +3 -1
- data/usagewatch.gemspec +1 -1
- metadata +14 -8
- checksums.yaml +0 -15
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -1,69 +1,78 @@
|
|
|
1
|
-
#
|
|
1
|
+
# usagewatch
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
Connections, Load, Bandwidth, Disk I/O, and Memory
|
|
3
|
+
License: (MIT) Copyright (C) 2013 Author Phil Chen, Contributor Ruben Espinosa.
|
|
5
4
|
|
|
6
|
-
##
|
|
5
|
+
## DESCRIPTION:
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
A Ruby Class with methods to find usage statistics on a Linux server such as CPU, Disk, TCP/UDP Connections, Load,
|
|
8
|
+
Bandwidth, Disk I/O, and Memory
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## Getting Started
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
gem install usagewatch
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
```ruby
|
|
15
|
+
require 'usagewatch'
|
|
16
|
+
|
|
17
|
+
include Usagewatch
|
|
18
|
+
|
|
19
|
+
uw_diskused
|
|
20
|
+
uw_diskused_perc
|
|
21
|
+
uw_cpuused
|
|
22
|
+
uw_tcpused
|
|
23
|
+
uw_udpused
|
|
24
|
+
uw_memused
|
|
25
|
+
uw_load
|
|
26
|
+
uw_bandrx
|
|
27
|
+
uw_bandtx
|
|
28
|
+
uw_diskioreads
|
|
29
|
+
uw_diskiowrites
|
|
30
|
+
```
|
|
17
31
|
|
|
18
|
-
|
|
32
|
+
## Example
|
|
19
33
|
|
|
20
|
-
|
|
34
|
+
```bash
|
|
35
|
+
Run:
|
|
21
36
|
|
|
22
|
-
|
|
23
|
-
require 'usagewatch'
|
|
24
|
-
|
|
25
|
-
include Usagewatch
|
|
26
|
-
|
|
27
|
-
puts "#{uw_diskused} Gigabytes Used"
|
|
28
|
-
puts "#{uw_cpuused}% CPU Used"
|
|
29
|
-
puts "#{uw_tcpused} TCP Connections Used"
|
|
30
|
-
puts "#{uw_udpused} UDP Connections Used"
|
|
31
|
-
puts "#{uw_memused}% Active Memory Used"
|
|
32
|
-
puts "#{uw_load} Average System Load Of The Past Minute"
|
|
33
|
-
puts "#{uw_bandrx} Mbit/s Current Bandwidth Received"
|
|
34
|
-
puts "#{uw_bandtx} Mbit/s Current Bandwidth Transmitted"
|
|
35
|
-
puts "#{uw_diskioreads}/s Current Disk Reads Completed"
|
|
36
|
-
puts "#{uw_diskiowrites}/s Current Disk Writes Completed"
|
|
37
|
-
```
|
|
37
|
+
example.rb
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
Example Output:
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
11.56 Gigabytes Disk Used
|
|
42
|
+
7.0% Disk Used
|
|
43
|
+
0.25% CPU Used
|
|
44
|
+
30 TCP Connections Used
|
|
45
|
+
0 UDP Connections Used
|
|
46
|
+
43% Active Memory Used
|
|
47
|
+
0.01 Average System Load Of The Past Minute
|
|
48
|
+
0.008 Mbit/s Current Bandwidth Received
|
|
49
|
+
0.2 Mbit/s Current Bandwidth Transmitted
|
|
50
|
+
0/s Current Disk Reads Completed
|
|
51
|
+
2/s Current Disk Writes Completed
|
|
52
|
+
```
|
|
46
53
|
|
|
47
54
|
## Notes
|
|
48
55
|
|
|
49
|
-
|
|
56
|
+
Disk Used is a sum of all partitions calculated in Gigabytes
|
|
50
57
|
|
|
51
|
-
|
|
58
|
+
Disk Used Percentage is a total percentage of all disk partitions used
|
|
52
59
|
|
|
53
|
-
|
|
60
|
+
CPU Used is a percentage of current CPU being used
|
|
54
61
|
|
|
55
|
-
|
|
62
|
+
TCP/UDP Connections Used is a total count of each respectively
|
|
56
63
|
|
|
57
|
-
|
|
64
|
+
Active Memory Used is a percentage of active system memory being used
|
|
58
65
|
|
|
59
|
-
|
|
66
|
+
Load is the average load of the past minute
|
|
60
67
|
|
|
61
|
-
|
|
68
|
+
Bandwidth is current received and transmitted in Megabits
|
|
62
69
|
|
|
63
|
-
|
|
70
|
+
Disk IO is current disk reads and writes completed per second
|
|
64
71
|
|
|
65
72
|
## Tested Using
|
|
66
73
|
|
|
67
|
-
RUBY VERSIONS:
|
|
74
|
+
RUBY VERSIONS:
|
|
75
|
+
ruby 1.9.3p429 (2013-05-15) [x86_64-linux]
|
|
68
76
|
|
|
69
|
-
OS VERSIONS:
|
|
77
|
+
OS VERSIONS:
|
|
78
|
+
CENTOS 5x 6x
|
data/examples/example.rb
CHANGED
data/lib/usagewatch/version.rb
CHANGED
data/lib/usagewatch.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
#License: (MIT), Copyright (C) 2013 Author Phil Chen, Contributor Ruben Espinosa
|
|
2
|
+
|
|
1
3
|
require "usagewatch/version"
|
|
2
4
|
|
|
3
5
|
module Usagewatch
|
|
@@ -106,7 +108,7 @@ module Usagewatch
|
|
|
106
108
|
@loaddata = file.read
|
|
107
109
|
end
|
|
108
110
|
|
|
109
|
-
@load = @loaddata.split(/ /).first
|
|
111
|
+
@load = @loaddata.split(/ /).first.to_f
|
|
110
112
|
end
|
|
111
113
|
end
|
|
112
114
|
|
data/usagewatch.gemspec
CHANGED
|
@@ -6,7 +6,7 @@ require 'usagewatch/version'
|
|
|
6
6
|
Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "usagewatch"
|
|
8
8
|
spec.version = Usagewatch::VERSION
|
|
9
|
-
spec.authors = ["Phil Chen,Ruben Espinosa"]
|
|
9
|
+
spec.authors = ["Phil Chen, Ruben Espinosa"]
|
|
10
10
|
spec.email = ["nethacker@gmail.com,rderoldan1@gmail.com"]
|
|
11
11
|
spec.description = %q{A Ruby Gem with methods to find usage statistics on a Linux server such as CPU, Disk, TCP/UDP Connections, Load, Bandwidth, Disk I/O, and Memory}
|
|
12
12
|
spec.summary = %q{Statistics on a Linux server}
|
metadata
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: usagewatch
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.5
|
|
5
|
+
prerelease:
|
|
5
6
|
platform: ruby
|
|
6
7
|
authors:
|
|
7
|
-
- Phil Chen,Ruben Espinosa
|
|
8
|
+
- Phil Chen, Ruben Espinosa
|
|
8
9
|
autorequire:
|
|
9
10
|
bindir: bin
|
|
10
11
|
cert_chain: []
|
|
11
|
-
date: 2013-07-
|
|
12
|
+
date: 2013-07-18 00:00:00.000000000 Z
|
|
12
13
|
dependencies:
|
|
13
14
|
- !ruby/object:Gem::Dependency
|
|
14
15
|
name: bundler
|
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
|
17
|
+
none: false
|
|
16
18
|
requirements:
|
|
17
19
|
- - ~>
|
|
18
20
|
- !ruby/object:Gem::Version
|
|
@@ -20,6 +22,7 @@ dependencies:
|
|
|
20
22
|
type: :development
|
|
21
23
|
prerelease: false
|
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
none: false
|
|
23
26
|
requirements:
|
|
24
27
|
- - ~>
|
|
25
28
|
- !ruby/object:Gem::Version
|
|
@@ -27,6 +30,7 @@ dependencies:
|
|
|
27
30
|
- !ruby/object:Gem::Dependency
|
|
28
31
|
name: rake
|
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
|
33
|
+
none: false
|
|
30
34
|
requirements:
|
|
31
35
|
- - ! '>='
|
|
32
36
|
- !ruby/object:Gem::Version
|
|
@@ -34,6 +38,7 @@ dependencies:
|
|
|
34
38
|
type: :development
|
|
35
39
|
prerelease: false
|
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
+
none: false
|
|
37
42
|
requirements:
|
|
38
43
|
- - ! '>='
|
|
39
44
|
- !ruby/object:Gem::Version
|
|
@@ -58,25 +63,26 @@ files:
|
|
|
58
63
|
homepage: https://github.com/nethacker/usagewatch
|
|
59
64
|
licenses:
|
|
60
65
|
- MIT
|
|
61
|
-
metadata: {}
|
|
62
66
|
post_install_message:
|
|
63
67
|
rdoc_options: []
|
|
64
68
|
require_paths:
|
|
65
69
|
- lib
|
|
66
70
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
71
|
+
none: false
|
|
67
72
|
requirements:
|
|
68
73
|
- - ! '>='
|
|
69
74
|
- !ruby/object:Gem::Version
|
|
70
75
|
version: '0'
|
|
71
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
|
+
none: false
|
|
72
78
|
requirements:
|
|
73
|
-
- - ! '
|
|
79
|
+
- - ! '>='
|
|
74
80
|
- !ruby/object:Gem::Version
|
|
75
|
-
version:
|
|
81
|
+
version: '0'
|
|
76
82
|
requirements: []
|
|
77
83
|
rubyforge_project:
|
|
78
|
-
rubygems_version:
|
|
84
|
+
rubygems_version: 1.8.23
|
|
79
85
|
signing_key:
|
|
80
|
-
specification_version:
|
|
86
|
+
specification_version: 3
|
|
81
87
|
summary: Statistics on a Linux server
|
|
82
88
|
test_files: []
|
checksums.yaml
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
!binary "U0hBMQ==":
|
|
3
|
-
metadata.gz: !binary |-
|
|
4
|
-
OGVjOTQ4MDk0ZjhjZTRiZGY1NjRhNTBkZGEzZDMyNTM0NTMxZWI1NA==
|
|
5
|
-
data.tar.gz: !binary |-
|
|
6
|
-
ZTFlZWIyNGY3NGJmNjc3YTAzNzg5ODRjMWJhNmJhNTMyNzA1Yjk2Yw==
|
|
7
|
-
!binary "U0hBNTEy":
|
|
8
|
-
metadata.gz: !binary |-
|
|
9
|
-
Mzc3OTJiYjU3YTZjMTNkYmY1OWQ3MjgxZDEwMTJmNGIyMjFmOTMyZWE1NGM1
|
|
10
|
-
NGUxZmVmMjM1YTk0ZmY0MTQzOWMyNTgyNjBiY2Q4NzczNzdhM2Y4ZjNlMWY1
|
|
11
|
-
YmFjZjVhMzdiY2Q5NmJhYmNiOTliZjJhNzUzNzE1ZTU4OGM0OWQ=
|
|
12
|
-
data.tar.gz: !binary |-
|
|
13
|
-
MmJmODA3MjMwNDI2Y2ExYmJkNDZmN2ZkMGQxZmI2NWEwMGY1ODE2N2MwYzVi
|
|
14
|
-
OGNjZjI5MjQ3MzgyNjQwMGMyOTdmZjYxNDBhNjY4MjkxNTA2N2RmNDVhMDg3
|
|
15
|
-
YjQ0NGU2MThlYjRlN2M1YjJmMjdmNWZlYTVjYzI3ZTFkOWViYjc=
|