- From: AJ Christensen <
>
- To: "
" <
>
- Subject: [chef] Re: Re: What is a simple method to arrange e-mail notification of failed convergence?
- Date: Wed, 26 Nov 2014 08:06:21 +1300
Yo,
All of the suggestions are trivial, less than 5 minutes of work. It's
your relative knowledge ("Chef skill") with regard to the ecosystem
that makes them seem "complicated". I've heard this a lot recently,
but you're the first I'm going to call out on it.
I would probably suggest not being so aggressive in your replies to
the mailing list. Building a chef handler is simple. Building one that
shells to 'mail' with a pipe is simple as well. It is not complicated.
@kallistec took the time to respond rapidly to your question with a
handler that @kisoku had already built for you. Many of us build this
software for a living.
I would add a recommendation for using the Pony gem. It looks like
@kisoku's chef-handler-mail software supports a custom template for
emailing, which is something you'd end up doing eventually anyway: I
bet you'll want to send data based on the converge itself (updated
resources, which resources, updated resources of a certain type, run
length info, blah blah.)
The "half day of dependency hell" to which you so promptly refer is
solved with a few Chef resources in a cookbook, probably designed for
installing the email handler:
```
chef_gem 'chef-handler-mail'
require 'chef/handler/mail'
chef_handler 'MailHandler' do
source 'chef/handler/mail'
arguments :to_address => "root"
action :nothing
end.run_action(:enable)
```
The dependency on 'pony' is handled through the chef_gem installation
of chef-handler-mail. There are no additional deps. [0]
Please, do the needful.
cheers,
--aj
[0]
https://rubygems.org/gems/chef-handler-mail
On Wed, Nov 26, 2014 at 7:54 AM, Phil Mocek
<
>
wrote:
>
Daniel DeLeo wrote:
>
> there are already ones written that do what you’re asking, like
>
> this one: https://github.com/kisoku/chef-handler-mail
>
>
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:
>
> https://docs.getchef.com/essentials_handlers.html#syntax if you
>
> 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:
>
> https://docs.getchef.com/essentials_handlers.html#community-handlers
>
>
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:
>
> https://docs.getchef.com/resource_chef_handler.html (GH:
>
> https://github.com/opscode-cookbooks/chef_handler)
>
>
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
>
https://mocek.org
Archive powered by MHonArc 2.6.16.