sensu/sensu-puppet — pull request #53 by phobos182 (2013-03-20 17:13:30+00:00)
Title: Allow custom check metadata to be sent to Handler

Allows for custom metadata (Like config) on the check itself to be sent to the handler. The config directive on sensu_check_config specifies local configurations for the check itself. This would allow metadata on the check to be described to be sent to the handler. Such as the email address to notify when a check fails, or the playbook / runbook used to solve the issue.

Example Check

sensu::check { 'namenode_alive':
command => '/usr/lib/nagios/plugins/check_http -e 200 -s "Started" -H localhost -p 50070 -u /dfshealth.jsp',
handlers => ['pagerduty', 'sendgrid'],
interval => '60',
standalone => true,
subscribers => ['namenode'],
metadata => { 'sendgrid' => { 'mail_to' => 'oncall@email.com' }, 'runbook' => 'https://url#NameNodeprocessdownalert' }
}

Resulting JSON

{
"checks": {
"namenode_alive": {
"runbook": "https://url#NameNodeprocessdownalert",
"sendgrid": {
"mail_to": "oncall@myemail.com"
}
}
},
"namenode_alive": {
}
}