Page 1 of 2

Nagios do not send Notification Emails

Posted: Mon Aug 26, 2013 6:49 am
by BAK
I just followed this guide http://www.globility.co.uk/?p=386
but nagios still do not send any notification to my mail.

from nagios3/conf.d

Code: Select all

define contact{
        contact_name                    root
        alias                           Root
        service_notification_period     24x7
        host_notification_period        24x7
        service_notification_options    w,u,c,r
        host_notification_options       d,u,r,f,s
        service_notification_commands   notify-service-by-email
        host_notification_commands      notify-host-by-email
        email                           [email protected]
        }
###############################################################################
#
# CONTACT GROUPS
#
###############################################################################

define contactgroup{
        contactgroup_name       admins
        alias                   Nagios Administrators
        members                 root
        }
I hope I have provided all the useful informations.

Re: Nagios do not send Notification Emails

Posted: Mon Aug 26, 2013 11:26 am
by sreinhardt
so to be clear, you are attempting to send to a hotmail account? Are you using any ISP smtp relay, or attempting to send directly to hotmail? Often times, hotmail will just reject\delete the email if your IP address does not have a domain and correct dns records setup, is this already done?

Re: Nagios do not send Notification Emails

Posted: Tue Aug 27, 2013 4:15 am
by BAK
I just installed postfix and use this commands for notifications

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" | /usr/bin/mailx -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" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
        }

Re: Nagios do not send Notification Emails

Posted: Tue Aug 27, 2013 12:34 pm
by abrist
If you are using postfix, then you should be receiving logs concerning the mailing attempts. what is the output of:

Code: Select all

tail -25 /var/log/maillog 

Re: Nagios do not send Notification Emails

Posted: Wed Aug 28, 2013 3:50 am
by BAK
I also tested postfix with:

Code: Select all

sudo echo "Test mail from postfix" | mail -s "Test Postfix" [email protected]

Code: Select all

fab@fab-HP-Compaq-Pro-6300-SFF:~$ sudo tail -25 /var/log/mail.log 
Aug 28 22:43:48 fab-HP-Compaq-Pro-6300-SFF postfix/qmgr[12176]: AE4F41640C44: from=<[email protected]>, size=452, nrcpt=1 (queue active)
Aug 28 22:43:48 fab-HP-Compaq-Pro-6300-SFF postfix/error[12686]: AE4F41640C44: to=<[email protected]>, relay=none, delay=0.28, delays=0.18/0/0/0.1, dsn=4.4.1, status=deferred (delivery temporarily suspended: connect to mx3.hotmail.com[65.54.188.110]:25: Connection timed out)
Aug 28 22:45:46 fab-HP-Compaq-Pro-6300-SFF postfix/pickup[12175]: 0E95B1640C46: uid=117 from=<nagios>
Aug 28 22:45:46 fab-HP-Compaq-Pro-6300-SFF postfix/cleanup[12800]: 0E95B1640C46: message-id=<[email protected]>
Aug 28 22:45:46 fab-HP-Compaq-Pro-6300-SFF postfix/qmgr[12176]: 0E95B1640C46: from=<[email protected]>, size=642, nrcpt=1 (queue active)
Aug 28 22:46:15 fab-HP-Compaq-Pro-6300-SFF postfix/qmgr[12176]: CBF081640C42: from=<[email protected]>, size=452, nrcpt=1 (queue active)
Aug 28 22:46:15 fab-HP-Compaq-Pro-6300-SFF postfix/qmgr[12176]: E8F271640C2E: from=<[email protected]>, size=452, nrcpt=1 (queue active)
Aug 28 22:46:16 fab-HP-Compaq-Pro-6300-SFF postfix/smtp[12802]: connect to mx4.hotmail.com[65.55.37.104]:25: Connection timed out
Aug 28 22:46:45 fab-HP-Compaq-Pro-6300-SFF postfix/smtp[12828]: connect to mx3.hotmail.com[65.55.92.136]:25: Connection timed out
Aug 28 22:46:45 fab-HP-Compaq-Pro-6300-SFF postfix/smtp[12829]: connect to mx1.hotmail.com[65.55.92.168]:25: Connection timed out
Aug 28 22:46:46 fab-HP-Compaq-Pro-6300-SFF postfix/smtp[12802]: connect to mx1.hotmail.com[65.55.92.152]:25: Connection timed out
Aug 28 22:47:15 fab-HP-Compaq-Pro-6300-SFF postfix/smtp[12829]: connect to mx3.hotmail.com[65.54.188.72]:25: Connection timed out
Aug 28 22:47:15 fab-HP-Compaq-Pro-6300-SFF postfix/smtp[12828]: connect to mx1.hotmail.com[65.55.92.184]:25: Connection timed out
Aug 28 22:47:16 fab-HP-Compaq-Pro-6300-SFF postfix/smtp[12802]: connect to mx1.hotmail.com[65.54.188.94]:25: Connection timed out
Aug 28 22:47:45 fab-HP-Compaq-Pro-6300-SFF postfix/smtp[12829]: connect to mx1.hotmail.com[65.54.188.72]:25: Connection timed out
Aug 28 22:47:45 fab-HP-Compaq-Pro-6300-SFF postfix/smtp[12828]: connect to mx4.hotmail.com[65.55.37.88]:25: Connection timed out
Aug 28 22:47:46 fab-HP-Compaq-Pro-6300-SFF postfix/smtp[12802]: connect to mx1.hotmail.com[65.55.92.136]:25: Connection timed out
Aug 28 22:48:15 fab-HP-Compaq-Pro-6300-SFF postfix/smtp[12829]: connect to mx2.hotmail.com[65.54.188.126]:25: Connection timed out
Aug 28 22:48:15 fab-HP-Compaq-Pro-6300-SFF postfix/smtp[12828]: connect to mx4.hotmail.com[65.55.37.104]:25: Connection timed out
Aug 28 22:48:16 fab-HP-Compaq-Pro-6300-SFF postfix/smtp[12802]: connect to mx3.hotmail.com[65.55.92.136]:25: Connection timed out
Aug 28 22:48:16 fab-HP-Compaq-Pro-6300-SFF postfix/smtp[12802]: 0E95B1640C46: to=<[email protected]>, relay=none, delay=151, delays=0.22/0/151/0, dsn=4.4.1, status=deferred (connect to mx3.hotmail.com[65.55.92.136]:25: Connection timed out)
Aug 28 22:48:45 fab-HP-Compaq-Pro-6300-SFF postfix/smtp[12829]: connect to mx3.hotmail.com[65.55.37.88]:25: Connection timed out
Aug 28 22:48:45 fab-HP-Compaq-Pro-6300-SFF postfix/smtp[12828]: connect to mx3.hotmail.com[65.55.37.104]:25: Connection timed out
Aug 28 22:48:45 fab-HP-Compaq-Pro-6300-SFF postfix/smtp[12829]: E8F271640C2E: to=<[email protected]>, relay=none, delay=739, delays=588/0.05/150/0, dsn=4.4.1, status=deferred (connect to mx3.hotmail.com[65.55.37.88]:25: Connection timed out)
Aug 28 22:48:45 fab-HP-Compaq-Pro-6300-SFF postfix/smtp[12828]: CBF081640C42: to=<[email protected]>, relay=none, delay=523, delays=373/0.12/150/0, dsn=4.4.1, status=deferred (connect to mx3.hotmail.com[65.55.37.104]:25: Connection timed out)

Re: Nagios do not send Notification Emails

Posted: Wed Aug 28, 2013 9:35 am
by abrist
Well, your connection to your mail server is (obviously) timing out. Are you sure your mail server does not require smtp authentication, or forcing use of an encrypted connection?

Re: Nagios do not send Notification Emails

Posted: Fri Aug 30, 2013 6:56 am
by BAK
I fixed the problem changing host name /etc/hostname and /etc/hosts with a shorter name, and now it works; anyway i changed the destination mail, in gmail 'couse hotmail blocks everything.

I have another question, it's possible to mark as UP(but in yellow) an host that has a ping time beyond a choosen threshold?

Re: Nagios do not send Notification Emails

Posted: Fri Aug 30, 2013 10:41 am
by sreinhardt
Not without modifying the cgi source, and this would likely alter for all OK\warning states not just ping. I would not likely suggest this.

Re: Nagios do not send Notification Emails

Posted: Mon Sep 02, 2013 4:01 am
by BAK
I'm trying to monitoring the HTTP response time, but with

Code: Select all

check_command           check_http!192.168.120.1!5!8
Nagios service:
HTTP OK: HTTP/1.1 200 OK - 715 bytes in 0,001 second response time

but 192.168.120.1 is down!

am i using the wrong plugin for the HTTP response?

Re: Nagios do not send Notification Emails

Posted: Tue Sep 03, 2013 10:58 am
by slansing
What about "192.168.120.1" is down? The entire server? Can you show us how you have the check_http command defined in your commands.cfg?