sensu-plugins-slack 1.0.0 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3f54c218e9c552fac733928646ace4874f0649a4
4
- data.tar.gz: 3a6a84804253872170a3ccf52803847164faede4
3
+ metadata.gz: 69f0b3777097fb1a163e2e5f07b1f3e91acfa5b2
4
+ data.tar.gz: fddcfcbf75a6938e24357c7fa73c3b2b8d7c0270
5
5
  SHA512:
6
- metadata.gz: 224c3535db33eaa5af3aa1658a0b486b87fe19eca70939b3e5b6566d45a77072da7e8bb793fed0fb2a4138c35d7792836f301a39028fa22f37773d0b9101abd4
7
- data.tar.gz: 3f4fb750ffc643689fb319541b031a15a3dfbe2c774dc9f0ade3fae1164a87e392ac89b237292ad28ae37bc2bfa18c5e1d43f6ca3a4d8484d27aa799c2820c86
6
+ metadata.gz: 4b9ac03a6e9e46669b0cf015f82cf2a5f4c8dbf9fa600f278205b6411c46ba79dbed45d870037fd727d19183f3262ddac47287f1f97279dc57f7d68fcdc7f2bc
7
+ data.tar.gz: dd166527f1daa5174251018b62daa97b79972c634bf525acc3fea43fd3b6b07e3697f059c1bed16f5524eab62c96062ba5f7fc26bb3f066f230c122333e6f013
data/CHANGELOG.md CHANGED
@@ -1,10 +1,19 @@
1
- #Change Log
1
+ # Change Log
2
2
  This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
4
  This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [1.1.0] - 2017-06-22
9
+ ### Added
10
+ - `slack-handler-multichannel.rb`: Add title line to mirror functionality of slack-handler.rb (@zer0nimbus)
11
+ - `handler-slack.rb`: Add a `link_names` parameter to allow for mentions (@unionsep)
12
+
13
+ ### Fixed
14
+ - Allow custom channels with custom payload (@bashtoni)
15
+ - `handler-slack.rb`: Access the event notification from the correct location (@dunpealer)
16
+
8
17
  ## [1.0.0] - 2016-06-14
9
18
  ### Added
10
19
  - Added a payload_template to allow for a customized JSON payload
@@ -65,7 +74,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
65
74
  ### Added
66
75
  - initial release
67
76
 
68
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-slack/compare/1.0.0...HEAD
77
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-slack/compare/1.1.0...HEAD
78
+ [1.1.0]: https://github.com/sensu-plugins/sensu-plugins-slack/compare/1.0.0...1.1.0
69
79
  [1.0.0]: https://github.com/sensu-plugins/sensu-plugins-slack/compare/v0.1.2...1.0.0
70
80
  [0.1.2]: https://github.com/sensu-plugins/sensu-plugins-slack/compare/0.1.1...v0.1.2
71
81
  [0.1.1]: https://github.com/sensu-plugins/sensu-plugins-slack/compare/0.1.0...0.1.1
data/README.md CHANGED
@@ -21,6 +21,7 @@
21
21
  "message_prefix": "optional prefix - can be used for mentions",
22
22
  "surround": "optional - can be used for bold(*), italics(_), code(`) and preformatted(```)",
23
23
  "bot_name": "optional bot name, defaults to slack defined",
24
+ "link_names": "optional - find and link channel names and usernames",
24
25
  "message_template": "optional description erb template file - /some/path/to/template.erb",
25
26
  "payload_template": "optional json payload template file (note: overrides most other template options.)",
26
27
  "template": "backwards-compatible alias for message_template",
@@ -53,6 +54,7 @@
53
54
  {
54
55
  "username": "sensu alarms",
55
56
  "icon_emoji": ":bell:",
57
+ "channel": channel,
56
58
  "attachments": [
57
59
  {
58
60
  "fallback": "<%= @event["check"]["output"] %>",
@@ -157,12 +157,12 @@ class Slack < Sensu::Handler
157
157
  notice = @event['notification'] || build_description
158
158
  post_data(notice, channel)
159
159
  else
160
- post_data(render_payload_template, channel)
160
+ post_data(render_payload_template(channel), channel)
161
161
  end
162
162
  end
163
163
  end
164
164
 
165
- def render_payload_template
165
+ def render_payload_template(channel)
166
166
  return unless payload_template && File.readable?(payload_template)
167
167
  template = File.read(payload_template)
168
168
  eruby = Erubis::Eruby.new(template)
@@ -230,6 +230,7 @@ class Slack < Sensu::Handler
230
230
  {
231
231
  icon_url: 'http://sensuapp.org/img/sensu_logo_large-c92d73db.png',
232
232
  attachments: [{
233
+ title: "#{@event['client']['address']} - #{translate_status}",
233
234
  text: [slack_message_prefix, notice].compact.join(' '),
234
235
  color: color
235
236
  }]
data/bin/handler-slack.rb CHANGED
@@ -54,6 +54,10 @@ class Slack < Sensu::Handler
54
54
  get_setting('surround')
55
55
  end
56
56
 
57
+ def slack_link_names
58
+ get_setting('link_names')
59
+ end
60
+
57
61
  def message_template
58
62
  get_setting('template') || get_setting('message_template')
59
63
  end
@@ -88,14 +92,14 @@ class Slack < Sensu::Handler
88
92
 
89
93
  def handle
90
94
  if payload_template.nil?
91
- description = @event['notification'] || build_description
95
+ description = @event['check']['notification'] || build_description
92
96
  post_data("#{incident_key}: #{description}")
93
97
  else
94
- post_data(render_payload_template)
98
+ post_data(render_payload_template(slack_channel))
95
99
  end
96
100
  end
97
101
 
98
- def render_payload_template
102
+ def render_payload_template(channel)
99
103
  return unless payload_template && File.readable?(payload_template)
100
104
  template = File.read(payload_template)
101
105
  eruby = Erubis::Eruby.new(template)
@@ -178,6 +182,7 @@ class Slack < Sensu::Handler
178
182
  payload[:channel] = slack_channel if slack_channel
179
183
  payload[:username] = slack_bot_name if slack_bot_name
180
184
  payload[:icon_emoji] = slack_icon_emoji if slack_icon_emoji
185
+ payload[:link_names] = slack_link_names if slack_link_names
181
186
  end
182
187
  end
183
188
 
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsSlack
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 0
4
+ MINOR = 1
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-slack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.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: 2016-06-14 00:00:00.000000000 Z
11
+ date: 2017-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: erubis
@@ -205,9 +205,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
205
  version: '0'
206
206
  requirements: []
207
207
  rubyforge_project:
208
- rubygems_version: 2.5.1
208
+ rubygems_version: 2.4.5
209
209
  signing_key:
210
210
  specification_version: 4
211
211
  summary: Sensu plugins for interfacing with Slack chat
212
212
  test_files: []
213
- has_rdoc: