SNS Handler

I’ve been trying to implement chef reporting to SNS with this:
http://onddo.github.io/chef-handler-sns/

I’m kind of confused about it all. I’m using the sns handler cookbook at
https://github.com/onddo/chef_handler_sns-cookbook like it recommends.

The cookbook installs the dependancies, but I want to configure it via
client.rb so that it will report on issues during the compile phase.

However, if I add this to client.rb like the doc says:
sns_handler.subject: “Chef-run: <%= node.name %> - <%= run_status.success?
? “ok” : “error” %>”

Then, I guess this isn’t valid ruby or something because the chef client
run fails with an error pointing here. :frowning:

Is there a better way to chef run reporting?

Doug.

you are using erb syntax inside ruby file, use string interpolation instead
"Chef-run: #{ node.name} http://node.name - #{ run_status.success? ? 'ok'
: 'error' }"

i doubt node object is accessible inside the config file. so node.name wont
work, sns handler will have access to this, it can be instrumented from
there

there are several ways to do chef run reporting, it all depends upon what
tools you are using. we use the datadog handler, cause we use datadog as
monitoring system, you can use statsd or email handlers as well,

On Thu, Sep 24, 2015 at 12:41 PM, Doug Garstang doug@slice.com wrote:

I've been trying to implement chef reporting to SNS with this:
Chef-handler-sns by onddo

I'm kind of confused about it all. I'm using the sns handler cookbook at
GitHub - zuazo/chef_handler_sns-cookbook: Chef cookbook to install and enable chef-handler-sns: A simple Chef report handler that reports status of a Chef run through Amazon SNS. Includes IAM roles support. like it recommends.

The cookbook installs the dependancies, but I want to configure it via
client.rb so that it will report on issues during the compile phase.

However, if I add this to client.rb like the doc says:
sns_handler.subject: "Chef-run: <%= node.name %> - <%=
run_status.success? ? "ok" : "error" %>"

Then, I guess this isn't valid ruby or something because the chef client
run fails with an error pointing here. :frowning:

Is there a better way to chef run reporting?

Doug.

On 2015-09-24 12:41, Doug Garstang wrote:

I've been trying to implement chef reporting to SNS with this:
Chef-handler-sns by onddo
[...]

However, if I add this to client.rb like the doc says:
sns_handler.subject: "Chef-run: <%= node.name %> - <%= run_status.success?
? "ok" : "error" %>"

Then, I guess this isn't valid ruby or something because the chef client
run fails with an error pointing here. :frowning:

There are some typos in the documentation. Try the following:

sns_handler.subject "Chef-run: <%= node.name %> - <%= run_status.success? ? 'ok' : 'error' %>"

--
Xabier de Zuazo

Are the typos in the README or in the chef docs? Let's get them fixed.
On Thu, Sep 24, 2015 at 2:41 PM Xabier de Zuazo xabier@zuazo.org wrote:

On 2015-09-24 12:41, Doug Garstang wrote:

I've been trying to implement chef reporting to SNS with this:
Chef-handler-sns by onddo
[...]

However, if I add this to client.rb like the doc says:
sns_handler.subject: "Chef-run: <%= node.name %> - <%=
run_status.success?
? "ok" : "error" %>"

Then, I guess this isn't valid ruby or something because the chef client
run fails with an error pointing here. :frowning:

There are some typos in the documentation. Try the following:

sns_handler.subject "Chef-run: <%= node.name %> - <%= run_status.success?
? 'ok' : 'error' %>"

--
Xabier de Zuazo

On 2015-09-25 14:57, Charles Johnson wrote:

Are the typos in the README or in the chef docs? Let's get them fixed.

I fixed them just after sending the response :wink:

--
Xabier de Zuazo