Nagios do not send Notification Emails

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
BAK
Posts: 12
Joined: Thu Jul 04, 2013 6:34 am

Nagios do not send Notification Emails

Post 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.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Nagios do not send Notification Emails

Post 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?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
BAK
Posts: 12
Joined: Thu Jul 04, 2013 6:34 am

Re: Nagios do not send Notification Emails

Post 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$
        }
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios do not send Notification Emails

Post 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 
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
BAK
Posts: 12
Joined: Thu Jul 04, 2013 6:34 am

Re: Nagios do not send Notification Emails

Post 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)
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios do not send Notification Emails

Post 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?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
BAK
Posts: 12
Joined: Thu Jul 04, 2013 6:34 am

Re: Nagios do not send Notification Emails

Post 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?
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Nagios do not send Notification Emails

Post 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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
BAK
Posts: 12
Joined: Thu Jul 04, 2013 6:34 am

Re: Nagios do not send Notification Emails

Post 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?
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Nagios do not send Notification Emails

Post 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?
Locked