contact emails

Marc Powell marc at ena.com
Mon Apr 18 23:01:05 CEST 2005



> -----Original Message-----
> From: nagios-users-admin at lists.sourceforge.net [mailto:nagios-users-
> admin at lists.sourceforge.net] On Behalf Of Tony Heal
> Sent: Monday, April 18, 2005 3:40 PM
> To: 'Lewis Getschel'; 'Todd Richmond'
> Cc: nagios-users at lists.sourceforge.net
> Subject: [Nagios-users] contact emails
> 
> I have a Debian (woody) 2.01b system and I need to get notifications
sent
> to
> several email addresses for the same contact.
> 
> $CONTACTADDRESSn$
> Address of the contact being notified. Each contact can have six
different
> addresses (in addition to email address and pager number). The macros
for
> these addresses are $CONTACTADDRESS1$ - $CONTACTADDRESS6$. This value
is
> taken from the addressx directive in the contact definition.
> 
> After reading the docs it looks like I have to use addressx where x is
a
> number 1-6 in my contact def and (although it is not stated) set up a
> definition in misccommands.cfg to use this.
> 
> This setup passes the check, but still does not email both email
> addresses.
> Only the address for email (not address1). I actually need to get
notified
> on at least 3 email addresses.
> 
> # 'notify-by-address-1' command definition
> define command{
>         command_name    notify-by-address-1
>         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$" | /usr/bin/mail -s
"$HOSTALIAS$/$SERVICEDESC$ is
> $SERVICESTATE$ - $NOTIFICATIONTYPE$ alert" $CONTACTADDRESS1$
>         }
> 
> contact defined in contacts.cfg
> # 'theal' contact definition
> define contact{
>         contact_name                    theal
>         alias                           Tony Heal
>         contactgroups                   network-admins
>         service_notification_period     24x7
>         host_notification_period        24x7
>         service_notification_options    w,u,c,r
>         host_notification_options       d,u,r
>         service_notification_commands   notify-by-email, notify-by-
> address-1
>         host_notification_commands      host-notify-by-email,
> host-notify-by-address-1
>         email                           theal at pace2020.com
>         address1
> my-other-email-address at that-place.com
>         }


This seems really convoluted. /usr/bin/mail knows how to interpret
multiple comma-separated email addresses from command line input. You
can test this yourself by doing the following --

$ echo "testing" | /usr/bin/mail -s "This is a test" email at address1.com,
email at address2.com,email at address3.com

Nagios just treats $CONTACTEMAIL$ as a string, with no specific parsing,
substituting the entire string where specified. The simplest way to
accomplish what you want would seem to be to use the default
notification and just specify multiple addresses per contact as such --

# 'theal' contact definition
define contact{
        contact_name                    theal
        alias                           Tony Heal
        contactgroups                   network-admins
        service_notification_period     24x7
        host_notification_period        24x7
        service_notification_options    w,u,c,r
        host_notification_options       d,u,r
        service_notification_commands   notify-by-email
        host_notification_commands      host-notify-by-email
        email
theal at pace2020.com,my-other-email-address at that-place.com,my-third-email-
address at foo.bar
        }


-------------------------------------------------------
This SF.Net email is sponsored by: New Crystal Reports XI.
Version 11 adds new functionality designed to reduce time involved in
creating, integrating, and deploying reporting solutions. Free runtime info,
new features, or free trial, at: http://www.businessobjects.com/devxi/728
_______________________________________________
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