maxwell_agent 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 70daf4d4dc9efc5f5a153b5855ee1f2692cc2da1
4
+ data.tar.gz: 1840529ca391f325e32bdc9f372f0e15331d72a6
5
+ SHA512:
6
+ metadata.gz: af1f03946f675229d98e529dc59243fa932a33411b9dd39c44772a8eafb029d78deaabcc1a47944370717ec22c0eb0aaf19d7f1a87d7dd431f3b74ab851d0338
7
+ data.tar.gz: d4198736fa2477528127c9c506629091e4e03d2d9f0705021d06d6a70a21840d0bdc2a012551ce706363f516bf036882eeeff20b91f5eb21ea84a439ac43d42c
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.gitignore ADDED
@@ -0,0 +1,49 @@
1
+ # rcov generated
2
+ coverage
3
+ coverage.data
4
+
5
+ # rdoc generated
6
+ rdoc
7
+
8
+ # yard generated
9
+ doc
10
+ .yardoc
11
+
12
+ # bundler
13
+ .bundle
14
+
15
+ # jeweler generated
16
+ pkg
17
+
18
+ # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
19
+ #
20
+ # * Create a file at ~/.gitignore
21
+ # * Include files you want ignored
22
+ # * Run: git config --global core.excludesfile ~/.gitignore
23
+ #
24
+ # After doing this, these files will be ignored in all your git projects,
25
+ # saving you from having to 'pollute' every project you touch with them
26
+ #
27
+ # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
28
+ #
29
+ # For MacOS:
30
+ #
31
+ #.DS_Store
32
+
33
+ # For TextMate
34
+ #*.tmproj
35
+ #tmtags
36
+
37
+ # For emacs:
38
+ #*~
39
+ #\#*
40
+ #.\#*
41
+
42
+ # For vim:
43
+ #*.swp
44
+
45
+ # For redcar:
46
+ #.redcar
47
+
48
+ # For rubinius:
49
+ #*.rbc
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - rbx-2.2.1
4
+ - 2.0.0
5
+ - 1.9.3
6
+ - jruby
data/Gemfile ADDED
@@ -0,0 +1,19 @@
1
+ source "http://rubygems.org"
2
+ gem 'rubysl', '~> 2.0', platforms: 'rbx'
3
+ group :development do
4
+ gem "rdoc", "~> 3.12"
5
+ gem "bundler", "~> 1.0"
6
+ gem 'guard'
7
+ gem 'guard-rspec'
8
+ end
9
+
10
+ gem 'rspec', group: [:test, :development]
11
+ gem 'rspec-given', group: [:test, :development]
12
+
13
+ gem 'celluloid'
14
+ gem 'redis'
15
+ gem 'fakeredis', group: [:test, :development], require: false
16
+ gem 'connection_pool'
17
+ gem 'activesupport', require: ['active_support/core_ext/integer/time']
18
+
19
+ gem 'rake', group: :test
data/Gemfile.lock ADDED
@@ -0,0 +1,316 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (4.0.1)
5
+ i18n (~> 0.6, >= 0.6.4)
6
+ minitest (~> 4.2)
7
+ multi_json (~> 1.3)
8
+ thread_safe (~> 0.1)
9
+ tzinfo (~> 0.3.37)
10
+ atomic (1.1.14)
11
+ atomic (1.1.14-java)
12
+ celluloid (0.15.2)
13
+ timers (~> 1.1.0)
14
+ celluloid-io (0.15.0)
15
+ celluloid (>= 0.15.0)
16
+ nio4r (>= 0.5.0)
17
+ coderay (1.0.9)
18
+ connection_pool (1.1.0)
19
+ diff-lcs (1.2.4)
20
+ fakeredis (0.4.2)
21
+ redis (~> 3.0.0)
22
+ ffi (1.9.3)
23
+ ffi (1.9.3-java)
24
+ ffi2-generators (0.1.1)
25
+ formatador (0.2.4)
26
+ given_core (3.1.1)
27
+ sorcerer (>= 0.3.7)
28
+ guard (2.2.3)
29
+ formatador (>= 0.2.4)
30
+ listen (~> 2.1)
31
+ lumberjack (~> 1.0)
32
+ pry (>= 0.9.12)
33
+ thor (>= 0.18.1)
34
+ guard-rspec (4.0.3)
35
+ guard (>= 2.1.1)
36
+ rspec (~> 2.14)
37
+ i18n (0.6.5)
38
+ json (1.8.1)
39
+ json (1.8.1-java)
40
+ listen (2.2.0)
41
+ celluloid (>= 0.15.2)
42
+ rb-fsevent (>= 0.9.3)
43
+ rb-inotify (>= 0.9)
44
+ lumberjack (1.0.4)
45
+ method_source (0.8.2)
46
+ minitest (4.7.5)
47
+ multi_json (1.8.2)
48
+ pry (0.9.12.2)
49
+ coderay (~> 1.0.5)
50
+ method_source (~> 0.8)
51
+ slop (~> 3.4)
52
+ pry (0.9.12.2-java)
53
+ coderay (~> 1.0.5)
54
+ method_source (~> 0.8)
55
+ slop (~> 3.4)
56
+ spoon (~> 0.0)
57
+ rake (10.1.0)
58
+ rb-fsevent (0.9.3)
59
+ rb-inotify (0.9.2)
60
+ ffi (>= 0.5.0)
61
+ rdoc (3.12.2)
62
+ json (~> 1.4)
63
+ redis (3.0.6)
64
+ rspec (2.14.1)
65
+ rspec-core (~> 2.14.0)
66
+ rspec-expectations (~> 2.14.0)
67
+ rspec-mocks (~> 2.14.0)
68
+ rspec-core (2.14.7)
69
+ rspec-expectations (2.14.3)
70
+ diff-lcs (>= 1.1.3, < 2.0)
71
+ rspec-given (3.1.1)
72
+ given_core (= 3.1.1)
73
+ rspec (>= 2.12)
74
+ rspec-mocks (2.14.4)
75
+ rubysl (2.0.12)
76
+ rubysl-abbrev (~> 2.0)
77
+ rubysl-base64 (~> 2.0)
78
+ rubysl-benchmark (~> 2.0)
79
+ rubysl-bigdecimal (~> 2.0)
80
+ rubysl-cgi (~> 2.0)
81
+ rubysl-cgi-session (~> 2.0)
82
+ rubysl-cmath (~> 2.0)
83
+ rubysl-complex (~> 2.0)
84
+ rubysl-continuation (~> 2.0)
85
+ rubysl-coverage (~> 2.0)
86
+ rubysl-csv (~> 2.0)
87
+ rubysl-curses (~> 2.0)
88
+ rubysl-date (~> 2.0)
89
+ rubysl-delegate (~> 2.0)
90
+ rubysl-digest (~> 2.0)
91
+ rubysl-drb (~> 2.0)
92
+ rubysl-e2mmap (~> 2.0)
93
+ rubysl-english (~> 2.0)
94
+ rubysl-enumerator (~> 2.0)
95
+ rubysl-erb (~> 2.0)
96
+ rubysl-etc (~> 2.0)
97
+ rubysl-expect (~> 2.0)
98
+ rubysl-fcntl (~> 2.0)
99
+ rubysl-fiber (~> 2.0)
100
+ rubysl-fileutils (~> 2.0)
101
+ rubysl-find (~> 2.0)
102
+ rubysl-forwardable (~> 2.0)
103
+ rubysl-getoptlong (~> 2.0)
104
+ rubysl-gserver (~> 2.0)
105
+ rubysl-io-console (~> 2.0)
106
+ rubysl-io-nonblock (~> 2.0)
107
+ rubysl-io-wait (~> 2.0)
108
+ rubysl-ipaddr (~> 2.0)
109
+ rubysl-irb (~> 2.0)
110
+ rubysl-json (~> 2.0)
111
+ rubysl-logger (~> 2.0)
112
+ rubysl-mathn (~> 2.0)
113
+ rubysl-matrix (~> 2.0)
114
+ rubysl-mkmf (~> 2.0)
115
+ rubysl-monitor (~> 2.0)
116
+ rubysl-mutex_m (~> 2.0)
117
+ rubysl-net-ftp (~> 2.0)
118
+ rubysl-net-http (~> 2.0)
119
+ rubysl-net-imap (~> 2.0)
120
+ rubysl-net-pop (~> 2.0)
121
+ rubysl-net-protocol (~> 2.0)
122
+ rubysl-net-smtp (~> 2.0)
123
+ rubysl-net-telnet (~> 2.0)
124
+ rubysl-nkf (~> 2.0)
125
+ rubysl-observer (~> 2.0)
126
+ rubysl-open-uri (~> 2.0)
127
+ rubysl-open3 (~> 2.0)
128
+ rubysl-openssl (~> 2.0)
129
+ rubysl-optparse (~> 2.0)
130
+ rubysl-ostruct (~> 2.0)
131
+ rubysl-pathname (~> 2.0)
132
+ rubysl-prettyprint (~> 2.0)
133
+ rubysl-prime (~> 2.0)
134
+ rubysl-profile (~> 2.0)
135
+ rubysl-profiler (~> 2.0)
136
+ rubysl-pstore (~> 2.0)
137
+ rubysl-pty (~> 2.0)
138
+ rubysl-rational (~> 2.0)
139
+ rubysl-readline (~> 2.0)
140
+ rubysl-resolv (~> 2.0)
141
+ rubysl-rexml (~> 2.0)
142
+ rubysl-rinda (~> 2.0)
143
+ rubysl-ripper (~> 2.0)
144
+ rubysl-rss (~> 2.0)
145
+ rubysl-scanf (~> 2.0)
146
+ rubysl-securerandom (~> 2.0)
147
+ rubysl-set (~> 2.0)
148
+ rubysl-shellwords (~> 2.0)
149
+ rubysl-singleton (~> 2.0)
150
+ rubysl-socket (~> 2.0)
151
+ rubysl-stringio (~> 2.0)
152
+ rubysl-strscan (~> 2.0)
153
+ rubysl-sync (~> 2.0)
154
+ rubysl-syslog (~> 2.0)
155
+ rubysl-tempfile (~> 2.0)
156
+ rubysl-test-unit (~> 2.0)
157
+ rubysl-thread (~> 2.0)
158
+ rubysl-thwait (~> 2.0)
159
+ rubysl-time (~> 2.0)
160
+ rubysl-timeout (~> 2.0)
161
+ rubysl-tmpdir (~> 2.0)
162
+ rubysl-tracer (~> 2.0)
163
+ rubysl-tsort (~> 2.0)
164
+ rubysl-un (~> 2.0)
165
+ rubysl-uri (~> 2.0)
166
+ rubysl-weakref (~> 2.0)
167
+ rubysl-webrick (~> 2.0)
168
+ rubysl-xmlrpc (~> 2.0)
169
+ rubysl-yaml (~> 2.0)
170
+ rubysl-zlib (~> 2.0)
171
+ rubysl-abbrev (2.0.2)
172
+ rubysl-base64 (2.0.0)
173
+ rubysl-benchmark (2.0.0)
174
+ rubysl-bigdecimal (2.0.2)
175
+ rubysl-cgi (2.0.0)
176
+ rubysl-cgi-session (2.0.0)
177
+ rubysl-cmath (2.0.0)
178
+ rubysl-complex (2.0.0)
179
+ rubysl-continuation (2.0.0)
180
+ rubysl-coverage (2.0.3)
181
+ rubysl-csv (2.0.1)
182
+ rubysl-english (~> 2.0)
183
+ rubysl-curses (2.0.0)
184
+ rubysl-date (2.0.6)
185
+ rubysl-delegate (2.0.0)
186
+ rubysl-digest (2.0.3)
187
+ rubysl-drb (2.0.1)
188
+ rubysl-e2mmap (2.0.0)
189
+ rubysl-english (2.0.0)
190
+ rubysl-enumerator (2.0.0)
191
+ rubysl-erb (2.0.0)
192
+ rubysl-etc (2.0.3)
193
+ ffi2-generators (~> 0.1)
194
+ rubysl-expect (2.0.0)
195
+ rubysl-fcntl (2.0.4)
196
+ ffi2-generators (~> 0.1)
197
+ rubysl-fiber (2.0.0)
198
+ rubysl-fileutils (2.0.2)
199
+ rubysl-find (2.0.0)
200
+ rubysl-forwardable (2.0.0)
201
+ rubysl-getoptlong (2.0.0)
202
+ rubysl-gserver (2.0.0)
203
+ rubysl-socket (~> 2.0)
204
+ rubysl-thread (~> 2.0)
205
+ rubysl-io-console (2.0.0)
206
+ rubysl-io-nonblock (2.0.0)
207
+ rubysl-io-wait (2.0.0)
208
+ rubysl-ipaddr (2.0.0)
209
+ rubysl-irb (2.0.3)
210
+ rubysl-e2mmap (~> 2.0)
211
+ rubysl-mathn (~> 2.0)
212
+ rubysl-readline (~> 2.0)
213
+ rubysl-thread (~> 2.0)
214
+ rubysl-tracer (~> 2.0)
215
+ rubysl-json (2.0.2)
216
+ rubysl-logger (2.0.0)
217
+ rubysl-mathn (2.0.0)
218
+ rubysl-matrix (2.1.0)
219
+ rubysl-e2mmap (~> 2.0)
220
+ rubysl-mkmf (2.0.1)
221
+ rubysl-fileutils (~> 2.0)
222
+ rubysl-shellwords (~> 2.0)
223
+ rubysl-monitor (2.0.0)
224
+ rubysl-mutex_m (2.0.0)
225
+ rubysl-net-ftp (2.0.1)
226
+ rubysl-net-http (2.0.4)
227
+ rubysl-cgi (~> 2.0)
228
+ rubysl-erb (~> 2.0)
229
+ rubysl-singleton (~> 2.0)
230
+ rubysl-net-imap (2.0.1)
231
+ rubysl-net-pop (2.0.1)
232
+ rubysl-net-protocol (2.0.1)
233
+ rubysl-net-smtp (2.0.1)
234
+ rubysl-net-telnet (2.0.0)
235
+ rubysl-nkf (2.0.1)
236
+ rubysl-observer (2.0.0)
237
+ rubysl-open-uri (2.0.0)
238
+ rubysl-open3 (2.0.0)
239
+ rubysl-openssl (2.0.3)
240
+ rubysl-optparse (2.0.1)
241
+ rubysl-shellwords (~> 2.0)
242
+ rubysl-ostruct (2.0.4)
243
+ rubysl-pathname (2.0.0)
244
+ rubysl-prettyprint (2.0.2)
245
+ rubysl-prime (2.0.0)
246
+ rubysl-profile (2.0.0)
247
+ rubysl-profiler (2.0.1)
248
+ rubysl-pstore (2.0.0)
249
+ rubysl-pty (2.0.2)
250
+ rubysl-rational (2.0.1)
251
+ rubysl-readline (2.0.2)
252
+ rubysl-resolv (2.0.0)
253
+ rubysl-rexml (2.0.2)
254
+ rubysl-rinda (2.0.0)
255
+ rubysl-ripper (2.0.0)
256
+ rubysl-rss (2.0.0)
257
+ rubysl-scanf (2.0.0)
258
+ rubysl-securerandom (2.0.0)
259
+ rubysl-set (2.0.1)
260
+ rubysl-shellwords (2.0.0)
261
+ rubysl-singleton (2.0.0)
262
+ rubysl-socket (2.0.1)
263
+ rubysl-stringio (2.0.0)
264
+ rubysl-strscan (2.0.0)
265
+ rubysl-sync (2.0.0)
266
+ rubysl-syslog (2.0.1)
267
+ ffi2-generators (~> 0.1)
268
+ rubysl-tempfile (2.0.1)
269
+ rubysl-test-unit (2.0.1)
270
+ minitest (~> 4.7)
271
+ rubysl-thread (2.0.2)
272
+ rubysl-thwait (2.0.0)
273
+ rubysl-time (2.0.3)
274
+ rubysl-timeout (2.0.0)
275
+ rubysl-tmpdir (2.0.0)
276
+ rubysl-tracer (2.0.0)
277
+ rubysl-tsort (2.0.1)
278
+ rubysl-un (2.0.0)
279
+ rubysl-fileutils (~> 2.0)
280
+ rubysl-optparse (~> 2.0)
281
+ rubysl-uri (2.0.0)
282
+ rubysl-weakref (2.0.0)
283
+ rubysl-webrick (2.0.0)
284
+ rubysl-xmlrpc (2.0.0)
285
+ rubysl-yaml (2.0.3)
286
+ rubysl-zlib (2.0.1)
287
+ slop (3.4.6)
288
+ sorcerer (1.0.2)
289
+ spoon (0.0.4)
290
+ ffi
291
+ thor (0.18.1)
292
+ thread_safe (0.1.3)
293
+ atomic
294
+ thread_safe (0.1.3-java)
295
+ atomic
296
+ timers (1.1.0)
297
+ tzinfo (0.3.38)
298
+
299
+ PLATFORMS
300
+ java
301
+ ruby
302
+
303
+ DEPENDENCIES
304
+ activesupport
305
+ bundler (~> 1.0)
306
+ celluloid
307
+ connection_pool
308
+ fakeredis
309
+ guard
310
+ guard-rspec
311
+ rake
312
+ rdoc (~> 3.12)
313
+ redis
314
+ rspec
315
+ rspec-given
316
+ rubysl (~> 2.0)
data/Guardfile ADDED
@@ -0,0 +1,24 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard :rspec do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+
9
+ # Rails example
10
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
11
+ watch(%r{^lib/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
12
+ watch(%r{^lib/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
13
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
14
+ watch('config/routes.rb') { "spec/routing" }
15
+ watch('lib/controllers/liblication_controller.rb') { "spec/controllers" }
16
+
17
+ # Capybara features specs
18
+ watch(%r{^lib/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
19
+
20
+ # Turnip features and steps
21
+ watch(%r{^spec/acceptance/(.+)\.feature$})
22
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
23
+ end
24
+
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 Brian Goff
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,85 @@
1
+ [![Build Status](https://travis-ci.org/cpuguy83/monitoring_agent.png)](https://travis-ci.org/cpuguy83/monitoring_agent)
2
+
3
+ # Maxwell agent
4
+
5
+ The intention of this is as yet another Nagios replacement.
6
+ It is an single process, multithreaded monitoring agent
7
+ It is based on the Celluloid Actor framework.
8
+
9
+ This is 1 part of 3 piece monitoring framework.<br>
10
+ ####Maxwell agent(this)
11
+ - the actual monitoring process
12
+
13
+ ###Maxwell agent reporting WUI -
14
+ - View check results/stats (akin to the main Nagios WUI)
15
+
16
+ ###server
17
+ - Store agents configs
18
+ - View agent results
19
+ - Agents check in to get configuration
20
+ - Agents check in to report check results and other statistics
21
+
22
+ This is still in early development, use at your own risk
23
+
24
+ To use:
25
+ ```ruby
26
+ require 'maxwell/agent'
27
+ Maxwell::Agent.start!
28
+ ```
29
+ Check out config/schedule.rb for an example on how to schedule work.<br />
30
+ Major changes are coming to this configuration, what's here now is for example only.
31
+
32
+ Everything is currently kept only in-memory.<br>
33
+ If the agent is restarted all data will be lost<br>
34
+
35
+
36
+ ###Middleware
37
+ You can write your own middleware which gets run after each check is performed.<br>
38
+ In the middleware you have access to the "work" object.<br>
39
+ The work object is where check results and other bits of info are stored.
40
+
41
+ To write your middleware:
42
+ ```ruby
43
+ module Maxwell
44
+ module Agent
45
+ module Middleware
46
+ class MyAwesomeMiddlewares
47
+ def call(work)
48
+ # Some awesome stuff before passing to the next item in the chain
49
+ yield
50
+ # Some more awesome stuff once the chain bubbles back up
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ ```
57
+ You register your middleware as such:
58
+ ```ruby
59
+ Maxwell::Agent.configure do |config|
60
+ config.middleware do |chain|
61
+ chain.add Maxwell::Middleware::MyAwesomeMiddlewares
62
+ end
63
+ end
64
+ ```
65
+ Your middleware must define a "call" method.<br>
66
+ Everything before the yield is called before passing on to the next middleware<br>
67
+ Everything after the yield is called after the rest of the middleware stack has run<br>
68
+ If you do not yield in your middleware call it will break the chain (and likely the app)
69
+
70
+ ## Contributing to agent
71
+
72
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
73
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
74
+ * Fork the project.
75
+ * Start a feature/bugfix branch.
76
+ * Commit and push until you are happy with your contribution.
77
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
78
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
79
+
80
+ ## Copyright
81
+
82
+ Copyright (c) 2013 Brian Goff. See LICENSE.txt for
83
+ further details.
84
+
85
+
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+ task :default => :spec
4
+ RSpec::Core::RakeTask.new
@@ -0,0 +1,8 @@
1
+ [
2
+ { "name": "foo", "address": "localhost",
3
+ "services": [
4
+ {"name": "check-host-alive", "probe_class": "CheckPing"}
5
+ ]
6
+ }
7
+
8
+ ]
@@ -0,0 +1,31 @@
1
+ require 'json'
2
+ require 'open-uri'
3
+ module Maxwell
4
+ module Agent
5
+ class Configuration
6
+ attr_accessor :worker_concurrency, :host_configuration, :work_poll,
7
+ :redis_options
8
+ attr_reader :middleware_chain
9
+
10
+ def initialize
11
+ @worker_concurrency = 25
12
+ @middleware_chain = default_middleware
13
+ @work_poll = 1
14
+ @host_configuration = 'config/host_configuration.json'
15
+ @redis_options = { host: 'localhost', port: 6379 }
16
+ end
17
+
18
+ def middleware
19
+ @middleware_chain ||= default_middleware
20
+ yield @middleware_chain if block_given?
21
+ @middleware_chain
22
+ end
23
+
24
+ def default_middleware
25
+ Maxwell::Middleware::Chain.new do |m|
26
+ m.add Maxwell::Middleware::Logging
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,11 @@
1
+ module Maxwell
2
+ module Agent
3
+ module DynamicAttributes
4
+ def method_missing(method_name, *args)
5
+ singleton_class.
6
+ class_eval { attr_accessor method_name.to_s.gsub(/=$/, '') }
7
+ send(method_name, *args)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,29 @@
1
+ require 'agent/work'
2
+ require 'agent/dynamic_attributes'
3
+ module Maxwell
4
+ module Agent
5
+ class Host
6
+ include DynamicAttributes
7
+
8
+ class Service
9
+ include Work
10
+ def initialize(attrs={})
11
+ @hosts ||= []
12
+ end
13
+ end
14
+
15
+ def initialize(attrs={})
16
+ @services ||= []
17
+ @hosts ||= []
18
+ end
19
+
20
+ def add_service(service)
21
+ self.services << service
22
+ end
23
+
24
+ def add_host(host)
25
+ self.hosts << host
26
+ end
27
+ end
28
+ end
29
+ end