sensu-plugins-mailer 0.1.5 → 0.2.0
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.
- checksums.yaml +8 -8
- data/CHANGELOG.md +10 -3
- data/README.md +0 -1
- data/bin/handler-mailer-mailgun.rb +11 -2
- data/bin/handler-mailer-ses.rb +11 -2
- data/bin/handler-mailer.rb +19 -3
- data/lib/sensu-plugins-mailer/version.rb +2 -2
- metadata +3 -34
- checksums.yaml.gz.sig +0 -1
- data.tar.gz.sig +0 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MGYwZGU2YjMyODY1MTE5M2NmZTk0YWVmMTRjMmUwMTQyMGYwODU1Mg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YmE4NjllY2RkNDYyOTczOGJjNzc5NGIxZTY1ZWYxZWE1NGE0OWI4YQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjFiYThkNTQxOTU5NzI1MjRiYzYwOGEzOTY0Yjg1NjRhZjBkN2Y0M2JiZDQw
|
10
|
+
NTgzYmI0ZWYzYmFhMWQzNDBiZWNiN2E1MGIxZTA5YzVkM2Y5ZTc5Y2EzYzhj
|
11
|
+
MmJlMGU2Y2FmZDg4ODBjOTM3YTZlYTI1MzhjOTc1OGIzZWYyYWU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDk0N2QxZTM4NTc0NDdmOTVmM2M1M2FjZTYwNDliZmI0MDg2YjA2M2M2MmNl
|
14
|
+
M2MzYzQ4NWY3ZjA4ZmM0Yjk3NWFhMDEyMjUzZjdiZjUwZTBkZjhjYjg1YTcw
|
15
|
+
NzhjZDcyZDZhYjNlNDExNTZmMGFlZmVhZTg1OWNiNGM3MTYwYjY=
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,13 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [0.2.0] - 2016-03-17
|
9
|
+
### Added
|
10
|
+
- Support for prefixing the email subject
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
- handler-mailer.rb: Fix content type selection
|
14
|
+
|
8
15
|
## [0.1.5] - 2016-02-04
|
9
16
|
### Added
|
10
17
|
- new certs
|
@@ -44,12 +51,12 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
44
51
|
- puts deps in alpha order in the gemspec and rakefile
|
45
52
|
|
46
53
|
## 0.0.1 - 2015-06-04
|
47
|
-
|
48
54
|
### Added
|
49
55
|
- initial release
|
50
56
|
|
51
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-mailer/compare/0.
|
52
|
-
[0.
|
57
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-mailer/compare/0.2.0...HEAD
|
58
|
+
[0.2.0]: https://github.com/sensu-plugins/sensu-plugins-mailer/compare/v0.1.5...0.2.0
|
59
|
+
[0.1.5]: https://github.com/sensu-plugins/sensu-plugins-mailer/compare/0.1.4...v0.1.5
|
53
60
|
[0.1.4]: https://github.com/sensu-plugins/sensu-plugins-mailer/compare/0.1.3...0.1.4
|
54
61
|
[0.1.3]: https://github.com/sensu-plugins/sensu-plugins-mailer/compare/0.1.2...0.1.3
|
55
62
|
[0.1.2]: https://github.com/sensu-plugins/sensu-plugins-mailer/compare/0.1.1...0.1.2
|
data/README.md
CHANGED
@@ -5,7 +5,6 @@
|
|
5
5
|
[](https://codeclimate.com/github/sensu-plugins/sensu-plugins-mailer)
|
6
6
|
[](https://codeclimate.com/github/sensu-plugins/sensu-plugins-mailer)
|
7
7
|
[](https://gemnasium.com/sensu-plugins/sensu-plugins-mailer)
|
8
|
-
[](https://codeship.com/projects/83060)
|
9
8
|
|
10
9
|
## Functionality
|
11
10
|
|
@@ -41,12 +41,21 @@ class Mailer < Sensu::Handler
|
|
41
41
|
@event['action'].eql?('resolve') ? 'RESOLVED' : 'ALERT'
|
42
42
|
end
|
43
43
|
|
44
|
+
def prefix_subject
|
45
|
+
if params[:subject_prefix]
|
46
|
+
params[:subject_prefix] + ' '
|
47
|
+
else
|
48
|
+
''
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
44
52
|
def handle
|
45
53
|
params = {
|
46
54
|
mail_to: settings['mailer-mailgun']['mail_to'],
|
47
55
|
mail_from: settings['mailer-mailgun']['mail_from'],
|
48
56
|
mg_apikey: settings['mailer-mailgun']['mg_apikey'],
|
49
|
-
mg_domain: settings['mailer-mailgun']['mg_domain']
|
57
|
+
mg_domain: settings['mailer-mailgun']['mg_domain'],
|
58
|
+
subject_prefix: settings['mailer-mailgun']['subject_prefix']
|
50
59
|
}
|
51
60
|
|
52
61
|
body = <<-BODY.gsub(/^ {14}/, '')
|
@@ -59,7 +68,7 @@ class Mailer < Sensu::Handler
|
|
59
68
|
Status: #{@event['check']['status']}
|
60
69
|
Occurrences: #{@event['occurrences']}
|
61
70
|
BODY
|
62
|
-
subject = "#{action_to_string} - #{short_name}: #{@event['check']['notification']}"
|
71
|
+
subject = "#{prefix_subject}#{action_to_string} - #{short_name}: #{@event['check']['notification']}"
|
63
72
|
|
64
73
|
mg_client = Mailgun::Client.new params[:mg_apikey]
|
65
74
|
|
data/bin/handler-mailer-ses.rb
CHANGED
@@ -24,13 +24,22 @@ class Mailer < Sensu::Handler
|
|
24
24
|
@event['action'].eql?('resolve') ? 'RESOLVED' : 'ALERT'
|
25
25
|
end
|
26
26
|
|
27
|
+
def prefix_subject
|
28
|
+
if params[:subject_prefix]
|
29
|
+
params[:subject_prefix] + ' '
|
30
|
+
else
|
31
|
+
''
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
27
35
|
def handle
|
28
36
|
params = {
|
29
37
|
mail_to: settings['mailer-ses']['mail_to'],
|
30
38
|
mail_from: settings['mailer-ses']['mail_from'],
|
31
39
|
aws_access_key: settings['mailer-ses']['aws_access_key'],
|
32
40
|
aws_secret_key: settings['mailer-ses']['aws_secret_key'],
|
33
|
-
aws_ses_endpoint: settings['mailer-ses']['aws_ses_endpoint']
|
41
|
+
aws_ses_endpoint: settings['mailer-ses']['aws_ses_endpoint'],
|
42
|
+
subject_prefix: settings['mailer-ses']['subject_prefix']
|
34
43
|
}
|
35
44
|
|
36
45
|
body = <<-BODY.gsub(/^ {14}/, '')
|
@@ -43,7 +52,7 @@ class Mailer < Sensu::Handler
|
|
43
52
|
Status: #{@event['check']['status']}
|
44
53
|
Occurrences: #{@event['occurrences']}
|
45
54
|
BODY
|
46
|
-
subject = "#{action_to_string} - #{short_name}: #{@event['check']['notification']}"
|
55
|
+
subject = "#{prefix_subject}#{action_to_string} - #{short_name}: #{@event['check']['notification']}"
|
47
56
|
|
48
57
|
ses = AWS::SES::Base.new(
|
49
58
|
access_key_id: params[:aws_access_key],
|
data/bin/handler-mailer.rb
CHANGED
@@ -52,6 +52,12 @@ class Mailer < Sensu::Handler
|
|
52
52
|
long: '--content_type ContentType',
|
53
53
|
required: false
|
54
54
|
|
55
|
+
option :subject_prefix,
|
56
|
+
description: 'Prefix message subjects with this string',
|
57
|
+
short: '-s prefix',
|
58
|
+
long: '--subject_prefix prefix',
|
59
|
+
required: false
|
60
|
+
|
55
61
|
def short_name
|
56
62
|
@event['client']['name'] + '/' + @event['check']['name']
|
57
63
|
end
|
@@ -60,6 +66,16 @@ class Mailer < Sensu::Handler
|
|
60
66
|
@event['action'].eql?('resolve') ? 'RESOLVED' : 'ALERT'
|
61
67
|
end
|
62
68
|
|
69
|
+
def prefix_subject
|
70
|
+
if config[:subject_prefix]
|
71
|
+
config[:subject_prefix] + ' '
|
72
|
+
elsif settings[config[:json_config]]['subject_prefix']
|
73
|
+
settings[config[:json_config]]['subject_prefix'] + ' '
|
74
|
+
else
|
75
|
+
''
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
63
79
|
def status_to_string
|
64
80
|
case @event['check']['status']
|
65
81
|
when 0
|
@@ -84,7 +100,7 @@ class Mailer < Sensu::Handler
|
|
84
100
|
'plain'
|
85
101
|
end
|
86
102
|
|
87
|
-
if use.casecmp('html')
|
103
|
+
if use.casecmp('html') == 0
|
88
104
|
'text/html; charset=UTF-8'
|
89
105
|
else
|
90
106
|
'text/plain; charset=ISO-8859-1'
|
@@ -169,9 +185,9 @@ class Mailer < Sensu::Handler
|
|
169
185
|
}
|
170
186
|
|
171
187
|
subject = if @event['check']['notification'].nil?
|
172
|
-
"#{action_to_string} - #{short_name}: #{status_to_string}"
|
188
|
+
"#{prefix_subject}#{action_to_string} - #{short_name}: #{status_to_string}"
|
173
189
|
else
|
174
|
-
"#{action_to_string} - #{short_name}: #{@event['check']['notification']}"
|
190
|
+
"#{prefix_subject}#{action_to_string} - #{short_name}: #{@event['check']['notification']}"
|
175
191
|
end
|
176
192
|
|
177
193
|
Mail.defaults do
|
metadata
CHANGED
@@ -1,45 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-mailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sensu-Plugins and contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
-
|
12
|
-
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURuakNDQW9hZ0F3SUJB
|
13
|
-
Z0lCQVRBTkJna3Foa2lHOXcwQkFRVUZBREJLTVJVd0V3WURWUVFEREF4elpX
|
14
|
-
NXoKZFMxd2JIVm5hVzR4SFRBYkJnb0praWFKay9Jc1pBRVpGZzF6Wlc1emRT
|
15
|
-
MXdiSFZuYVc1ek1SSXdFQVlLQ1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ZFMxd2JIVm5hVzV6TG1s
|
31
|
-
dk1DZ0dBMVVkRWdRaE1CK0IKSFhObGJuTjFMWEJzZFdkcGJrQnpaVzV6ZFMx
|
32
|
-
d2JIVm5hVzV6TG1sdk1BMEdDU3FHU0liM0RRRUJCUVVBQTRJQgpBUUNQZTZ0
|
33
|
-
RUJ0NS9uQzk1aFhvS2VLRmhrWVc5bTE2aU5YdWRKeEorZGRYcnpDc2tEMXk2
|
34
|
-
ajZjQXY0a1FlUDFmClBIbDE4aDVrOWtKeElQU1IrcUkrK2JJbDE3ZUVPU096
|
35
|
-
YXNMbXdzdGFNU25NN3U1UWZMcFdFWTJldVZXQkRzdGQKMmhrcG80VSswSzVT
|
36
|
-
d3ptZEphMFdLQXRmS3ZkdENROGk5MllJUCtIODNFdXZDU0xwZ29aaDYzRXJx
|
37
|
-
dVFVY25lbgphZmg1bHVUQkExaTFjcUJHNEFNSjBmTFdHeU9xSmFYOFA5WnN4
|
38
|
-
RERXUEVCbk5TaVd2WGIrSUttSkFWTzF1VzRrClFOODNielZXU1d1bFk4Qlk2
|
39
|
-
a1grSVFNd1lhelpBbEIvMTNkN2E4VTBoN0NyYjM2Sm5TUGF0aHVSemU0cUtY
|
40
|
-
RlEKM2YzVFVaV3d2UmZ0Y1N1K3Z0Y0JSa00wCi0tLS0tRU5EIENFUlRJRklD
|
41
|
-
QVRFLS0tLS0K
|
42
|
-
date: 2016-02-05 00:00:00.000000000 Z
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-17 00:00:00.000000000 Z
|
43
12
|
dependencies:
|
44
13
|
- !ruby/object:Gem::Dependency
|
45
14
|
name: aws
|
checksums.yaml.gz.sig
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
!Z�,)������Do�n���[��?�
|
data.tar.gz.sig
DELETED
metadata.gz.sig
DELETED
Binary file
|