sensu-plugins-slack 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5579a23a8858bc8529d481ed4a02ea25f2102c77
4
- data.tar.gz: 7dd114c35c39b4aa2ce84d9cac6a8a8f3b0b1b56
3
+ metadata.gz: 0898d7f8bf6098fa616bc6cca6c84767b2b7c396
4
+ data.tar.gz: 0c4b6d37a6e734c558fbb6d221de05184a708cac
5
5
  SHA512:
6
- metadata.gz: 1cf0939e2b68fb1db386ffe53d89259694c471e8553f804fd7782b6ce0eaaa0297a1d4e83b0729048cecec027ba4f5b4702b130a9e8d1070f26ad85af1953c48
7
- data.tar.gz: a70ba0e606b325f8b093db76319902b66ee6a5390ee3233e4ad6a8d8b5c24934fe509a98de74b69191ffbf1537282dec33defb3ff0c5511e7de4968d22bdb7bf
6
+ metadata.gz: 36d283b289b924ce4c22c1e722e3df728eadc23de79f478867579da11b196c3f2ee883a40e7ad73f35c72b70465b276f285b03f928c37b6a46793b1901ad365e
7
+ data.tar.gz: c054fe9cae7cc838032fb13ec3736829d9a6e863bb3c885a7f8813ccaddd5d2c6ddd1d80095cc09d222878c5b7400c63e9195c26d6486d03d8e2626ebe3425b4
data/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [1.4.0] - 2017-07-24
9
+ ### Added
10
+ - `slack-handler-multichannel.rb`: Added support for client-defined channel overrides (@fildred13)
11
+
8
12
  ## [1.3.0] - 2017-07-19
9
13
  ### Added
10
14
  - `slack-handler-multichannel.rb`: Added support for `icon_emoji` option, which documentation already suggested was supported (@fildred13)
@@ -16,30 +16,45 @@
16
16
  #
17
17
  # Default channels and compulsory channels can be set in the handler config:
18
18
  #
19
- # { "handlers":
19
+ # { "handlers": {
20
20
  # "slack": {
21
21
  # "channels" {
22
22
  # "default": [ "#no-team-alerts" ],
23
23
  # "compulsory": [ "#all-alerts" ],
24
24
  # }
25
- # }
25
+ # },
26
+ # ...,
27
+ # }
26
28
  # }
27
29
  #
28
30
  # Alerts are always sent to the compulsory channel(s).
29
31
  #
30
32
  # Alerts are sent to default channels if no channels are configured
31
- # in the check config.
33
+ # in the client config or check config.
34
+ #
35
+ # If channels are defined on the client, they will override the defaults:
36
+ #
37
+ # { "client":{
38
+ # "name": "Appserver"
39
+ # "slack" {
40
+ # "channels" [ "#appserver-team-alerts" ]
41
+ # },
42
+ # ...,
43
+ # }
44
+ # }
32
45
  #
33
- # Check specific channels:
46
+ # If channels are defined on a check, they will override anything defined on
47
+ # the client or the defaults:
34
48
  #
35
- # { "checks":
49
+ # { "checks": {
36
50
  # "check_my_db": {
37
51
  # "handlers": [ "default", "slack" ],
38
52
  # "slack" {
39
53
  # "channels" [ "#db-team-alerts" ]
40
- # }
54
+ # },
41
55
  # ...,
42
56
  # }
57
+ # }
43
58
  # }
44
59
  #
45
60
  # Custom Field support added:
@@ -132,6 +147,12 @@ class Slack < Sensu::Handler
132
147
  return false
133
148
  end
134
149
 
150
+ def client_configured_channels
151
+ return @event['client']['slack']['channels']
152
+ rescue
153
+ return false
154
+ end
155
+
135
156
  def custom_field
136
157
  get_setting('custom_field')
137
158
  end
@@ -142,6 +163,9 @@ class Slack < Sensu::Handler
142
163
  if check_configured_channels
143
164
  channels = check_configured_channels
144
165
  puts "using check configured channels: #{channels.join('.').chomp(',')}"
166
+ elsif client_configured_channels
167
+ channels = client_configured_channels
168
+ puts "using client configured channels: #{channels.join('.').chomp(',')}"
145
169
  else
146
170
  channels = default_channels
147
171
  puts "using check default channels: #{default_channels.join(',').chomp(',')}"
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsSlack
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 3
4
+ MINOR = 4
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.3.0
4
+ version: 1.4.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-07-20 00:00:00.000000000 Z
11
+ date: 2017-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: erubis