Page 1 of 2

not getting email notification

Posted: Tue Mar 19, 2019 3:12 pm
by CapitanG
Hi,I have built a new CentOS 7 server, installed the latest version 4.4.3 of Nagios core and added one Windows 2016 server to be monitored.
When I go to the nagios web interface I can see the test server with the services I have configured, but when I power off the Windows server I don't get an email notifying me the server id down. I have added my email address in the contacts.cfg.
Please help I don't know what am I missing. I keep checking and researching on the Internet but I get no luck.

Re: not getting email notification

Posted: Tue Mar 19, 2019 4:24 pm
by benjaminsmith
Hello @CaptainG,

Take a look at the object definition to make sure all the settings are correct or you can post the contact and service definition for us to review.

Nagios Core Object Definitions

Assuming that is configured correctly, try sending a custom notification from the web interface and check your mail log, /var/log/maillog, for errors.

Re: not getting email notification

Posted: Wed Mar 20, 2019 9:14 am
by CapitanG
I have attached the contacts and windows.cfg and capture of maillog. To answer "...try sending a custom notification from the web interface and check your mail log" I don't know how to do this. I went to the web interface but I don't see any link for email. Thank you for your help.

Re: not getting email notification

Posted: Thu Mar 21, 2019 2:45 pm
by benjaminsmith
Hello @CaptainG,

Thanks for sending the configuration files over, it looks ok. By the way, I assuming you took removed the ip address for TEST2016B for security.

1. Have you run the pre-flight check on the configuration to verify everything is ok:

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
The windows server template is set to notify on down and recovery ( notification_options d,r ) so if you power it off it will be in a unreachable state but you should get a notification on the recovery.

You can try adjusting the check command to force the host in a down state. You'll find the check command in commands.cfg. The host check utilizes check ping.

2. Verify if a notification was sent for the host
You can see if Nagios tried to send a notification in log file ( /usr/local/nagios/nagios.log ) or take a look at the reports available in the web interface ( see attached image).

3. If the notification was sent but you did not receive it, then there's a mail settings issue here, and review the mail log on your system for errors.

Re: not getting email notification

Posted: Wed Apr 03, 2019 6:14 am
by seliimgnc
Hi,

I have Nagios Core 4.4.2 . I want to receive mail to my mail adress . I follow the steps in this sites : https://www.smsk.biz/nagios-use-an-exte ... fications/

But i can' t receive the mail notification . I have 2 mail adress. [email protected] ( this is sender mail address) and [email protected] ( this is my receiver mail adress ) .

Please help me Why can't I get receive mail notification ? If you want my .cfg file, I can share this files with you.

Re: not getting email notification

Posted: Wed Apr 03, 2019 11:53 am
by benjaminsmith
Hi @seliimgnc,

Are you using sendmail or an external SMTP server for mail delivery? Can you send a test message using sendmail from the command line?

Can you tail the mail log and post the output for us to review?

Code: Select all

tail /var/log/maillog
Lastly, can you post your notificaiton commands for notify-host-by-email and notify-service-by-email. This should be in /usr/local/nagios/etc/objects/commands.cfg. Thanks.

Re: not getting email notification

Posted: Mon Apr 08, 2019 8:37 am
by seliimgnc
benjaminsmith wrote:Hi @seliimgnc,

Are you using sendmail or an external SMTP server for mail delivery? Can you send a test message using sendmail from the command line?

Can you tail the mail log and post the output for us to review?

Code: Select all

tail /var/log/maillog
Lastly, can you post your notificaiton commands for notify-host-by-email and notify-service-by-email. This should be in /usr/local/nagios/etc/objects/commands.cfg. Thanks.
Hi, I' ve tried send a test mail but I saw this error:
sendEmail -vt < /usr/local/nagios/mail.txt
Apr 08 16:29:22 ubuntu sendEmail[44758]: ERROR => You must specify a 'from' field! Try --help.

Re: not getting email notification

Posted: Mon Apr 08, 2019 8:40 am
by seliimgnc
benjaminsmith wrote:Hi @seliimgnc,

Are you using sendmail or an external SMTP server for mail delivery? Can you send a test message using sendmail from the command line?

Can you tail the mail log and post the output for us to review?

Code: Select all

tail /var/log/maillog
Lastly, can you post your notificaiton commands for notify-host-by-email and notify-service-by-email. This should be in /usr/local/nagios/etc/objects/commands.cfg. Thanks.
Also you can see my commands.cfg :

# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b%b%b%b%b%b%b" \
"***** Nagios *****\n\n" \
"Notification Type: $NOTIFICATIONTYPE$\n" \
"Host: $HOSTNAME$\n" \
"State: $HOSTSTATE$\n" \
"Address: $HOSTADDRESS$\n" \
"Info: $HOSTOUTPUT$\n\n" \
"Date/Time: $LONGDATETIME$\n" \
| /usr/bin/sendemail -s $USER7$ \
-l /var/log/sendemail \
-f $USER5$ \
-t $CONTACTEMAIL$ \
-u "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **"
}

# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b%b%b%b%b%b%b%b%b" \
"***** Nagios *****\n\n" \
"Notification Type: $NOTIFICATIONTYPE$\n\n" \
"Service: $SERVICEDESC$\n" \
"Host: $HOSTALIAS$\n" \
"Address: $HOSTADDRESS$\n" \
"State: $SERVICESTATE$\n\n" \
"Date/Time: $LONGDATETIME$\n\n" \
"Additional Info:\n\n" \
"$SERVICEOUTPUT$" \
| /usr/bin/sendemail -s $USER7$ \
-l /var/log/sendemail \
-f $USER5$ \
-t $CONTACTEMAIL$ \
-u "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **"
}

Re: not getting email notification

Posted: Mon Apr 08, 2019 3:30 pm
by tgriep
@CapitanG, let us know if you have any further questions for this post.

@seliimgnc, if you login the Nagios web interface, and go the Process Info menu, are Notifications enabled?
If you go to the Reports > Notification menu, is the system trying to send the notifications to a contact?
Do you see any errors or entries in this log file?

Code: Select all

/var/log/sendemail

Re: not getting email notification

Posted: Mon Apr 08, 2019 4:49 pm
by CapitanG
I go to /usr/local/Nagios- but there is no nagio.log file !