heartbeat-client 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Gemfile.lock +4 -0
- data/Rakefile +3 -1
- data/VERSION +1 -1
- data/lib/heartbeat-client.rb +10 -6
- metadata +69 -14
- data/bin/heartbeat_client +0 -2
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,6 +2,7 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
daemons (1.1.4)
|
5
|
+
ffi (1.0.11)
|
5
6
|
git (1.2.5)
|
6
7
|
httparty (0.8.1)
|
7
8
|
multi_json
|
@@ -15,6 +16,8 @@ GEM
|
|
15
16
|
rake (0.9.2.2)
|
16
17
|
rcov (0.9.11)
|
17
18
|
shoulda (2.11.3)
|
19
|
+
sys-cpu (0.7.0)
|
20
|
+
ffi (>= 1.0.0)
|
18
21
|
|
19
22
|
PLATFORMS
|
20
23
|
ruby
|
@@ -26,3 +29,4 @@ DEPENDENCIES
|
|
26
29
|
jeweler (~> 1.5.2)
|
27
30
|
rcov
|
28
31
|
shoulda
|
32
|
+
sys-cpu
|
data/Rakefile
CHANGED
@@ -21,7 +21,9 @@ Jeweler::Tasks.new do |gem|
|
|
21
21
|
gem.authors = ["Oliver Kiessler"]
|
22
22
|
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
23
23
|
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
24
|
-
|
24
|
+
gem.add_runtime_dependency 'daemons'
|
25
|
+
gem.add_runtime_dependency 'sys-cpu'
|
26
|
+
gem.add_runtime_dependency 'httparty'
|
25
27
|
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
26
28
|
end
|
27
29
|
Jeweler::RubygemsDotOrgTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/lib/heartbeat-client.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
gem 'httparty'
|
3
3
|
require 'httparty'
|
4
|
-
require 'pp'
|
5
4
|
require 'logger'
|
5
|
+
require "sys/cpu"
|
6
|
+
require 'pp'
|
6
7
|
|
7
8
|
class Heartbeat
|
9
|
+
include Sys
|
8
10
|
include HTTParty
|
9
11
|
base_uri 'http://heartbeat-server.herokuapp.com'
|
10
12
|
|
@@ -22,10 +24,13 @@ class Heartbeat
|
|
22
24
|
|
23
25
|
def self.create(apikey)
|
24
26
|
cpu = 0; load_average = 0; memory_used = 0; memory_free = 0
|
25
|
-
output = is_mac? ? `top -l 1`.chomp : `top -n 1`.chomp
|
26
27
|
|
27
|
-
|
28
|
-
|
28
|
+
if self.is_mac?
|
29
|
+
load_average = CPU.load_avg.first
|
30
|
+
elsif self.is_linux?
|
31
|
+
cpus = `iostat -c`.split
|
32
|
+
cpu = 100 - cpus.last.to_i
|
33
|
+
end
|
29
34
|
|
30
35
|
options = {
|
31
36
|
:body => {
|
@@ -43,7 +48,6 @@ class Heartbeat
|
|
43
48
|
}
|
44
49
|
}
|
45
50
|
|
46
|
-
pp Heartbeat.post('/heartbeat', options)
|
47
|
-
# log.info("Heartbeat sent...")
|
51
|
+
pp Heartbeat.post('/heartbeat', options)
|
48
52
|
end
|
49
53
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heartbeat-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Oliver Kiessler
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-12-
|
18
|
+
date: 2011-12-22 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
@@ -55,12 +55,26 @@ dependencies:
|
|
55
55
|
segments:
|
56
56
|
- 0
|
57
57
|
version: "0"
|
58
|
-
name:
|
58
|
+
name: sys-cpu
|
59
59
|
prerelease: false
|
60
|
-
type: :
|
60
|
+
type: :runtime
|
61
61
|
requirement: *id003
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
version_requirements: &id004 !ruby/object:Gem::Requirement
|
64
|
+
none: false
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
hash: 3
|
69
|
+
segments:
|
70
|
+
- 0
|
71
|
+
version: "0"
|
72
|
+
name: shoulda
|
73
|
+
prerelease: false
|
74
|
+
type: :development
|
75
|
+
requirement: *id004
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
64
78
|
none: false
|
65
79
|
requirements:
|
66
80
|
- - ~>
|
@@ -74,9 +88,9 @@ dependencies:
|
|
74
88
|
name: bundler
|
75
89
|
prerelease: false
|
76
90
|
type: :development
|
77
|
-
requirement: *
|
91
|
+
requirement: *id005
|
78
92
|
- !ruby/object:Gem::Dependency
|
79
|
-
version_requirements: &
|
93
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
80
94
|
none: false
|
81
95
|
requirements:
|
82
96
|
- - ~>
|
@@ -90,9 +104,9 @@ dependencies:
|
|
90
104
|
name: jeweler
|
91
105
|
prerelease: false
|
92
106
|
type: :development
|
93
|
-
requirement: *
|
107
|
+
requirement: *id006
|
94
108
|
- !ruby/object:Gem::Dependency
|
95
|
-
version_requirements: &
|
109
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
96
110
|
none: false
|
97
111
|
requirements:
|
98
112
|
- - ">="
|
@@ -104,11 +118,53 @@ dependencies:
|
|
104
118
|
name: rcov
|
105
119
|
prerelease: false
|
106
120
|
type: :development
|
107
|
-
requirement: *
|
121
|
+
requirement: *id007
|
122
|
+
- !ruby/object:Gem::Dependency
|
123
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
hash: 3
|
129
|
+
segments:
|
130
|
+
- 0
|
131
|
+
version: "0"
|
132
|
+
name: daemons
|
133
|
+
prerelease: false
|
134
|
+
type: :runtime
|
135
|
+
requirement: *id008
|
136
|
+
- !ruby/object:Gem::Dependency
|
137
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
hash: 3
|
143
|
+
segments:
|
144
|
+
- 0
|
145
|
+
version: "0"
|
146
|
+
name: sys-cpu
|
147
|
+
prerelease: false
|
148
|
+
type: :runtime
|
149
|
+
requirement: *id009
|
150
|
+
- !ruby/object:Gem::Dependency
|
151
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
152
|
+
none: false
|
153
|
+
requirements:
|
154
|
+
- - ">="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
hash: 3
|
157
|
+
segments:
|
158
|
+
- 0
|
159
|
+
version: "0"
|
160
|
+
name: httparty
|
161
|
+
prerelease: false
|
162
|
+
type: :runtime
|
163
|
+
requirement: *id010
|
108
164
|
description: Heartbeat Client in Ruby
|
109
165
|
email: kiessler@inceedo.com
|
110
|
-
executables:
|
111
|
-
|
166
|
+
executables: []
|
167
|
+
|
112
168
|
extensions: []
|
113
169
|
|
114
170
|
extra_rdoc_files:
|
@@ -122,7 +178,6 @@ files:
|
|
122
178
|
- README.rdoc
|
123
179
|
- Rakefile
|
124
180
|
- VERSION
|
125
|
-
- bin/heartbeat_client
|
126
181
|
- lib/heartbeat-client.rb
|
127
182
|
- lib/heartbeat_proc.rb
|
128
183
|
- test/helper.rb
|
data/bin/heartbeat_client
DELETED