Hello,
I am surprise that I cannot see any info about this issue :
How can I send mail to different groups of people based on the alerts ? mailer only accept one config
Regards,
Hello,
I am surprise that I cannot see any info about this issue :
How can I send mail to different groups of people based on the alerts ? mailer only accept one config
Regards,
One way to solve this is to have multiple handler definitions, each
with the same handler command, but different configs.
One check could have the the mailer_ops handlers, and other might have
mailer_devs.
Another way to do it is to modify the handler to accept a destination
from the event data directly, and have the checks
control who they go to. I go even further with this in my setup, where
I look for a "team" variable, and email the default
team's address unless an override email destination is set. (for
special circumstances, or a test alert or something)
(I don't recommend doing this if you use standalone checks until
Make sensu server not merge check data when the check is stand_alone by solarkennedy · Pull Request #707 · sensu/sensu · GitHub is accepted)
(Sorry for throwing that in there )
On Fri, Apr 25, 2014 at 6:39 AM, Frédéric Médery <frederic@jomediainc.com> wrote:
Hello,
I am surprise that I cannot see any info about this issue :
How can I send mail to different groups of people based on the alerts ? mailer only accept one configRegards,
Tx for the help,
So something like this ?
2 handlers definitions :
cat handler_mailer.json
{
"handlers": {
"mailer": {
"type": "pipe",
"command": "/etc/sensu/handlers/mailer.rb"
}
}
}
cat handler_mailer_mateam.json
{
"handlers": {
"mailer_mateam": {
"type": "pipe",
"command": "/etc/sensu/handlers/mailer.rb"
}
}
}
2 mailer config files :
cat mailer.json
{
"mailer": {
"mail_from": "sensu-alerts@server",
"mail_to": "sensu-alerts-1@domain",
"smtp_address": "localhost",
"smtp_port": "25"
}
}
cat mailer_mateam.json
{
"mailer_mateam": {
"mail_from": "sensu-alerts@server",
"mail_to": "sensu-alerts-2@domain",
"smtp_address": "localhost",
"smtp_port": "25"
}
}
and in the checks :
one with handler: [‘mailer’],
and the other with handler: [‘mailer_mateam’],
Regards,
On Apr 25, 2014, at 10:22, Kyle Anderson <kyle@xkyle.com> wrote:
One way to solve this is to have multiple handler definitions, each
with the same handler command, but different configs.
One check could have the the mailer_ops handlers, and other might have
mailer_devs.Another way to do it is to modify the handler to accept a destination
from the event data directly, and have the checks
control who they go to. I go even further with this in my setup, where
I look for a "team" variable, and email the default
team's address unless an override email destination is set. (for
special circumstances, or a test alert or something)
(I don't recommend doing this if you use standalone checks until
Make sensu server not merge check data when the check is stand_alone by solarkennedy · Pull Request #707 · sensu/sensu · GitHub is accepted)
(Sorry for throwing that in there )On Fri, Apr 25, 2014 at 6:39 AM, Frédéric Médery > <frederic@jomediainc.com> wrote:
Hello,
I am surprise that I cannot see any info about this issue :
How can I send mail to different groups of people based on the alerts ? mailer only accept one configRegards,
Yea. Should work.
On Fri, Apr 25, 2014 at 9:34 AM, Frédéric Médery <frederic@jomediainc.com> wrote:
Tx for the help,
So something like this ?2 handlers definitions :
cat handler_mailer.json
{
"handlers": {
"mailer": {
"type": "pipe",
"command": "/etc/sensu/handlers/mailer.rb"
}
}
}cat handler_mailer_mateam.json
{
"handlers": {
"mailer_mateam": {
"type": "pipe",
"command": "/etc/sensu/handlers/mailer.rb"
}
}
}2 mailer config files :
cat mailer.json
{
"mailer": {
"mail_from": "sensu-alerts@server",
"mail_to": "sensu-alerts-1@domain",
"smtp_address": "localhost",
"smtp_port": "25"
}
}cat mailer_mateam.json
{
"mailer_mateam": {
"mail_from": "sensu-alerts@server",
"mail_to": "sensu-alerts-2@domain",
"smtp_address": "localhost",
"smtp_port": "25"
}
}and in the checks :
one with handler: [‘mailer’],
and the other with handler: [‘mailer_mateam’],Regards,
On Apr 25, 2014, at 10:22, Kyle Anderson <kyle@xkyle.com> wrote:
One way to solve this is to have multiple handler definitions, each
with the same handler command, but different configs.
One check could have the the mailer_ops handlers, and other might have
mailer_devs.Another way to do it is to modify the handler to accept a destination
from the event data directly, and have the checks
control who they go to. I go even further with this in my setup, where
I look for a "team" variable, and email the default
team's address unless an override email destination is set. (for
special circumstances, or a test alert or something)
(I don't recommend doing this if you use standalone checks until
Make sensu server not merge check data when the check is stand_alone by solarkennedy · Pull Request #707 · sensu/sensu · GitHub is accepted)
(Sorry for throwing that in there )On Fri, Apr 25, 2014 at 6:39 AM, Frédéric Médery >> <frederic@jomediainc.com> wrote:
Hello,
I am surprise that I cannot see any info about this issue :
How can I send mail to different groups of people based on the alerts ? mailer only accept one configRegards,
Actually, you’re going to find that it doesn’t work. IIRC : Line 41 in the mailer.rb from the comunity-plugins shows that it looks up the setting for ‘mailer’, whenever the command mailer.rb is called. It’s a limit in pretty much every community handler. (doesn’t matter if the handler you called is Jim, or mail, or default or mailer, it will look up mailer.)
I just posted a question about this, but it doesn’t seem like it’s shown up yet out of moderation.
i have a simple fix for it, which is to modify the line that specifies the mail_to: to use the base name of the command called (mailer.rb, thus: mailer) as the setting to lookup. A link from mailer.rb to mailer_mateam.rb, and set your command: to be mailer_mateam.rb.
My other post has the complete code for it, and a full set of configs to show it. I’ve already tested it and it works fine… I’d issue a pull req, but I’m hoping for a better way to deal with it universally.
On Friday, April 25, 2014 12:34:52 PM UTC-4, Frédéric Médery wrote:
Tx for the help,
So something like this ?2 handlers definitions :
cat handler_mailer.json
{
“handlers”: {
“mailer”: {
“type”: “pipe”,
“command”: “/etc/sensu/handlers/mailer.rb”
}
}
}cat handler_mailer_mateam.json
{
“handlers”: {
“mailer_mateam”: {
“type”: “pipe”,
“command”: “/etc/sensu/handlers/mailer.rb”
}
}
}2 mailer config files :
cat mailer.json
{
“mailer”: {
“mail_from”: “sensu-alerts@server”,
“mail_to”: “sensu-alerts-1@domain”,
“smtp_address”: “localhost”,
“smtp_port”: “25”
}
}cat mailer_mateam.json
{
“mailer_mateam”: {
“mail_from”: “sensu-alerts@server”,
“mail_to”: “sensu-alerts-2@domain”,
“smtp_address”: “localhost”,
“smtp_port”: “25”
}
}and in the checks :
one with handler: [‘mailer’],
and the other with handler: [‘mailer_mateam’],Regards,
On Apr 25, 2014, at 10:22, Kyle Anderson ky...@xkyle.com wrote:
One way to solve this is to have multiple handler definitions, each
with the same handler command, but different configs.
One check could have the the mailer_ops handlers, and other might have
mailer_devs.Another way to do it is to modify the handler to accept a destination
from the event data directly, and have the checks
control who they go to. I go even further with this in my setup, where
I look for a “team” variable, and email the default
team’s address unless an override email destination is set. (for
special circumstances, or a test alert or something)
(I don’t recommend doing this if you use standalone checks until
https://github.com/sensu/sensu/pull/707 is accepted)
(Sorry for throwing that in there )On Fri, Apr 25, 2014 at 6:39 AM, Frédéric Médery > > fred...@jomediainc.com wrote:
Hello,
I am surprise that I cannot see any info about this issue :
How can I send mail to different groups of people based on the alerts ? mailer only accept one configRegards,