[chef] Re: Re: What is a simple method to arrange e-mail notification of failed convergence?


Chronological Thread 
  • From: Daniel Condomitti < >
  • To:
  • Subject: [chef] Re: Re: What is a simple method to arrange e-mail notification of failed convergence?
  • Date: Tue, 25 Nov 2014 11:05:46 -0800

Adding a chef handler *is* the simple method for configuring email notifications from Chef runs. The client doesn’t have a built in mechanism for sending emails considering you may not have even installed an MTA when the Chef run fails. 

If you want to rely on something like cron’s MAILTO you can run chef-client on a cron but that won’t help you during the initial bootstrap process. We post our chef failures to our internal chat and Github gists using nothing more than a handler which performs HTTP posts through the Ruby stdlib; you may want to look into doing the same as you don’t need a working MTA for that.

Installing gems on systems is actually very easy given the chef_gem resource. Try using that handler, it shouldn’t take you very long to get working assuming you’re using omnibus.

On Tuesday, November 25, 2014 at 10:54 AM, Phil Mocek wrote:

Daniel DeLeo wrote:
there are already ones written that do what you’re asking, like

That's not quite what I'm asking, which is for a simple method to
configure chef-client to send an e-mail to a particular address if
convergence fails. Apparently, to use chef-handler-email, I need
to install one or more gems on client systems (that sounds like a
half-day of dependency hell), or use the provided LWRP in a recipe
of my creation. If that's the simplest way to get an e-mail from
chef-client on failure, I'm disappointed, and concerned that I
have miscommunicated my goal.

A super simple example is provided in the docs you linked:
just want to copy pasta that code.

That appears to be a simple example *of how to write a custom
handler*. I do not want to write a custom handler. All I really
need to customize is the e-mail address to which notifications
should be sent, like cron's MAILTO setting.

If you’re interested in other community-contributed handlers,
there’s a list at the bottom of the documentation page:

That is preferable to writing my own handler. It still appears to
require writing a recipe. I'm busy writing recipes to deploy and
configure software and virtual infrastructure. I just want to
tell chef-client to send an e-mail when it fails.

Also, there is a chef_handler cookbook that will manage handlers
for you, some documentation on that is here:

That's also useful, and also far more complicated than I hoped it
would be just to get chef-client to send an e-mail on failure.

I feel like I must be missing something. My goal, here, seems
likely to be a common one, and Chef generally handles those well
without much work on the user's part.

Thanks for the suggestions, Daniel. I suspect I will end up using
some of what you referenced.

--
Phil Mocek




Archive powered by MHonArc 2.6.16.

§