sensu-plugins-aws 9.0.1 → 10.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/README.md +32 -6
- data/bin/handler-ses.rb +18 -27
- data/bin/handler-sns.rb +12 -33
- data/lib/sensu-plugins-aws/version.rb +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00a5f6aca217d3a130aea8c8d73dde6db86bd936
|
4
|
+
data.tar.gz: 9e22380ee25815367496409e313fa851e398ca74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4591894d2d5eff391c32379d82e9c23cc89acdee4f9bc61ae4829bb13450dd4e131cbfaad7f3cfc6cf09c15cd84b68a5f80a1fd3df9802543c934429736b889e
|
7
|
+
data.tar.gz: d8b4af39056d5e11140b46739a0a6d21adf9a866b99c697d943e33a7c43e225ff129319d69db80be00d00a69eea8081f78babf24a6bdcc40bcafd2933ee4fcf8
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,13 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [10.0.0] - 2017-10-24
|
9
|
+
### Breaking Changes
|
10
|
+
- handler-ses.rb, handler-sns.rb: Update to AWS-SDK v2. With the update to AWS-SDK v2 these handlers no longer take `access_key`, `secret_key`, or `use_ami_role` settings. Authentication should be configured per [here](https://github.com/sensu-plugins/sensu-plugins-aws/blob/master/README.md#authentication). (@eheydrick)
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
- Update to `aws-sdk` 2.10 (@eheydrick)
|
14
|
+
|
8
15
|
## [9.0.1] - 2017-10-17
|
9
16
|
### Fixed
|
10
17
|
- metrics-billing.rb: replace `-s` with `-S` for services definition to prevent conflict with scheme option (@boutetnico)
|
@@ -387,7 +394,8 @@ WARNING: This release contains major breaking changes that will impact all user
|
|
387
394
|
### Added
|
388
395
|
- initial release
|
389
396
|
|
390
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/
|
397
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/10.0.0...HEAD
|
398
|
+
[10.0.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/9.0.1...10.0.0
|
391
399
|
[9.0.1]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/9.0.0...9.0.1
|
392
400
|
[9.0.0]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/8.3.1...9.0.0
|
393
401
|
[8.3.1]: https://github.com/sensu-plugins/sensu-plugins-aws/compare/8.3.0...8.3.1
|
data/README.md
CHANGED
@@ -219,14 +219,25 @@
|
|
219
219
|
## Usage
|
220
220
|
|
221
221
|
**handler-ses**
|
222
|
+
|
223
|
+
1. Configure [authentication](#authentication)
|
224
|
+
2. Enable the handler in `/etc/sensu/conf.d/handlers/ses.json`:
|
225
|
+
```
|
226
|
+
{
|
227
|
+
"handlers": {
|
228
|
+
"ses": {
|
229
|
+
"type": "pipe",
|
230
|
+
"command": "handler-ses.rb"
|
231
|
+
}
|
232
|
+
}
|
233
|
+
}
|
234
|
+
```
|
235
|
+
3. Configure the handler in `/etc/sensu/conf.d/ses.json`:
|
222
236
|
```
|
223
237
|
{
|
224
238
|
"ses": {
|
225
239
|
"mail_from": "sensu@example.com",
|
226
240
|
"mail_to": "monitor@example.com",
|
227
|
-
"use_ami_role": true,
|
228
|
-
"access_key": "myaccesskey",
|
229
|
-
"secret_key": "mysecretkey",
|
230
241
|
"region": "us-east-1",
|
231
242
|
"subscriptions": {
|
232
243
|
"subscription_name": {
|
@@ -238,13 +249,28 @@
|
|
238
249
|
```
|
239
250
|
|
240
251
|
**handler-sns**
|
252
|
+
|
253
|
+
`handler-sns` can be used to send alerts to Email, HTTP endpoints, SMS, or any other [subscription type](http://docs.aws.amazon.com/sns/latest/dg/welcome.html) supported by SNS.
|
254
|
+
|
255
|
+
1. Create an SNS topic and subscription [[Docs]](http://docs.aws.amazon.com/sns/latest/dg/GettingStarted.html)
|
256
|
+
1. Configure [authentication](#authentication)
|
257
|
+
2. Enable the handler in `/etc/sensu/conf.d/handlers/sns.json`:
|
258
|
+
```
|
259
|
+
{
|
260
|
+
"handlers": {
|
261
|
+
"sns": {
|
262
|
+
"type": "pipe",
|
263
|
+
"command": "handler-sns.rb"
|
264
|
+
}
|
265
|
+
}
|
266
|
+
}
|
267
|
+
```
|
268
|
+
3. Configure the handler in `/etc/sensu/conf.d/sns.json`:
|
241
269
|
```
|
242
270
|
{
|
243
271
|
"sns": {
|
244
272
|
"topic_arn": "arn:aws:sns:us-east-1:111111111111:topic",
|
245
|
-
"
|
246
|
-
"access_key": "MY_KEY",
|
247
|
-
"secret_key": "MY_secret"
|
273
|
+
"region": "us-east-1"
|
248
274
|
}
|
249
275
|
}
|
250
276
|
```
|
data/bin/handler-ses.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
# for details.
|
12
12
|
|
13
13
|
require 'sensu-handler'
|
14
|
-
require 'aws-sdk
|
14
|
+
require 'aws-sdk'
|
15
15
|
|
16
16
|
class SESNotifier < Sensu::Handler
|
17
17
|
def event_name
|
@@ -52,19 +52,6 @@ class SESNotifier < Sensu::Handler
|
|
52
52
|
mail_to
|
53
53
|
end
|
54
54
|
|
55
|
-
def use_ami_role
|
56
|
-
use_ami_role = settings['ses']['use_ami_role']
|
57
|
-
use_ami_role.nil? ? true : use_ami_role
|
58
|
-
end
|
59
|
-
|
60
|
-
def aws_access_key
|
61
|
-
settings['ses']['access_key'] || ''
|
62
|
-
end
|
63
|
-
|
64
|
-
def aws_access_secret
|
65
|
-
settings['ses']['secret_key'] || ''
|
66
|
-
end
|
67
|
-
|
68
55
|
def region
|
69
56
|
settings['ses']['region'] || 'us-east-1'
|
70
57
|
end
|
@@ -88,23 +75,27 @@ class SESNotifier < Sensu::Handler
|
|
88
75
|
"#{action_to_string} - #{event_name}: #{@event['check']['notification']}"
|
89
76
|
end
|
90
77
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
78
|
+
message = {
|
79
|
+
subject: {
|
80
|
+
data: subject
|
81
|
+
},
|
82
|
+
body: {
|
83
|
+
text: {
|
84
|
+
data: body
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
98
88
|
|
99
|
-
ses =
|
89
|
+
ses = Aws::SES::Client.new(region: region)
|
100
90
|
|
101
91
|
begin
|
102
|
-
timeout
|
92
|
+
Timeout.timeout(10) do
|
103
93
|
ses.send_email(
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
94
|
+
source: mail_from,
|
95
|
+
destination: {
|
96
|
+
to_addresses: mail_to.split(',')
|
97
|
+
},
|
98
|
+
message: message
|
108
99
|
)
|
109
100
|
|
110
101
|
puts 'mail -- sent alert for ' + event_name + ' to ' + mail_to.to_s
|
data/bin/handler-sns.rb
CHANGED
@@ -1,20 +1,16 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
|
-
#
|
4
|
-
# that has permission to send to the sns topic specified in the config.
|
5
|
-
# This removes the requirement to specify an access key and secret access key.
|
6
|
-
# See http://docs.aws.amazon.com/IAM/latest/UserGuide/WorkingWithRoles.html
|
3
|
+
# Send notifications to an SNS topic
|
7
4
|
#
|
8
5
|
# Requires the aws-sdk gem.
|
9
6
|
#
|
10
|
-
#
|
11
|
-
# topic_are : The arn for the destination sns topic
|
7
|
+
# See README for usage information
|
12
8
|
#
|
13
9
|
# Released under the same terms as Sensu (the MIT license); see LICENSE
|
14
10
|
# for details
|
15
11
|
|
16
12
|
require 'sensu-handler'
|
17
|
-
require 'aws-sdk
|
13
|
+
require 'aws-sdk'
|
18
14
|
require 'erubis'
|
19
15
|
|
20
16
|
class SnsNotifier < Sensu::Handler
|
@@ -30,19 +26,6 @@ class SnsNotifier < Sensu::Handler
|
|
30
26
|
"#{@event['client']['name']}/#{@event['check']['name']}"
|
31
27
|
end
|
32
28
|
|
33
|
-
def use_ami_role
|
34
|
-
use_ami_role = settings['sns']['use_ami_role']
|
35
|
-
use_ami_role.nil? ? true : use_ami_role
|
36
|
-
end
|
37
|
-
|
38
|
-
def aws_access_key
|
39
|
-
settings['sns']['access_key'] || ''
|
40
|
-
end
|
41
|
-
|
42
|
-
def aws_access_secret
|
43
|
-
settings['sns']['secret_key'] || ''
|
44
|
-
end
|
45
|
-
|
46
29
|
def message
|
47
30
|
template = if template_file && File.readable?(template_file)
|
48
31
|
File.read(template_file)
|
@@ -60,25 +43,21 @@ class SnsNotifier < Sensu::Handler
|
|
60
43
|
end
|
61
44
|
|
62
45
|
def handle
|
63
|
-
|
64
|
-
AWS.config(region: region)
|
65
|
-
else
|
66
|
-
AWS.config(access_key_id: aws_access_key,
|
67
|
-
secret_access_key: aws_access_secret,
|
68
|
-
region: region)
|
69
|
-
end
|
70
|
-
|
71
|
-
sns = AWS::SNS.new
|
72
|
-
|
73
|
-
t = sns.topics[topic_arn]
|
46
|
+
sns = Aws::SNS::Client.new(region: region)
|
74
47
|
|
75
48
|
subject = if @event['action'].eql?('resolve')
|
76
49
|
"RESOLVED - [#{event_name}]"
|
77
50
|
else
|
78
51
|
"ALERT - [#{event_name}]"
|
79
52
|
end
|
80
|
-
|
81
|
-
|
53
|
+
|
54
|
+
options = {
|
55
|
+
subject: subject,
|
56
|
+
message: "#{subject} - #{message}",
|
57
|
+
topic_arn: topic_arn
|
58
|
+
}
|
59
|
+
|
60
|
+
sns.publish(options)
|
82
61
|
rescue => e
|
83
62
|
puts "Exception occured in SnsNotifier: #{e.message}", e.backtrace
|
84
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-aws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 10.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sensu-Plugins and contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.10'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.10'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: aws-sdk-v1
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|