sensu/sensu-community-plugins — pull request #545 by zarry (2014-04-09 20:12:55+00:00)
Title: updates to mailer.rb to support subscription based mail_to addresses

To begin, this change is a complete no-op in terms of prior behavior. It adds some new functionality to the mailer.rb plugin but without making additional changes to your mailer.json it behaves exactly the same as the original mailer.rb.

The added functionality allows a user to define mail_to properties for a given subscription. When the mailer handler runs it will check a clients subscriptions and append the corresponding mail_to addresses if they are found.

An example use case for this is teams sharing a sensu server. They can reuse a check that you may want to be global but only email the necessary parties based on the clients subscription. Some checks like cpu and ram can be quite global across many of your machines, but those clients may be owned by different teams and require separate alerts. Prior to this you would set up a check for each team as you needed to control the mail_to address. This change solves that issue while not breaking previous behavior.

More detail and an example json can be found in the readme.