Chef Sensu Handler is an OpsCode Chef exception handler for notifying people when a Chef run fails via Sensu. This will create and resolve Sensu alerts for a node in which the chef-run fails. This leverages the Sensu client's socket input to create/resolve checks.
gem install chef-sensu-handler
Append the following to your Chef client configs, usually at /etc/chef/client.rb
. The default return status is a warning
. You can change this to an error
in the config if you prefer. If you would like the alerts to automatically resolve themselves on a successful run set the report_handlers
.
# Notify Sensu when a Chef run fails
require "chef-sensu-handler"
report_handlers << SensuHandler.new # Auto-resolve alerts
exception_handlers << SensuHandler.new # Creates a warning
# or return status critical
# exception_handlers << SensuHandler.new(:critical) # Sets return status to critical
Alternatively, you can use the LWRP (available @ http://community.opscode.com/cookbooks/chef_handler)
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request