sensu-plugins / sensu-plugins-mailer

This plugin is an email handler for Sensu.
http://sensu-plugins.io
MIT License
17 stars 37 forks source link

It would be great to pass a To: argument in the handler rather than specifying it in the config #23

Closed AirCombat closed 5 years ago

AirCombat commented 8 years ago

It would be great to pass a To: argument in the handler or define To in the handler config rather than specifying it in the plugins json config.

That way I could email different distribution groups / addresses for different checks.

gchukfeh commented 8 years ago

Hi there, I'm also trying to send alerts to different groups for different checks. This is a great and very useful feature, please look into adding it. Essentially, the contact routing feature from Sensu Enterprise is what I'm looking for: https://sensuapp.org/docs/0.24/enterprise/contact-routing.html

stevenviola commented 7 years ago

I've created a pull request to be able to add contacts for particular checks, which is especially useful for standalone checks which don't have a subscription to send e-mails to. This mimics the Sensu Enterprise contact routing configuration, while keeping the existing functionality in the handler as well.

Hopefully we can get this into the mailer handler since it's something we're all looking for.

majormoses commented 7 years ago

@stevenviola that has been merged and released but it looks like it's ported as being buggy in #55 any chance you can take a look since you are probably more familiar with this code than I am. When I have some more time I will try to triage it as well.

codepattern commented 6 years ago

Hi Team, just trying to get an understanding a bit more on this plugin. Is it possible to pass a To: argument / email in the check result rather than specifying it in the server side config? All of these configurations seem to suggest that they need to pre-defined in the mailer config or contact routing.

stevenviola commented 6 years ago

@codepattern the contact routing in this plugin works the same way as contact routing does in the Enterprise version, and requires the e-mail addresses to be listed in the config on the sensu-server.

Quickly looking over the plugin, if you don't want to specify the e-mail address on the sensu-server at all, I think your only option is to add a mail_to parameter to your client config, and specify the e-mail address there. This would then apply to all checks on that client. There doesn't look like a way to have a mail_to on a per check basis.

majormoses commented 6 years ago

We could add support to have mail_to come from check -> client -> server in that order and is a pretty common pattern that handlers follow. I'd be 👍 to reviewing a PR that does that.