eye-patch 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +49 -13
- data/lib/eye/notify/awssdk.rb +44 -0
- data/lib/eye/notify/ses.rb +0 -2
- data/lib/eye/patch.rb +8 -4
- data/lib/eye/patch/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b3916ac3ff82a328806885a727764529794589f
|
4
|
+
data.tar.gz: a772bb0b5a1a22b40d5b47fea49e968d4ac1ac3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18d93b251bd6a48484c4d4f21c042ca79cf9ad91b87a63fa1ab3ed47040858b44517da916bbd0e40a20c066950c842448c4c7ae51feb73a56df4312fa2a10dd4
|
7
|
+
data.tar.gz: 8c107ef5c89ebb9423966e69e24159c2e032e0a86c628bd0264de4cc565ac86ded97306225f289e05ab7dd11ddf1048466c9363977b9860dd75b843f7a29d856
|
data/README.md
CHANGED
@@ -28,28 +28,64 @@ Or install it yourself as:
|
|
28
28
|
|
29
29
|
`Eye::Patch` forgoes granular process-level notification in favor of setting up application-wide notifications for different reporting levels. The following configuration will send all error notifications to the described contact via Amazon's SES service.
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
31
|
+
Note that SES support will only be provided if a necessary gem is installed on the system.
|
32
|
+
|
33
|
+
`Eye::Patch` supports 2 different SES-backed gems:
|
34
|
+
|
35
|
+
1. If the [`aws-ses`](https://github.com/drewblas/aws-ses) gem is available on the system, use the `type: ses` setting.
|
36
|
+
|
37
|
+
Example configuration:
|
38
|
+
|
39
|
+
notifications:
|
40
|
+
- name: crash # this name must match the "notify" target of the process.
|
41
|
+
type: ses # for aws-ses
|
42
|
+
level: error
|
43
|
+
contact: test+admin@example.com
|
44
|
+
config:
|
45
|
+
from: eye+notifications@example.com
|
46
|
+
access_key_id: Your+AWS+Access+Key+ID
|
47
|
+
secret_access_key: Your+AWS+Secret+Access+Key
|
48
|
+
|
49
|
+
2. If the [`aws-sdk`](https://github.com/aws/aws-sdk-ruby/) gem is available on the system, use the `type: aws_sdk` setting. (Note: usually this gem is installed as a consequence of installing [aws-sdk-rails](https://github.com/aws/aws-sdk-rails)).
|
50
|
+
|
51
|
+
Example configuration:
|
40
52
|
|
41
|
-
|
53
|
+
notifications:
|
54
|
+
- name: crash # this name must match the "notify" target of the process.
|
55
|
+
type: aws_sdk # for aws-sdk
|
56
|
+
level: error
|
57
|
+
contact: test+admin@example.com
|
58
|
+
config:
|
59
|
+
from: eye+notifications@example.com
|
60
|
+
region: us-east-1 # optional
|
61
|
+
# NOTE: the default region is us-east-1. It can be overriden.
|
62
|
+
access_key_id: Your+AWS+Access+Key+ID # optional
|
63
|
+
secret_access_key: Your+AWS+Secret+Access+Key # optional
|
64
|
+
|
65
|
+
|
66
|
+
In either case above, an example notification block for monitored process:
|
67
|
+
|
68
|
+
processes:
|
69
|
+
- name: unicorn
|
70
|
+
config:
|
71
|
+
pid_file: tmp/pids/unicorn.pid
|
72
|
+
start_command: bundle exec unicorn -c config/unicorn/<%= ENV["RAILS_ENV"] %>.rb -D
|
73
|
+
....
|
74
|
+
monitor_children:
|
75
|
+
stop_command: "kill -QUIT {PID}"
|
76
|
+
notify:
|
77
|
+
crash: error # this must match the "name" of the notification above
|
42
78
|
|
43
79
|
#### Triggers/Checks
|
44
80
|
|
45
|
-
Triggers and checks are set up much like `eye`'s basic DSL. All trigger and check types available in `eye` are supported.
|
81
|
+
Triggers and checks are set up much like `eye`'s basic DSL. All trigger and check types available in `eye` are supported.
|
46
82
|
|
47
83
|
triggers:
|
48
84
|
- name: flapping
|
49
85
|
config:
|
50
86
|
times: 10
|
51
87
|
within: 1 minute
|
52
|
-
|
88
|
+
|
53
89
|
checks:
|
54
90
|
- name: memory
|
55
91
|
config:
|
@@ -73,7 +109,7 @@ Processes will inherit all configurations from the main application. All process
|
|
73
109
|
|
74
110
|
##### Checks and Triggers
|
75
111
|
|
76
|
-
You can define per-process checks and triggers by defining a `checks` or `triggers` block within the process definition.
|
112
|
+
You can define per-process checks and triggers by defining a `checks` or `triggers` block within the process definition.
|
77
113
|
|
78
114
|
processes:
|
79
115
|
- name: my-process
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require "aws-sdk-core"
|
2
|
+
require "aws-sdk-core/ses"
|
3
|
+
|
4
|
+
module Eye
|
5
|
+
class Notify
|
6
|
+
class AWSSDK < Eye::Notify
|
7
|
+
param :region, String
|
8
|
+
param :access_key_id, String
|
9
|
+
param :secret_access_key, String
|
10
|
+
param :from, String, true
|
11
|
+
|
12
|
+
def execute
|
13
|
+
options = { region: "us-east-1" } # default to us-east-1
|
14
|
+
options[:region] = region if region
|
15
|
+
if access_key_id && secret_access_key
|
16
|
+
options[:credentials] = Aws::Credentials.new(access_key_id, secret_access_key)
|
17
|
+
end
|
18
|
+
client = Aws::SES::Client.new(options)
|
19
|
+
client.send_email(message)
|
20
|
+
end
|
21
|
+
|
22
|
+
def message
|
23
|
+
{ source: from,
|
24
|
+
destination: {
|
25
|
+
to_addresses: [contact]
|
26
|
+
},
|
27
|
+
message: {
|
28
|
+
subject: {
|
29
|
+
data: message_subject
|
30
|
+
},
|
31
|
+
body: {
|
32
|
+
text: {
|
33
|
+
data: message_body
|
34
|
+
},
|
35
|
+
html: {
|
36
|
+
data: message_body
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
data/lib/eye/notify/ses.rb
CHANGED
data/lib/eye/patch.rb
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
require "eye"
|
2
2
|
require "eye/patch/overrides"
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
Eye::Notify::TYPES[:ses] = "SES"
|
5
|
+
Eye::Notify::TYPES[:aws_sdk] = "AWSSDK"
|
6
|
+
|
7
|
+
module Eye
|
8
|
+
class Notify
|
9
|
+
autoload :SES, "eye/notify/ses"
|
10
|
+
autoload :AWSSDK, "eye/notify/awssdk"
|
11
|
+
end
|
8
12
|
end
|
9
13
|
|
10
14
|
module Eye::Patch
|
data/lib/eye/patch/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eye-patch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Horner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eye
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- examples/thin.yml
|
117
117
|
- examples/unicorn.yml
|
118
118
|
- eye-patch.gemspec
|
119
|
+
- lib/eye/notify/awssdk.rb
|
119
120
|
- lib/eye/notify/ses.rb
|
120
121
|
- lib/eye/patch.rb
|
121
122
|
- lib/eye/patch/application.rb
|
@@ -156,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
157
|
version: '0'
|
157
158
|
requirements: []
|
158
159
|
rubyforge_project:
|
159
|
-
rubygems_version: 2.4.5
|
160
|
+
rubygems_version: 2.4.5.1
|
160
161
|
signing_key:
|
161
162
|
specification_version: 4
|
162
163
|
summary: Eye::Patch abstracts out the Eye DSL to allow you to load your configuration
|