I’m trying to add an additional email handler which is separate and distinct from my default email handler to send an email another email address with the “subject_prefix” set. When I add this new handler(prod) and cause the check to alert, I am seeing two emails being sent but only to the email address that I have configured for the default handler. Also noteworthy is that both of these emails sent to the default handler email address has the subject_prefix set. This is obviously odd because my default handler doesn’t have the subject_prefix set so I wouldn’t expect my default handler to add the “subject_prefix” AND I would not expect the newly added handler to be sending to the email address specified in default_handler.json.
$ cat default_handler.json
{
“handlers”: {
“default”: {
“type”: “pipe”,
“command”: “/opt/sensu/embedded/bin/handler-mailer.rb”
}
},
“mailer”: {
“admin_gui”: “http://mon01.domain.com:3000/”,
“mail_from”: "sensu@mon01.domain.com",
“mail_to”: "ops@domain.com",
“smtp_address”: “mailserverIP”,
“smtp_port”: “25”,
“smtp_domain”: “domain.com”
}
}
$ cat prod_handler.json
{
“handlers”: {
“prod”: {
“command”: “/opt/sensu/embedded/bin/handler-mailer.rb”,
“type”: “pipe”
}
},
“mailer”: {
“subject_prefix”: “TAG”,
“admin_gui”: “http://mon01.domain.com:3000/”,
“mail_from”: "sensu@mon01.domain.com",
“mail_to”: "alerts@domain.com",
“smtp_address”: “mailserverIP”,
“smtp_domain”: “domain.com”,
“smtp_port”: 25
}
}
cat check_crond.json
{
“checks”: {
“crond”: {
“command”: “/usr/lib/nagios/plugins/check_procs -c 1:1 -a ‘/usr/sbin/cron -f’ -u root”,
“handlers”: [
“prod”,
“default”
],
“interval”: 60,
“standalone”: true,
“user”: “sensu”
}
}
}
I have been able to add a second handlers for pagerduty alongside the default handler to some of my checks and they work fine but two email handlers do not. What am I doing wrong?
thank you,
Bob