Multiple E-Mail Address

Marc Powell marc at ena.com
Fri Feb 18 18:22:17 CET 2005



> -----Original Message-----
> From: nagios-users-admin at lists.sourceforge.net [mailto:nagios-users-
> admin at lists.sourceforge.net] On Behalf Of Joe Giles
> Sent: Friday, February 18, 2005 10:51 AM
> To: Nagios Users List
> Subject: [Nagios-users] Multiple E-Mail Address
> 
> Hey all,
> 
> I was wondering how I can set up multiple e-mail address for my
> contacts. I want alerts sent to more than one e-mail address and I
tried
> adding one e-mail address, then separating with a comma, then another
> e-mail address and only the first is sent.
> 
> How can I specify multiple e-mail address to send alerts too.

There are two ways that I can think of --

1) Create multiple contacts and add them to the same contactgroup.

2) Does the mailer program you are using for your notifications support
multiple addresses? The email address is simply passed to your notify
command as $CONTACTEMAIL$, as long as the format of that variable and
the command definition match what the program is expecting, it should
just work. For example, /bin/mail allows you to specify multiple email
addresses on the command line as long as they are separated by commas so
I could use the following --

# 'nateng-servers' contact definition
define contact{
        contact_name                    nateng-servers
        alias                           Servers On Call
        service_notification_period     24x7
        host_notification_period        24x7
        service_notification_options    c,r
        host_notification_options       d,r
        service_notification_commands   service-notify-by-email
        host_notification_commands      host-notify-by-email
        email
marc at ena.com,someotheremail at address.foo
        }

# 'service-notify-by-email' command definition
define command{
        command_name    service-notify-by-email
        command_line    /bin/echo -e "Subject: Service $SERVICEDESC$
$SERVICESTATE$ alert for $HOSTNAME$!\n\n***** Nagios
*****\n\nNotification Type: $NOTIFICATIONTYPE$
\nHost: $HOSTNAME$\nState: $SERVICESTATE$\nAddress:
$HOSTADDRESS$\n\nService: $SERVICEDESC$\nInfo: $OUTPUT$\n\nDate/Time:
$DATETIME$\n" | /bin/mail -s '** $NOTIFICATION
TYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **'
$CONTACTEMAIL$
        }

I've just tested this and it works as expected. Make sure you're not
stripping out ',' in illegal_macro_output_chars.

--
Marc



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list