Notification not sending email.

Neil Marjoram n.marjoram at adastral.ucl.ac.uk
Tue Feb 21 11:27:26 CET 2006


Deborah,

I have tried the mail command on the command line, and it works fine, I 
have even copied the definition in, changed the variables and tried 
that, which also works. Here are the 2 definitions for email that are in 
misccommands.cfg :

define command{
        command_name    host-notify-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 "Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$
        }
define command{
        command_name    notify-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$" | /bin/mail -s "** $NOTIFICATIONTYPE$ alert - 
$HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
        }

Many thanks,

Neil.

Deborah Martin wrote:

>how is notify-by-email defined ? Its found in miscommands.cfg. 
>
>have you tried using the defined command on the command line to ensure it
>works ? 
>e.g something like  mailx -s "test" admins at adastral.ucl.ac.uk  
>
>hth 
>
>
>
>-----Original Message-----
>From: Neil Marjoram [mailto:n.marjoram at adastral.ucl.ac.uk]
>Sent: 21 February 2006 09:53
>To: nagios-users at lists.sourceforge.net
>Subject: [Nagios-users] Notification not sending email.
>
>
>I'm having a little trouble with notifications. 
>
>
>
>I can't workout why Nagios is not sending alert emails. I have read
> the documentation, FAQ's and mailing lists and have concluded it
> is only me that can't get it to work. Can someone have a look at
> my configs below to see if I have done anything wrong. I loaded
> up Nagios QL to check I am configuring the files correctly but
> it has made no difference. Running the command for email on the
> command line works (although it errors because of the variables)
>
>
>
>Many thanks,
>
>
>
>Neil.
>
>
>
>OS : RHEL 4 / i386, using Dag rpm's 
>
>
>
>nagios-plugins-1.4-2.2.el4.rf
>
>nagios-2.0-2.2.el4.rf
>
>nagios-nsca-2.5-2.2.el4.rf
>
>nagios-nrpe-2.3-2.2.el4.rf
>
>nagios-plugins-nrpe-2.3-2.2.el4.rf
>
>
>
>Nagios main config file notifications is set :
>
>enable_notifications=1
>
>
>
>Host config :
>
>define  host {
>
>        host_name                       haverhill
>
>        alias                           haverhill
>
>        address                         128.40.159.3
>
>        hostgroups                      Critical Web Services
>
>        check_command                   check-host-alive
>
>        max_check_attempts              10
>
>        check_interval                  1
>
>        active_checks_enabled           1
>
>        passive_checks_enabled          1
>
>        check_period                    24x7
>
>        obsess_over_host                1
>
>        check_freshness                 0
>
>        event_handler                   notify-by-email
>
>        event_handler_enabled           1
>
>        flap_detection_enabled          1
>
>        process_perf_data               0
>
>        retain_status_information       1
>
>        retain_nonstatus_information    0
>
>        contact_groups                  admins
>
>        notification_interval           1
>
>        notification_period             24x7
>
>        notification_options            d,u,r,f
>
>        notifications_enabled           1
>
>        register                        1
>
>        }
>
>
>
>Services Config : 
>
>
>
>define  service {
>
>        host_name                       haverhill
>
>        service_description             haverhill /root
>
>        servicegroups                   Web Services
>
>        is_volatile                     0
>
>        check_command                   check_nrpe!check_diskroot
>
>        max_check_attempts              10
>
>        normal_check_interval           1
>
>        retry_check_interval            1
>
>        active_checks_enabled           1
>
>        passive_checks_enabled          1
>
>        check_period                    24x7
>
>        parallelize_check               1
>
>        obsess_over_service             1
>
>        check_freshness                 0
>
>        event_handler                   notify-by-email
>
>        event_handler_enabled           1
>
>        flap_detection_enabled          1
>
>        process_perf_data               1
>
>        retain_status_information       1
>
>        retain_nonstatus_information    1
>
>        contact_groups                  admins
>
>        notification_interval           1
>
>        notification_period             24x7
>
>        notification_options            w,u,c,r,f
>
>        notifications_enabled           1
>
>        register                        1
>
>        }
>
>
>
>Contacts.cfg :
>
>define  contact {
>
>        contact_name                    admins
>
>        alias                           NetSaint Admin
>
>        contactgroups                   admins
>
>        host_notification_period        24x7
>
>        service_notification_period     24x7
>
>        host_notification_options       d,u,r
>
>        service_notification_options    w,u,c,r
>
>        host_notification_commands      host-notify-by-email
>
>        service_notification_commands   notify-by-email
>
>        email                           admins at adastral.ucl.ac.uk
>
>        }
>
>Contactgroups.cfg :
>
>
>
>
>
>define  contactgroup {
>
>        contactgroup_name               admins
>
>        alias                           Administrators
>
>        members                         admins
>
>        }
>
>
>
>Output to nagios.log file : 
>
>
>
>[1140447007] SERVICE NOTIFICATION: admins;haverhill;/tmp;CRITICAL;notify-
>by-email;DISK CRITICAL - free space: / 183 MB (38%): /boot 67 MB
> (67%): /chroot 451 MB (93%): /dev/shm 505 MB (100%): /tmp 912 MB
> (93%): /usr 915 MB (31%): /var 35887 MB (91%): /www 4234 MB (86%):
> /mnt/install 791153 MB (56%): /home/neilmarj 791153 MB (56%): /home/avel
>azqu 791153 MB (56%): /home/richhutch 791153 MB (56%): /home/vladkolm
> 791153 MB (56%):
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>  
>

-- 
Neil Marjoram
Systems Manager
Adastral Park Campus
University College London
Ross Building
Adastral Park
Martlesham Heath
Ipswich - Suffolk
IP5 3RE

Tel: 01473 663711
Fax: 01473 635199


Reclaim Your Inbox!
http://www.mozilla.org/products/thunderbird



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
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