Configure multiple E-mail servers
Configure multiple E-mail servers
I have Nagios monitoring postfix along with other services on a server. The client is like to get e-mail alert if postfix stop working. Is there anyway we can configure nagios to use a remote e-mail server if the local postfix is not working? If that is not possible, how can I configure nagios to use remote e-mail server all the time? From what I understand Nagios is using /bin/mail on my host for sending e-mails. Appreciate all your help.
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Configure multiple E-mail servers
By default there is not another option from /bin/mail. However you may try something like Send HTML Email Alert v2
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Re: Configure multiple E-mail servers
Thank you for the suggestion. Unfortunately we don't have php installed on this host.
Re: Configure multiple E-mail servers
Any email client that can be passed a message from the cli through a pipe ("|") can be used with nagios. You will need to create custom notification commands. This includes altering the path to the new binary and changing any syntax to the expected syntax for the new client:
You should copy the notification commands from commands.cfg, make sure to change the command names so they do not conflict with the standard notification commands. Everything after the pipe ("|") in tehse commands may have to be modified to accommodate the syntax of the new email client.
Code: Select all
# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.