sensu-plugins-mailer 1.1.0 → 1.2.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 +7 -1
- data/README.md +34 -0
- data/bin/handler-mailer.rb +16 -0
- data/lib/sensu-plugins-mailer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9aa2a9997cccbcdd4266654fbd3882bd2002678
|
4
|
+
data.tar.gz: 35e033dc524dfebf003249436810f67a4a0c4c27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3369051b649641a7cf308f683847b14928f07a570980a301ad7c06e6094ede2ef4ff63074e721ef970611c2d4b79c23a48c5d3536c43064e7fbe7288005e761
|
7
|
+
data.tar.gz: 80574d190775484e384e342923eb97bc2b8d3632744890f58991aef3edff573aa852efb6c87882cecbc152670440f9aca4153a7fefcc334a528c96a9c2eccc1f
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
4
4
|
This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
|
+
|
8
|
+
## [1.2.0] - 2017-06-24
|
9
|
+
### Added
|
10
|
+
- handler-mailer.rb: add contact routing like Sensu Enterprise works (@stevenviola)
|
11
|
+
|
7
12
|
## [1.1.0] - 2017-06-01
|
8
13
|
### Fixed
|
9
14
|
- handler-mailer.rb - revert the commit which makes email go to wrong addresses
|
@@ -84,7 +89,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
84
89
|
### Added
|
85
90
|
- initial release
|
86
91
|
|
87
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-mailer/compare/1.
|
92
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-mailer/compare/1.2.0...HEAD
|
93
|
+
[1.2.0]: https://github.com/sensu-plugins/sensu-plugins-mailer/compare/1.1.0...1.2.0
|
88
94
|
[1.1.0]: https://github.com/sensu-plugins/sensu-plugins-mailer/compare/1.0.0...1.1.0
|
89
95
|
[1.0.0]: https://github.com/sensu-plugins/sensu-plugins-mailer/compare/0.3.1...1.0.0
|
90
96
|
[0.3.1]: https://github.com/sensu-plugins/sensu-plugins-mailer/compare/0.3.0...0.3.1
|
data/README.md
CHANGED
@@ -85,6 +85,40 @@ client config called "template", the mailer handler config, default.
|
|
85
85
|
```
|
86
86
|
By default, the handler will use `plain` as the SMTP authentication type, but you may also specify `"smtp_authentication": "ntlm"` for compatible servers, e.g. Microsoft Exchange.
|
87
87
|
|
88
|
+
### Contact Based Routing
|
89
|
+
|
90
|
+
Optionally, this handler can use the same syntax as [Sensu Enterprise contact routing](https://sensuapp.org/docs/0.26/enterprise/contact-routing.html) for sending e-mails for particular checks or clients, in addition to the previous configuration. This is configured by declaring contacts:
|
91
|
+
|
92
|
+
**support.json**
|
93
|
+
```
|
94
|
+
{
|
95
|
+
"contacts": {
|
96
|
+
"support": {
|
97
|
+
"email": {
|
98
|
+
"to": "support@sensuapp.com"
|
99
|
+
}
|
100
|
+
}
|
101
|
+
}
|
102
|
+
}
|
103
|
+
```
|
104
|
+
|
105
|
+
Then, in a check definition, you can specify a contact or an array of contacts which should be notified by e-mail:
|
106
|
+
|
107
|
+
**example_check.json**
|
108
|
+
```
|
109
|
+
{
|
110
|
+
"checks": {
|
111
|
+
"example_check": {
|
112
|
+
"command": "do_something.rb",
|
113
|
+
"handler": "mailer",
|
114
|
+
"contact": "support"
|
115
|
+
}
|
116
|
+
}
|
117
|
+
}
|
118
|
+
```
|
119
|
+
|
120
|
+
Additionally, a client definition can specify a contact or an array of contacts to be notified of any check which alerts to the mailer handler. This is configured by specifying a contact value, or contacts array in the client.json configuration.
|
121
|
+
|
88
122
|
## Installation
|
89
123
|
|
90
124
|
[Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
|
data/bin/handler-mailer.rb
CHANGED
@@ -145,6 +145,22 @@ class Mailer < Sensu::Handler
|
|
145
145
|
end
|
146
146
|
end
|
147
147
|
end
|
148
|
+
if settings.key?('contacts')
|
149
|
+
all_contacts = []
|
150
|
+
%w(check client).each do |field|
|
151
|
+
if @event[field].key?('contact')
|
152
|
+
all_contacts << @event[field]['contact']
|
153
|
+
end
|
154
|
+
if @event[field].key?('contacts')
|
155
|
+
all_contacts += @event[field]['contacts']
|
156
|
+
end
|
157
|
+
end
|
158
|
+
all_contacts.each do |sub|
|
159
|
+
if settings['contacts'].key?(sub)
|
160
|
+
mail_to.add(settings['contacts'][sub]['email']['to'].to_s)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
148
164
|
mail_to.to_a.join(', ')
|
149
165
|
end
|
150
166
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-mailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.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-06-
|
11
|
+
date: 2017-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-ses
|