not getting email notification

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.
CapitanG
Posts: 9
Joined: Mon May 21, 2018 2:09 pm

not getting email notification

Post 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.
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: not getting email notification

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
CapitanG
Posts: 9
Joined: Mon May 21, 2018 2:09 pm

Re: not getting email notification

Post 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.
Attachments
maillog.png
windows.cfg
(4.37 KiB) Downloaded 192 times
contacts.cfg
(2.14 KiB) Downloaded 193 times
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: not getting email notification

Post 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.
Attachments
nagios-notificaitons.png
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
seliimgnc
Posts: 14
Joined: Mon Mar 18, 2019 8:43 am

Re: not getting email notification

Post 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. xxxxx@mydomain.com.tr ( this is sender mail address) and yyyyy@mydomain.com ( 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.
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: not getting email notification

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
seliimgnc
Posts: 14
Joined: Mon Mar 18, 2019 8:43 am

Re: not getting email notification

Post 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.
seliimgnc
Posts: 14
Joined: Mon Mar 18, 2019 8:43 am

Re: not getting email notification

Post 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$ **"
}
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: not getting email notification

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
CapitanG
Posts: 9
Joined: Mon May 21, 2018 2:09 pm

Re: not getting email notification

Post by CapitanG »

I go to /usr/local/Nagios- but there is no nagio.log file !
Locked