Email Notifications

kellyjackie at eircom.net kellyjackie at eircom.net
Wed Nov 12 14:19:10 CET 2008


Please help!
I have set up eSMTP as relay.The test from the command line is as follows: echo "test" | /usr/bin/esmtp -C ~/esmtp outside at email -f inside at email
outside at email is an outside email address i am sending to from an inside email address on our email server. Do i need to specify the inside email server and the account i am using within nagios and if so where? or should the usual configuration be enough. the relevant parts of the config fiels are as follows.

Thanks in advance for any help

The following are the config files:



>From the windows.cfg file:

define host{
        use             windows-pcs     ; Inherit default values from a template
        host_name       invoicepc       ; The name we're giving to this host
        alias           invoicingpc     ; A longer name associated with the host
        address         x.x.x.x     ; IP address of the host
        }


define hostgroup{
        hostgroup_name  windows-pcs     ; The name of the hostgroup
        alias           Windows PCs     ; Long name of the group
        members         invoicepc
        }


define service{
        use                     generic-service
        hostgroup_name          windows-pcs
        service_description     Uptime
        check_command           check_nt!UPTIME
        contact_groups          admins
        }


>From the commands.cfg file:

# 'notify-host-by-email' command definition
define command{
        command_name    notify-host-by-email
        command_line    /usr/bin/esmtp/printf "%b" "***** Nagios *****\n\nNotification Type:  $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo:  $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/esmtp -s "** $NOTIFICATIONTYPE$ Host Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$


        }

# 'notify-service-by-email' command definition
define command{
        command_name    notify-service-by-email
        command_line    /usr/bin/esmtp/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/esmtp -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is  $SERVICESTATE$ **" $CONTACTEMAIL$


        }

# 'process-host-perfdata' command definition
define command{
        command_name    process-host-perfdata
        command_line    /usr/bin/esmtp/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$$E$\



        }


# 'process-service-perfdata' command definition
define command{
        command_name    process-service-perfdata
        command_line    /usr/bin/esmtp/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$
        }

>From the contacts.cfg file:

define contact{
        contact_name                    nagiosadmin             ; Short name of user
        use                             generic-contact         ; Inherit default values from ge$
        alias                           Nagios Admin            ; Full name of user
        host_notifications_enabled 1
        service_notifications_enabled 1
        host_notification_period        24x7
        service_notification_period     24x7
        service_notification_options    w,u,c,r
        host_notification_options       d,u,r
        service_notification_commands   notify-service-by-email
        host_notification_commands      notify-host-by-email
        email                           outside email address  ; <<***** CHANGE THIS TO YOUR EM$
        }


# NOTIFICATIONS OPTION
# This determines whether or not Nagios will sent out any host or
# service notifications when it is initially (re)started.
# Values: 1 = enable notifications, 0 = disable notifications

enable_notifications=1


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
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