heartbeat-client 0.4.4 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -2
- data/Gemfile.lock +40 -20
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/heartbeat-client.yml.sample +3 -0
- data/lib/heartbeat-client.rb +10 -0
- metadata +56 -43
data/Gemfile
CHANGED
@@ -3,12 +3,13 @@ gem 'httparty'
|
|
3
3
|
gem 'daemons'
|
4
4
|
gem 'foreman'
|
5
5
|
gem 'macaddr'
|
6
|
+
gem 'keen'
|
6
7
|
|
7
8
|
# Add dependencies to develop your gem here.
|
8
9
|
# Include everything needed to run rake, tests, features, etc.
|
9
10
|
group :development do
|
10
11
|
gem "shoulda", ">= 0"
|
11
|
-
gem "bundler", "~> 1.
|
12
|
-
gem "jeweler", "~> 1.
|
12
|
+
gem "bundler", "~> 1.1.3"
|
13
|
+
gem "jeweler", "~> 1.8.4"
|
13
14
|
gem "rcov", ">= 0"
|
14
15
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,38 +1,58 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
activesupport (3.2.12)
|
5
|
+
i18n (~> 0.6)
|
6
|
+
multi_json (~> 1.0)
|
7
|
+
bourne (1.1.2)
|
8
|
+
mocha (= 0.10.5)
|
9
|
+
daemons (1.1.9)
|
10
|
+
foreman (0.61.0)
|
7
11
|
thor (>= 0.13.6)
|
8
12
|
git (1.2.5)
|
9
|
-
httparty (0.
|
10
|
-
multi_json
|
11
|
-
multi_xml
|
12
|
-
|
13
|
-
|
13
|
+
httparty (0.10.2)
|
14
|
+
multi_json (~> 1.0)
|
15
|
+
multi_xml (>= 0.5.2)
|
16
|
+
i18n (0.6.1)
|
17
|
+
jeweler (1.8.4)
|
18
|
+
bundler (~> 1.0)
|
14
19
|
git (>= 1.2.5)
|
15
20
|
rake
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
rdoc
|
22
|
+
json (1.7.7)
|
23
|
+
keen (0.4.4)
|
24
|
+
multi_json (~> 1.0)
|
25
|
+
macaddr (1.6.1)
|
26
|
+
systemu (~> 2.5.0)
|
27
|
+
metaclass (0.0.1)
|
28
|
+
mocha (0.10.5)
|
29
|
+
metaclass (~> 0.0.1)
|
30
|
+
multi_json (1.6.1)
|
31
|
+
multi_xml (0.5.3)
|
32
|
+
rake (10.0.3)
|
33
|
+
rcov (1.0.0)
|
34
|
+
rdoc (3.12.1)
|
35
|
+
json (~> 1.4)
|
36
|
+
shoulda (3.3.2)
|
37
|
+
shoulda-context (~> 1.0.1)
|
38
|
+
shoulda-matchers (~> 1.4.1)
|
39
|
+
shoulda-context (1.0.2)
|
40
|
+
shoulda-matchers (1.4.2)
|
41
|
+
activesupport (>= 3.0.0)
|
42
|
+
bourne (~> 1.1.2)
|
43
|
+
systemu (2.5.2)
|
44
|
+
thor (0.17.0)
|
26
45
|
|
27
46
|
PLATFORMS
|
28
47
|
ruby
|
29
48
|
|
30
49
|
DEPENDENCIES
|
31
|
-
bundler (~> 1.
|
50
|
+
bundler (~> 1.1.3)
|
32
51
|
daemons
|
33
52
|
foreman
|
34
53
|
httparty
|
35
|
-
jeweler (~> 1.
|
54
|
+
jeweler (~> 1.8.4)
|
55
|
+
keen
|
36
56
|
macaddr
|
37
57
|
rcov
|
38
58
|
shoulda
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
data/heartbeat-client.yml.sample
CHANGED
data/lib/heartbeat-client.rb
CHANGED
@@ -5,6 +5,7 @@ require 'logger'
|
|
5
5
|
require 'macaddr'
|
6
6
|
require 'net/http'
|
7
7
|
require 'json'
|
8
|
+
require 'keen'
|
8
9
|
|
9
10
|
class Heartbeat
|
10
11
|
include HTTParty
|
@@ -33,6 +34,9 @@ class Heartbeat
|
|
33
34
|
name = config['name']
|
34
35
|
apache_status = config['apache_status']
|
35
36
|
mongostat_arguments = config['mongostat_arguments']
|
37
|
+
keen_project_token = config['keen_project_token']
|
38
|
+
keen_api_key = config['keen_api_key']
|
39
|
+
keen_collection = config['keen_collection']
|
36
40
|
|
37
41
|
if gather_metrics
|
38
42
|
procs = {'total' => 0, 'running' => 0, 'stuck' => 0, 'sleeping' => 0, 'threads' => 0, 'stopped' => 0, 'zombie' => 0}
|
@@ -145,6 +149,12 @@ class Heartbeat
|
|
145
149
|
log.info("#create - Sending data to endpoint (with metrics)...")
|
146
150
|
res = Heartbeat.post(endpoint + '/heartbeat', options)
|
147
151
|
log.debug("Response: #{res.response.inspect}") if res
|
152
|
+
|
153
|
+
if keen_project_token and keen_api_key and keen_collection
|
154
|
+
keen = Keen::Client.new(:project_id => keen_project_token, :api_key => keen_api_key)
|
155
|
+
data = options[:body][:heartbeat]
|
156
|
+
keen.publish(keen_collection, {:host => data[:host], :cpu => data[:values][:cpu_usage]})
|
157
|
+
end
|
148
158
|
else
|
149
159
|
log.error "No top output found."
|
150
160
|
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: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 5
|
9
|
+
- 0
|
10
|
+
version: 0.5.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Oliver Kiessler
|
@@ -15,10 +15,10 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2013-02-23 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
|
21
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
22
22
|
none: false
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
@@ -27,12 +27,12 @@ dependencies:
|
|
27
27
|
segments:
|
28
28
|
- 0
|
29
29
|
version: "0"
|
30
|
+
version_requirements: *id001
|
30
31
|
name: httparty
|
31
32
|
prerelease: false
|
32
33
|
type: :runtime
|
33
|
-
requirement: *id001
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
|
-
|
35
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
36
36
|
none: false
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
@@ -41,12 +41,12 @@ dependencies:
|
|
41
41
|
segments:
|
42
42
|
- 0
|
43
43
|
version: "0"
|
44
|
+
version_requirements: *id002
|
44
45
|
name: daemons
|
45
46
|
prerelease: false
|
46
47
|
type: :runtime
|
47
|
-
requirement: *id002
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
|
-
|
49
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
@@ -55,12 +55,12 @@ dependencies:
|
|
55
55
|
segments:
|
56
56
|
- 0
|
57
57
|
version: "0"
|
58
|
+
version_requirements: *id003
|
58
59
|
name: foreman
|
59
60
|
prerelease: false
|
60
61
|
type: :runtime
|
61
|
-
requirement: *id003
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
|
63
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
64
64
|
none: false
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
@@ -69,12 +69,26 @@ dependencies:
|
|
69
69
|
segments:
|
70
70
|
- 0
|
71
71
|
version: "0"
|
72
|
+
version_requirements: *id004
|
72
73
|
name: macaddr
|
73
74
|
prerelease: false
|
74
75
|
type: :runtime
|
75
|
-
requirement: *id004
|
76
76
|
- !ruby/object:Gem::Dependency
|
77
|
-
|
77
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
hash: 3
|
83
|
+
segments:
|
84
|
+
- 0
|
85
|
+
version: "0"
|
86
|
+
version_requirements: *id005
|
87
|
+
name: keen
|
88
|
+
prerelease: false
|
89
|
+
type: :runtime
|
90
|
+
- !ruby/object:Gem::Dependency
|
91
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
78
92
|
none: false
|
79
93
|
requirements:
|
80
94
|
- - ">="
|
@@ -83,44 +97,44 @@ dependencies:
|
|
83
97
|
segments:
|
84
98
|
- 0
|
85
99
|
version: "0"
|
100
|
+
version_requirements: *id006
|
86
101
|
name: shoulda
|
87
102
|
prerelease: false
|
88
103
|
type: :development
|
89
|
-
requirement: *id005
|
90
104
|
- !ruby/object:Gem::Dependency
|
91
|
-
|
105
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
92
106
|
none: false
|
93
107
|
requirements:
|
94
108
|
- - ~>
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
hash:
|
110
|
+
hash: 21
|
97
111
|
segments:
|
98
112
|
- 1
|
99
|
-
-
|
100
|
-
-
|
101
|
-
version: 1.
|
113
|
+
- 1
|
114
|
+
- 3
|
115
|
+
version: 1.1.3
|
116
|
+
version_requirements: *id007
|
102
117
|
name: bundler
|
103
118
|
prerelease: false
|
104
119
|
type: :development
|
105
|
-
requirement: *id006
|
106
120
|
- !ruby/object:Gem::Dependency
|
107
|
-
|
121
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
108
122
|
none: false
|
109
123
|
requirements:
|
110
124
|
- - ~>
|
111
125
|
- !ruby/object:Gem::Version
|
112
|
-
hash:
|
126
|
+
hash: 63
|
113
127
|
segments:
|
114
128
|
- 1
|
115
|
-
-
|
116
|
-
-
|
117
|
-
version: 1.
|
129
|
+
- 8
|
130
|
+
- 4
|
131
|
+
version: 1.8.4
|
132
|
+
version_requirements: *id008
|
118
133
|
name: jeweler
|
119
134
|
prerelease: false
|
120
135
|
type: :development
|
121
|
-
requirement: *id007
|
122
136
|
- !ruby/object:Gem::Dependency
|
123
|
-
|
137
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
124
138
|
none: false
|
125
139
|
requirements:
|
126
140
|
- - ">="
|
@@ -129,12 +143,12 @@ dependencies:
|
|
129
143
|
segments:
|
130
144
|
- 0
|
131
145
|
version: "0"
|
146
|
+
version_requirements: *id009
|
132
147
|
name: rcov
|
133
148
|
prerelease: false
|
134
149
|
type: :development
|
135
|
-
requirement: *id008
|
136
150
|
- !ruby/object:Gem::Dependency
|
137
|
-
|
151
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
138
152
|
none: false
|
139
153
|
requirements:
|
140
154
|
- - ">="
|
@@ -143,12 +157,12 @@ dependencies:
|
|
143
157
|
segments:
|
144
158
|
- 0
|
145
159
|
version: "0"
|
160
|
+
version_requirements: *id010
|
146
161
|
name: daemons
|
147
162
|
prerelease: false
|
148
163
|
type: :runtime
|
149
|
-
requirement: *id009
|
150
164
|
- !ruby/object:Gem::Dependency
|
151
|
-
|
165
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
152
166
|
none: false
|
153
167
|
requirements:
|
154
168
|
- - ">="
|
@@ -157,12 +171,12 @@ dependencies:
|
|
157
171
|
segments:
|
158
172
|
- 0
|
159
173
|
version: "0"
|
174
|
+
version_requirements: *id011
|
160
175
|
name: httparty
|
161
176
|
prerelease: false
|
162
177
|
type: :runtime
|
163
|
-
requirement: *id010
|
164
178
|
- !ruby/object:Gem::Dependency
|
165
|
-
|
179
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
166
180
|
none: false
|
167
181
|
requirements:
|
168
182
|
- - ">="
|
@@ -171,12 +185,12 @@ dependencies:
|
|
171
185
|
segments:
|
172
186
|
- 0
|
173
187
|
version: "0"
|
188
|
+
version_requirements: *id012
|
174
189
|
name: json
|
175
190
|
prerelease: false
|
176
191
|
type: :runtime
|
177
|
-
requirement: *id011
|
178
192
|
- !ruby/object:Gem::Dependency
|
179
|
-
|
193
|
+
requirement: &id013 !ruby/object:Gem::Requirement
|
180
194
|
none: false
|
181
195
|
requirements:
|
182
196
|
- - ">="
|
@@ -185,12 +199,12 @@ dependencies:
|
|
185
199
|
segments:
|
186
200
|
- 0
|
187
201
|
version: "0"
|
202
|
+
version_requirements: *id013
|
188
203
|
name: foreman
|
189
204
|
prerelease: false
|
190
205
|
type: :runtime
|
191
|
-
requirement: *id012
|
192
206
|
- !ruby/object:Gem::Dependency
|
193
|
-
|
207
|
+
requirement: &id014 !ruby/object:Gem::Requirement
|
194
208
|
none: false
|
195
209
|
requirements:
|
196
210
|
- - ">="
|
@@ -199,10 +213,10 @@ dependencies:
|
|
199
213
|
segments:
|
200
214
|
- 0
|
201
215
|
version: "0"
|
216
|
+
version_requirements: *id014
|
202
217
|
name: macaddr
|
203
218
|
prerelease: false
|
204
219
|
type: :runtime
|
205
|
-
requirement: *id013
|
206
220
|
description: Heartbeat Client in Ruby
|
207
221
|
email: kiessler@inceedo.com
|
208
222
|
executables:
|
@@ -255,10 +269,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
255
269
|
requirements: []
|
256
270
|
|
257
271
|
rubyforge_project:
|
258
|
-
rubygems_version: 1.8.
|
272
|
+
rubygems_version: 1.8.25
|
259
273
|
signing_key:
|
260
274
|
specification_version: 3
|
261
275
|
summary: Heartbeat
|
262
|
-
test_files:
|
263
|
-
|
264
|
-
- test/test_heartbeat-client.rb
|
276
|
+
test_files: []
|
277
|
+
|