sonic 0.0.1 → 0.0.2
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/README.md +53 -5
- data/lib/sonic/service_checker.rb +2 -0
- data/lib/sonic/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -12,15 +12,63 @@ Add this line to your application's Gemfile:
|
|
12
12
|
|
13
13
|
And then execute:
|
14
14
|
|
15
|
-
$
|
15
|
+
$ rails g sonic
|
16
16
|
|
17
|
-
|
17
|
+
## Usage
|
18
18
|
|
19
|
-
|
19
|
+
Sonic is configured via a simple DSL. Service checks are added by
|
20
|
+
updating the file in `config/intializers/sonic_config.rb`
|
20
21
|
|
21
|
-
|
22
|
+
Currently three types of services can be checked, http, tcp, and amqp.
|
23
|
+
|
24
|
+
Here's an example sonic_config.rb file
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
module Sonic
|
28
|
+
checks = []
|
29
|
+
|
30
|
+
checks << Sonic.service_checker do
|
31
|
+
protocol :http
|
32
|
+
host 'myhttpserver'
|
33
|
+
port 80
|
34
|
+
path 'path/to/check'
|
35
|
+
end
|
36
|
+
|
37
|
+
checks << Sonic.service_checker do
|
38
|
+
protocol :amqp
|
39
|
+
host 'myrabbitmqserver'
|
40
|
+
port 5672
|
41
|
+
end
|
42
|
+
|
43
|
+
checks << Sonic.service_checker do
|
44
|
+
protocol :tcp
|
45
|
+
host 'mytcpserver'
|
46
|
+
port 12345
|
47
|
+
payload 'some command'
|
48
|
+
end
|
49
|
+
|
50
|
+
SONIC_CHECKS = checks
|
51
|
+
end
|
52
|
+
```
|
53
|
+
|
54
|
+
Sonic also comes with a Clockwork clock file that can be executed that
|
55
|
+
will check the configured services every 3 mintues. This file can be
|
56
|
+
executed via your Procfile or whatever daemonizer your using. For
|
57
|
+
example you could add this to your Profile
|
58
|
+
|
59
|
+
sonic_clock: bundle exec clockwork lib/sonic_clock.rb
|
60
|
+
|
61
|
+
## Rails Engine
|
62
|
+
|
63
|
+
The service checks are published to a json file in your rails public
|
64
|
+
folder at `public/sonic/results.json`. A very simple view is available
|
65
|
+
that will let you see your results. Include the routes by adding the
|
66
|
+
folowing to your `routes.rb` file
|
67
|
+
|
68
|
+
mount Sonic::Engine => "/sonic", :as => "sonic"
|
22
69
|
|
23
|
-
|
70
|
+
You can then view the status of your services by visiting `sonic/` or
|
71
|
+
`sonic/results.json`
|
24
72
|
|
25
73
|
## Contributing
|
26
74
|
|
data/lib/sonic/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sonic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|