Comments (9)
In slack, if I want one app(suppose it is your sensu server) send message to multiple channels, I need to generate one webhook URL for each channel. Then I need to configure all those webhooks into "webhook_urls".
I may define default channels in configuration. And it will be overriden in client or check configurations. Here is an example of slack_handler.json for multiple channel handler:
{
"handlers": {
"slack": {
"type": "pipe",
"command": "/opt/sensu/embedded/bin/handler-slack-multichannel.rb",
"filters": ["check_dependencies"],
"services": ["critical", "unknown"]
}
},
"slack": {
"template" : "",
"webhook_urls": {
"channel1": "https://hooks.slack.com/services/aaaaaaaaaa/aaaa/aaaaaaa",
"channel2": "https://hooks.slack.com/services/aaaaaaaaa/bbbb/cccccc",
"channel3": "https://hooks.slack.com/services/aaaaaaaaa/bbbb/ddddddd"
},
"channels": {
"default": ["channel1"]
}
}
}
from sensu-plugins-slack.
@maaark11 does that answer your question?
from sensu-plugins-slack.
Let me explain my use case:
Using the 1.0.0 version of the plugin I was able to override the channel when configuring the client JSON (within a standalone check). This way, I only needed to define one hook and one default channel on the server side. If I don’t define a channel in the standalone client check, the handler would use the default one.
In my experiments with the latest version, I couldn’t replicate this behavior. Was this feature removed from the plugin?
from sensu-plugins-slack.
from sensu-plugins-slack.
Most suspicious line in diff between the two versions: 1.0.0...2.0.0#diff-2e9b02e7ca696b0f2435aa02a93649ebR103
from sensu-plugins-slack.
@majormoses the link is broken
from sensu-plugins-slack.
grr github changed some stuff one sec I will get a working one...
from sensu-plugins-slack.
actually looking back that change was only for handler-slack.rb
and you are using the multi channel one.
from sensu-plugins-slack.
Sorry for the delayed response I have not had the time to circle back until now. So let me make sure I understand what you want vs what happens:
What you would like to happen
Define a default channel for the handler on the server side, another inside a check (example is standalone but realistically it applies to a subscription check as well). This should result in an alert going to both channels.
What actually happens
Define a default channel for the handler on the server side and a different in a check. This should result in sending to only the one defined in the check.
Thoughts
Assuming what I have above is correct I think I see where this behavior changed. This was intentional and I believe I missed your intended use case while reviewing. The change happened here: #45. I am conflicted on what we should do here. On the one hand I do think that in some scenarios it might be desirable to say this default channel must fire every time while you can additionally add channels. On the other hand I think that a default is just that a default meant to be overwritten. This follows the same pattern as sensu redaction as well as the pagerduty handler for teams/services. We could add new configuration options to allow finer control of the behavior. For example instead of having just channels
we could have:
default_channels
: I don't think this is required and I think this can just be a fallback forchannels
, that being said this prevents a breaking change (although technically it would be on a regression)required_channels
: This would always ensure that these channels are sent to as well as(channel|default_channel)
channels
: could either be defined in check or pulls default from handler config otherwise, like the default above it technically would break backwards compatibility on a regression.
These are just a few thoughts, open to suggestions. @eheydrick thoughts?
from sensu-plugins-slack.
Related Issues (20)
- Any chance to port to sensu-go HOT 6
- the plugin ignores HTTP status code
- Can't get working handler HOT 3
- Error SSL, dont work HOT 4
- Problem with "127" (Unknown) exit codes HOT 3
- More then one Slack team does not function properly HOT 1
- Issues with slack multichannel handler HOT 1
- http:// and missing images HOT 5
- icon_emoji attribute not supported by multichannel plugin HOT 2
- slack message_template HOT 3
- Define channel on check. HOT 2
- Add playbook/runbook link to aid operations in resolution of alerts HOT 1
- Event filtering in sensu-plugin is deprecated causing the handler not to always work HOT 14
- Omit field if missing from event HOT 3
- Update sensu-plugin dep to 2.7 to pick up new Sensu 2 event data mapping HOT 1
- message_template ignored if check has a notification HOT 1
- Slack forces SSL/TLS for all endpoints, even http HOT 1
- Adding payload_template stops messages sending to Slack HOT 2
- Correction in payload_template example in readme
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sensu-plugins-slack.