puppet sensu handler mail to different addresses

I’m trying to work out how the best way to have events sent to different addresses depending on where they originated.

I’m using the community mailer, at the moment, and attaching a configuration hash that specifies “mail_to” and all the other configuration options.

For a set of checks that are all the same, except they originate from machines in different environments, I want to change the “mail_to” config for the mailer handler to go to a different notification list.

Is there a way you can think of to do this in the sensu config json?

I’m guessing as a last resort I can hack the mailer.rb to examine the machine’s environment and change the mail_to there, but it’s not very Sensu. :slight_smile:

Mojo

Nothing wrong with improving the community scripts!
Why not have it use a custom value that is set in the client config?

Something along:

#{admin_email}

or such. You could have it use a custom if it exists, otherwise use what is in the mailer.json config file.

Brian Andrus

···

On Monday, March 17, 2014 4:50:47 PM UTC-7, Morris Jones wrote:

I’m trying to work out how the best way to have events sent to different addresses depending on where they originated.

I’m using the community mailer, at the moment, and attaching a configuration hash that specifies “mail_to” and all the other configuration options.

For a set of checks that are all the same, except they originate from machines in different environments, I want to change the “mail_to” config for the mailer handler to go to a different notification list.

Is there a way you can think of to do this in the sensu config json?

I’m guessing as a last resort I can hack the mailer.rb to examine the machine’s environment and change the mail_to there, but it’s not very Sensu. :slight_smile:

Mojo

Excellent suggestion, thank you!

···

On Tue, Mar 18, 2014 at 2:12 PM, Brian Andrus toomuchit@gmail.com wrote:

Nothing wrong with improving the community scripts!
Why not have it use a custom value that is set in the client config?

Something along:

#{admin_email}

or such. You could have it use a custom if it exists, otherwise use what is in the mailer.json config file.

Brian Andrus

On Monday, March 17, 2014 4:50:47 PM UTC-7, Morris Jones wrote:

I’m trying to work out how the best way to have events sent to different addresses depending on where they originated.

I’m using the community mailer, at the moment, and attaching a configuration hash that specifies “mail_to” and all the other configuration options.

For a set of checks that are all the same, except they originate from machines in different environments, I want to change the “mail_to” config for the mailer handler to go to a different notification list.

Is there a way you can think of to do this in the sensu config json?

I’m guessing as a last resort I can hack the mailer.rb to examine the machine’s environment and change the mail_to there, but it’s not very Sensu. :slight_smile:

Mojo