phlipper / chef-monit

Chef cookbook for monit package
http://phlippers.net/chef-monit
MIT License
67 stars 69 forks source link

Adds support for multiple email recipients #59

Closed 7imbrook closed 7 years ago

7imbrook commented 10 years ago

As discussed here using set alert multiple times will set multiple recipients. The changes I made reflect this with :alert_email being changed to :alert_emails and making it take an array of emails.

TalkingQuickly commented 9 years ago

+1 for this, is it worth still supporting the old alert_email variable for backwards compatibility?

7imbrook commented 9 years ago

@TalkingQuickly yeah, I'll add it back in. I think you should mark it as deprecated because having both is a bit too verbose. But for now we shouldn't break things for people who are depending on it. Totally missed that, thanks for pointing that out.

phlipper commented 9 years ago

@7imbrook thank you very much for this! I think the easiest way to support multiple emails and still keep backwards compatibility would be to leave the alert_email attribute as-is, and in the monitrcrb.erb template, coerce the attribute with Array to ensure it can be iterated:

<% Array(node["monit"]["alert_email"]).each do |email| %>
   set alert ...
<% end %>

It would be great if you could also add a quick note to the README indicating that either a string or an array can be used for this attribute. Thanks!

7imbrook commented 7 years ago

Closing because I forgot what this was ever for. And it's old.