Giter VIP home page Giter VIP logo

Comments (9)

autumnw avatar autumnw commented on June 29, 2024 1

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.

majormoses avatar majormoses commented on June 29, 2024

@maaark11 does that answer your question?

from sensu-plugins-slack.

maaark11 avatar maaark11 commented on June 29, 2024

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.

autumnw avatar autumnw commented on June 29, 2024

from sensu-plugins-slack.

majormoses avatar majormoses commented on June 29, 2024

Most suspicious line in diff between the two versions: 1.0.0...2.0.0#diff-2e9b02e7ca696b0f2435aa02a93649ebR103

from sensu-plugins-slack.

maaark11 avatar maaark11 commented on June 29, 2024

@majormoses the link is broken

from sensu-plugins-slack.

majormoses avatar majormoses commented on June 29, 2024

grr github changed some stuff one sec I will get a working one...

from sensu-plugins-slack.

majormoses avatar majormoses commented on June 29, 2024

actually looking back that change was only for handler-slack.rb and you are using the multi channel one.

from sensu-plugins-slack.

majormoses avatar majormoses commented on June 29, 2024

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 for channels, 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.