Page 1 of 3

Not getting Email alerts

Posted: Thu Nov 29, 2018 12:17 pm
by shamrozkadiwal
I have setup a "Disk Space Data" alert for a specific hosts which is supposed to send email alerts for W,C,U and SMS alerts just only for C. SMS alert is working like charm, but we are not getting email alerts. However, I compared the configuration with other hosts which are sending email alerts, and didn't find any errors or differences.

I have attached the doc which can give you host and service details.

Sample Server: adx800
Issuer Server: adxp011a

W = warning
C = Critical
U = Unknown

Re: Not getting Email alerts

Posted: Thu Nov 29, 2018 3:57 pm
by benjaminsmith
Hello @shamrozkadiwal

Let's verify that you are able to send and receive a custom service notification for the Disk Space Data service. From the Nagios Core homepage go to Services > Find the adxp011a server > click on Disk Space Data > Send Custom Service Notification. Let me know if this is working or not.

Can you send over the contact/contact group definitions, and the definition for the generic-data host template. Also are there any error messages in the mail log for errors /var/log/maillog. Thank you.

Re: Not getting Email alerts

Posted: Mon Dec 03, 2018 10:26 am
by shamrozkadiwal
Hey Benjamin,

You asked me couple of things. First, I have attached the contact.cfg file and paste generic-data host template.

Code: Select all

# TEMPLATE
define host{
        name                    generic-data
        hostgroups              data-servers
        check_command           check-host-alive
        check_period            24x7
        max_check_attempts      10
        notification_options    d,u,r
        notification_interval   90
        notification_period     no-sun
        parents                 aus-fwv-wh-5540a
        contact_groups          ets-pager
        register                0
}
Second, I tried Custom Service Notification and it worked. I mean I received the email [Picture attached]. However, If you noticed that I sent another picture of my inbox which indicates that I had never received adxp011a alert email before , so It means email part is working when we commit service notification.

In addition, I didn't find any errors in the /var/log/maillog, but I found few records after I ran the Custom Service Notification with no errors.

Thanks,

Re: Not getting Email alerts

Posted: Mon Dec 03, 2018 2:41 pm
by benjaminsmith
Hello @shamrozkadiwal,

To summarize:

1. You receive the correct SMS notifications for disk space data on adxp011a
2. You are not receiving the correct email notification for disk space data on adxp011a.
3. You are able to send a Customer Service Notification, so email is working.

There's an error somewhere in the configuration definitions. For the hostgroup, data-servers, can you verify the notification period is correct? You have no-sun set, but the generic-contact template is set for 24x7 notification period. Also, take a look at the generic-data template for any issues.

Re: Not getting Email alerts

Posted: Tue Dec 04, 2018 11:45 am
by shamrozkadiwal
1. You receive the correct SMS notifications for disk space data on adxp011a YES
2. You are not receiving the correct email notification for disk space data on adxp011a. YES
3. You are able to send a Customer Service Notification, so email is working. YES

I checked these two below files for notification setting, but found only in one file.

/etc/nagios/host/hostgroups.cfg

Code: Select all

define hostgroup{
        hostgroup_name  data-servers
        alias           Data Servers
}
/etc/nagios/host/data.cfg

Code: Select all

# TEMPLATE
define host{
        name                    generic-data
        hostgroups              data-servers
        check_command           check-host-alive
        check_period            24x7
        max_check_attempts      10
        notification_options    d,u,r
        notification_interval   90
        notification_period     no-sun
        parents                 aus-fwv-wh-5540a
        contact_groups          ets-pager
        register                0
}
I don't see any errors or issue, but not sure why we are not getting emails for adxp011a. Whereas sample server (adx800) has the same setting, host and service groups and it is getting all kind of alerts.

Re: Not getting Email alerts

Posted: Tue Dec 04, 2018 2:49 pm
by benjaminsmith
Please verify your configuration by running the following command and post any errors or warning messages:

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
You have 3 different service definitions for Disk Space Data, and this can be problematic as no two services associated with the same host can have the same description. Services are uniquely identified with their host_name and service_description directives.
https://assets.nagios.com/downloads/nag ... ml#service

Re: Not getting Email alerts

Posted: Wed Dec 05, 2018 12:59 pm
by shamrozkadiwal
Please find the attached file

Re: Not getting Email alerts

Posted: Wed Dec 05, 2018 3:48 pm
by benjaminsmith
Hello shamrozkadiwal,

Let's change the debug level settings to capture notification data, and then put adxp011a into a down state and then back up (recovery state). We will then take a look at the log file for this host and review the state changes and whether or not notifications were sent.

1. Open up the nagios configuration file /usr/local/nagios/etc/nagios.cfg, and set debug_level=32, and then re-start Nagios.

2. Put the adxpo11a into a down state and then a recovery.

2. Post or PM the nagios log data or the contents of the log file at /usr/local/nagios/var
nagios.log
. You'll want to search the log data for host notification entries for adxp011a. The perl statement at the end will convert the unix timestamp into human readable text. Are notifications beings sent? If so, to the correct contacts?

Code: Select all

cat nagios.log | grep adxp011a  |  perl -pe 's/(\d+)/localtime($1)/e'
Let me know what you find out.

Main Configuration File Options
https://assets.nagios.com/downloads/nag ... gmain.html

Re: Not getting Email alerts

Posted: Wed Dec 05, 2018 4:47 pm
by lmiltchev
@shamrozkadiwal, can you zip up the /usr/local/nagios directory and PM the zip file to me or any other member of the Nagios Support team? Thank you!

Re: Not getting Email alerts

Posted: Fri Dec 07, 2018 12:16 pm
by shamrozkadiwal
lmiltchev wrote:@shamrozkadiwal, can you zip up the /usr/local/nagios directory and PM the zip file to me or any other member of the Nagios Support team? Thank you!
Please check your inbox