aws-alert-monitor 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,9 @@
1
+ ## head:
2
+
3
+ ## 0.1.0 (04/06/2013):
4
+
5
+ * Add support for `process_down` event
6
+
1
7
  ## 0.0.5:
2
8
 
3
9
  * Internal refactor
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  AWS Alert Monitor listenting to an SQS queue for alarms and sends email via SES based on rules applied in ~/.aws-alert-monitor.yml to those alerts.
6
6
 
7
7
  ## Installation
8
- ```
8
+ ```text
9
9
  gem install aws-alert-monitor
10
10
  ```
11
11
 
@@ -13,7 +13,7 @@ gem install aws-alert-monitor
13
13
 
14
14
  Add ~/.aws-alert-monitor.yml with the following syntax:
15
15
 
16
- ```
16
+ ```yaml
17
17
  app1:
18
18
  access_key: Key
19
19
  secret_key: Secret
@@ -49,20 +49,36 @@ Currently, this gem supports the following event types:
49
49
 
50
50
  #### CloudWatch
51
51
  Cloud watch support is somewhat generic. The event pattern is:
52
- ```
52
+ ```text
53
53
  cloudwatch:$metric_namespace-$metric_name
54
54
  ```
55
55
 
56
56
  For example:
57
- ```
57
+ ```text
58
58
  cloudwatch:AWS/SQS-ApproximateNumberOfMessagesVisible
59
59
  ```
60
60
 
61
+ #### Process Down
62
+ There is basic support for reporting that a process is not running.
63
+
64
+ The event type for this is `process_down`.
65
+
66
+ The schema for this type of event is:
67
+ ```json
68
+ {
69
+ "Subject": "process_down",
70
+ "Message": "{ \"body\": \"Your message about process down\", \"created_at\": \"2013-04-03T20:30:36Z\", \"process\": \"httpd\", \"required_count\": 5, \"running_count\": 2, \"environment\": \"dev\", \"host\": \"wwwdev1.example.com\"}"
71
+ }
72
+ ```
73
+
74
+ Unfortunately that is JSON inside JSON (as that is what AWS sends in many of their messages).
75
+
76
+
61
77
  #### Unknown
62
78
  If a message does not match one of the above types, then it will be classified as unknown.
63
79
 
64
80
  You can control the notification of these messages with:
65
- ```
81
+ ```text
66
82
  unknown
67
83
  ```
68
84
 
@@ -7,6 +7,7 @@ require "aws-alert-monitor/event_classifier"
7
7
  require "aws-alert-monitor/events"
8
8
  require "aws-alert-monitor/events/auto_scaling_notification"
9
9
  require "aws-alert-monitor/events/cloud_watch_alarm"
10
+ require "aws-alert-monitor/events/process_down"
10
11
  require "aws-alert-monitor/events/unknown"
11
12
  require "aws-alert-monitor/logger"
12
13
  require "aws-alert-monitor/parser"
@@ -18,7 +18,8 @@ module AwsAlertMonitor
18
18
  def event_subjects_classes
19
19
  {
20
20
  /\AAuto Scaling: / => AwsAlertMonitor::Events::AutoScalingNotification,
21
- /\AALARM: / => AwsAlertMonitor::Events::CloudWatchAlarm
21
+ /\AALARM: / => AwsAlertMonitor::Events::CloudWatchAlarm,
22
+ /\Aprocess_down/ => AwsAlertMonitor::Events::ProcessDown
22
23
  }
23
24
  end
24
25
 
@@ -0,0 +1,34 @@
1
+ module AwsAlertMonitor
2
+ module Events
3
+
4
+ class ProcessDown < Event
5
+
6
+ def body
7
+ message = "received an alert: \n\n "
8
+ message << "#{description}\n\n "
9
+ message << "Environment: #{environment}\n\n "
10
+ message << "Host: #{host}\n\n "
11
+ message << "At #{created_at}"
12
+ end
13
+
14
+ def subject
15
+ "Alert: process #{process} down #{environment}"
16
+ end
17
+
18
+ def type
19
+ 'process_down'
20
+ end
21
+
22
+ private
23
+ %w[created_at environment host required_count running_count process].each do |m|
24
+ define_method(m) { message_data[m] }
25
+ end
26
+
27
+ def description
28
+ message_data['body']
29
+ end
30
+
31
+ end
32
+
33
+ end
34
+ end
@@ -1,3 +1,3 @@
1
1
  module AwsAlertMonitor
2
- VERSION = "0.0.5"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -22,6 +22,15 @@ describe AwsAlertMonitor::EventClassifier do
22
22
  end
23
23
  end
24
24
 
25
+ context 'process down' do
26
+ let(:message) { fixture_file('process_down.json') }
27
+ let(:classifier) { AwsAlertMonitor::EventClassifier.new message }
28
+
29
+ it 'returns the appropriate event object' do
30
+ classifier.event.type.should == 'process_down'
31
+ end
32
+ end
33
+
25
34
  context 'unknown' do
26
35
  let(:message) { '{ "foo": "bar" }'}
27
36
  let(:classifier) { AwsAlertMonitor::EventClassifier.new message }
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe AwsAlertMonitor::Events::ProcessDown do
4
+
5
+ let(:message) { fixture_file('process_down.json') }
6
+ let(:event) { AwsAlertMonitor::Events::ProcessDown.new message }
7
+
8
+ describe 'body' do
9
+ it 'returns the body' do
10
+ data = "received an alert: \n\n "
11
+ data << "Required process foo down. 1 running, 2 required.\n\n "
12
+ data << "Environment: lc-pod-2-dev-1\n\n "
13
+ data << "Host: host1.example.com\n\n "
14
+ data << "At 2013-01-30T22:00:50Z"
15
+ event.body.should == data
16
+ end
17
+ end
18
+
19
+ describe 'subject' do
20
+ it 'returns the subject' do
21
+ event.subject.should == 'Alert: process foo down lc-pod-2-dev-1'
22
+ end
23
+ end
24
+
25
+ describe 'type' do
26
+ it 'returns the type' do
27
+ event.type.should == 'process_down'
28
+ end
29
+ end
30
+
31
+ end
@@ -0,0 +1,4 @@
1
+ {
2
+ "Subject": "process_down",
3
+ "Message": "{\"body\":\"Required process foo down. 1 running, 2 required.\",\"created_at\":\"2013-01-30T22:00:50Z\",\"process\":\"foo\",\"required_count\": 2,\"running_count\": 1,\"environment\":\"lc-pod-2-dev-1\",\"host\":\"host1.example.com\"}"
4
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-alert-monitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-05 00:00:00.000000000 Z
12
+ date: 2013-04-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70342338349940 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70342338349940
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rspec
27
- requirement: &70342338349440 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: 2.11.0
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *70342338349440
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 2.11.0
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: aws-sdk
38
- requirement: &70342338348420 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ~>
@@ -43,7 +53,12 @@ dependencies:
43
53
  version: 1.7.1
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *70342338348420
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.7.1
47
62
  description: I watch an SQS queue and escalate alert messages.
48
63
  email:
49
64
  - brett@weav.net
@@ -55,7 +70,7 @@ files:
55
70
  - .gitignore
56
71
  - .rvmrc
57
72
  - .travis.yml
58
- - CHANGELOG
73
+ - CHANGELOG.md
59
74
  - Gemfile
60
75
  - LICENSE.txt
61
76
  - README.md
@@ -75,6 +90,7 @@ files:
75
90
  - lib/aws-alert-monitor/events.rb
76
91
  - lib/aws-alert-monitor/events/auto_scaling_notification.rb
77
92
  - lib/aws-alert-monitor/events/cloud_watch_alarm.rb
93
+ - lib/aws-alert-monitor/events/process_down.rb
78
94
  - lib/aws-alert-monitor/events/unknown.rb
79
95
  - lib/aws-alert-monitor/logger.rb
80
96
  - lib/aws-alert-monitor/parser.rb
@@ -88,9 +104,11 @@ files:
88
104
  - spec/event_spec.rb
89
105
  - spec/events/auto_scaling_notification_spec.rb
90
106
  - spec/events/cloud_watch_alarm_spec.rb
107
+ - spec/events/process_down_spec.rb
91
108
  - spec/events/unknown_spec.rb
92
109
  - spec/fixtures/asg_instance_launch.json
93
110
  - spec/fixtures/cloud_watch_alarm.json
111
+ - spec/fixtures/process_down.json
94
112
  - spec/helpers/fixtures.rb
95
113
  - spec/parser_spec.rb
96
114
  - spec/spec_helper.rb
@@ -108,7 +126,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
108
126
  version: '0'
109
127
  segments:
110
128
  - 0
111
- hash: 2565205929421564978
129
+ hash: -3615402848926291500
112
130
  required_rubygems_version: !ruby/object:Gem::Requirement
113
131
  none: false
114
132
  requirements:
@@ -117,10 +135,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
135
  version: '0'
118
136
  segments:
119
137
  - 0
120
- hash: 2565205929421564978
138
+ hash: -3615402848926291500
121
139
  requirements: []
122
140
  rubyforge_project:
123
- rubygems_version: 1.8.16
141
+ rubygems_version: 1.8.24
124
142
  signing_key:
125
143
  specification_version: 3
126
144
  summary: I watch an SQS queue and escalate alert messages.
@@ -134,9 +152,11 @@ test_files:
134
152
  - spec/event_spec.rb
135
153
  - spec/events/auto_scaling_notification_spec.rb
136
154
  - spec/events/cloud_watch_alarm_spec.rb
155
+ - spec/events/process_down_spec.rb
137
156
  - spec/events/unknown_spec.rb
138
157
  - spec/fixtures/asg_instance_launch.json
139
158
  - spec/fixtures/cloud_watch_alarm.json
159
+ - spec/fixtures/process_down.json
140
160
  - spec/helpers/fixtures.rb
141
161
  - spec/parser_spec.rb
142
162
  - spec/spec_helper.rb