Notifications not sending when host goes down

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
vbra088
Posts: 7
Joined: Fri Mar 15, 2019 10:42 am

Notifications not sending when host goes down

Post by vbra088 »

Hey guys, new here..

I got NagiosXI trial going to see if I like it. I'm used to using Nagios Core with NConf so this is all pretty awesome imo.

I got SMS and SMTP all set up and everything. Running tests work well. I get both texts and emails tests.
When I configured hosts, I set it to notify everyone listed immediately.

I enabled notifications in my profile and selected every checkbox for notifications.

For some reason, when a host goes down and it gets to max attempts, no notifications go out. I tried doing a force custom notification and still had no luck.

Looking at logs from /var/log/mailog I have this:

Code: Select all

Apr 19 10:47:04 localhost postfix/smtp[47151]: C1D4F1E120E: to=<MYEMAIL@MYDOMAIN.com>, relay=none, delay=78362, delays=78271/0.04/90/0, dsn=4.4.1, status=deferred (connect to MYDOMAIN.com[172.21.1.15]:25: Connection timed out)
Apr 19 11:10:34 localhost postfix/qmgr[6456]: 9886C1E12A3: from=<root@localhost.localdomain>, size=946, nrcpt=1 (queue active)
Apr 19 11:11:04 localhost postfix/smtp[57744]: connect to MYDOMAIN.com[172.21.1.17]:25: Connection timed out
Apr 19 11:11:34 localhost postfix/smtp[57744]: connect to MYDOMAIN.com[172.20.5.16]:25: Connection timed out
Apr 19 11:11:34 localhost postfix/smtp[57744]: connect to MYDOMAIN.com[69.16.254.0]:25: Connection refused
Apr 19 11:12:04 localhost postfix/smtp[57744]: connect to MYDOMAIN.com[172.21.1.15]:25: Connection timed out
Apr 19 11:12:34 localhost postfix/smtp[57744]: connect to MYDOMAIN.com[172.21.1.0]:25: Connection timed out
Apr 19 11:12:34 localhost postfix/smtp[57744]: 9886C1E12A3: to=<MYEMAIL@MYDOMAIN.com>, relay=none, delay=73440, delays=73320/0.04/120/0, dsn=4.4.1, status=deferred (connect to MYDOMAIN.com[172.21.1.0]:25: Connection timed out)
Apr 19 11:15:34 localhost postfix/qmgr[6456]: 95D4C1E10DE: from=<nagios@localhost.localdomain>, size=689, nrcpt=1 (queue active)
Apr 19 11:15:34 localhost postfix/qmgr[6456]: 836781E12AE: from=<nagios@localhost.localdomain>, size=681, nrcpt=1 (queue active)
Apr 19 11:15:34 localhost postfix/qmgr[6456]: BF6BA1E1044: from=<root@localhost.localdomain>, size=946, nrcpt=1 (queue active)
Apr 19 11:16:04 localhost postfix/smtp[59644]: connect to MYDOMAIN.com[172.20.5.16]:25: Connection timed out
Apr 19 11:16:04 localhost postfix/smtp[59645]: connect to MYDOMAIN.com[172.20.1.0]:25: Connection timed out
Apr 19 11:16:04 localhost postfix/smtp[59646]: connect to MYDOMAIN.com[172.21.1.15]:25: Connection timed out
Apr 19 11:16:04 localhost postfix/smtp[59645]: connect to MYDOMAIN.com[69.16.254.0]:25: Connection refused
Apr 19 11:16:34 localhost postfix/smtp[59644]: connect to MYDOMAIN.com[172.21.1.17]:25: Connection timed out
Apr 19 11:16:34 localhost postfix/smtp[59646]: connect to MYDOMAIN.com[172.20.5.16]:25: Connection timed out
Apr 19 11:16:34 localhost postfix/smtp[59645]: connect to MYDOMAIN.com[172.20.5.16]:25: Connection timed out
Apr 19 11:17:04 localhost postfix/smtp[59644]: connect to MYDOMAIN.com[172.21.1.0]:25: Connection timed out
Apr 19 11:17:04 localhost postfix/smtp[59646]: connect to MYDOMAIN.com[172.21.1.0]:25: Connection timed out
Apr 19 11:17:04 localhost postfix/smtp[59645]: connect to MYDOMAIN.com[172.21.1.17]:25: Connection timed out
Apr 19 11:17:34 localhost postfix/smtp[59644]: connect to MYDOMAIN.com[172.20.1.0]:25: Connection timed out
Apr 19 11:17:34 localhost postfix/smtp[59644]: connect to MYDOMAIN.com[172.20.5.15]:25: Connection refused
Apr 19 11:17:34 localhost postfix/smtp[59644]: 95D4C1E10DE: to=<MYEMAIL@MYDOMAIN.com>, relay=none, delay=69725, delays=69605/0.04/120/0, dsn=4.4.1, status=deferred (connect to MYDOMAIN.com[172.20.5.15]:25: Connection refused)
Apr 19 11:17:34 localhost postfix/smtp[59646]: connect to MYDOMAIN.com[172.21.1.17]:25: Connection timed out
Apr 19 11:17:34 localhost postfix/smtp[59645]: connect to MYDOMAIN.com[172.21.1.15]:25: Connection timed out
Apr 19 11:17:34 localhost postfix/smtp[59645]: 836781E12AE: to=<MYEMAIL@MYDOMAIN.com>, relay=none, delay=69725, delays=69605/0.04/120/0, dsn=4.4.1, status=deferred (connect to MYDOMAIN.com[172.21.1.15]:25: Connection timed out)
Apr 19 11:18:04 localhost postfix/smtp[59646]: connect to MYDOMAIN.com[172.20.5.18]:25: Connection timed out
Apr 19 11:18:04 localhost postfix/smtp[59646]: BF6BA1E1044: to=<MYEMAIL@MYDOMAIN.com>, relay=none, delay=74219, delays=74069/0.05/150/0, dsn=4.4.1, status=deferred (connect to MYDOMAIN.com[172.20.5.18]:25: Connection timed out)
Apr 19 11:19:13 localhost postfix/pickup[30365]: 9F49C1E12DD: uid=1000 from=<nagios>
I changed my email and domain name for privacy. Let me know if theres something I'm missing. :D
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Notifications not sending when host goes down

Post by tgriep »

The email settings on the server is setup to you the local postfix daemon and that daemon it trying to figure out which SMTP server to send to and all of the servers it tries to send to are refusing the connection or blocking it causing the timeout message.

I suggest that if you have access to a SMTP server, set up the Nagios server to use that to relay the emails through.
The following document has instructions for setting up the Nagios server to use a SMTP server.
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Be sure to check out our Knowledgebase for helpful articles and solutions!
vbra088
Posts: 7
Joined: Fri Mar 15, 2019 10:42 am

Re: Notifications not sending when host goes down

Post by vbra088 »

Thanks for the response.

I already have an SMTP server set up. I added my SMTP server by IP address with the authentication details and it looks like it's working fine when running tests. Still doesn't send notification emails when a host goes down.

The reason why I used IP is because another discussion I saw on here mentioned that it fixed some issues. If that matters?
vbra088
Posts: 7
Joined: Fri Mar 15, 2019 10:42 am

Re: Notifications not sending when host goes down

Post by vbra088 »

Here's a screenshot of the configuration settings.
You do not have the required permissions to view the files attached to this post.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Notifications not sending when host goes down

Post by tgriep »

Go back to the Admin > Manage Email Settings menu and check the bot to enable Logging.
Then check the PHPMailer log file for ant errors when a Notification is sent.

Code: Select all

/usr/local/nagiosxi/tmp/phpmailer.log
If you do not see an error and the message was sent, them you will have to have some one look at the server at IP address 172.20.5.75 to see it it blocked it or is filtering it.

As long as the hostname is resolvable, you can use the hostname but the IP address is OK to use as well.
Be sure to check out our Knowledgebase for helpful articles and solutions!
vbra088
Posts: 7
Joined: Fri Mar 15, 2019 10:42 am

Re: Notifications not sending when host goes down

Post by vbra088 »

I enabled logging and sent a few test notifications out. It looks like those are showing up in the logs but not actual host notifications.

I took some hosts down as a test and it looks like it is still not sending anything out. I have a feeling it's something to do with host config but I have no idea what it could be. Notifications are set and enabled. Everything is checked.

Here's what that log is showing:

Code: Select all

[04-22-2019 07:47:24] Message sent! (method=smtp;host=172.20.5.75;port=25;smtpauth=true;security=none), Referer: admin/testemail.php
[04-22-2019 07:56:04] Message sent! (method=smtp;host=172.20.5.75;port=25;smtpauth=true;security=none), Referer: account/testnotification.php > PHPmailer Test
[04-22-2019 07:56:04] Message sent! (method=smtp;host=172.20.5.75;port=25;smtpauth=true;security=none), Referer: account/testnotification.php > Mobile Test

And here is one of the configs:

Code: Select all

###############################################################################
#
# Hosts configuration file
#
# Created by: Nagios CCM 3.0.0
# Date:       2019-04-22 08:59:54
# Version:    Nagios Core 4.x
#
# --- DO NOT EDIT THIS FILE BY HAND --- 
# Nagios CCM will overwrite all manual settings during the next update if you 
# would like to edit files manually, place them in the 'static' directory or 
# import your configs into the CCM by placing them in the 'import' directory.
#
###############################################################################

define host {
    host_name                   172.20.135.1
    use                         xiwizard_genericnetdevice_host
    alias                       MBA-Test
    display_name                MBA-Test
    address                     172.20.135.1
    max_check_attempts          1
    check_interval              1
    retry_interval              1
    check_period                xi_timeperiod_24x7
    contacts                    nagiosadmin,vbra088,xi_default_contact
    contact_groups              admins,xi_contactgroup_all
    notification_interval       2
    notification_period         xi_timeperiod_24x7
    first_notification_delay    0
    notifications_enabled       1
    icon_image                  network_node.png
    statusmap_image             network_node.png
    _xiwizard                   genericnetdevice
    register                    1
}

###############################################################################
#
# Hosts configuration file
#
# END OF FILE
#
###############################################################################
If it makes any difference, I installed nagios from the latest ova file. Maybe I'll need to get myself a fresh copy of Nagios XI?
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Notifications not sending when host goes down

Post by tgriep »

Your running XI version 5.6.0, correct?

Try installing this php module on the server by running the following as root.

Code: Select all

yum install php-imap -y
Then, generate another Host or Service Down and see if the Notification is in the phpmailer.log file and that the email was sent.
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Notifications not sending when host goes down

Post by tgriep »

One more thing, check the Apache error logs in the /var/log/httpd folder and the /usr/local/nagiosxi/var/eventman.log file when you run the tests to see if there are and phpmailer errors.
Post them here if you find any.
Be sure to check out our Knowledgebase for helpful articles and solutions!
vbra088
Posts: 7
Joined: Fri Mar 15, 2019 10:42 am

Re: Notifications not sending when host goes down

Post by vbra088 »

Weird thing. I still dont see any errors.

I'm running 5.6.0.
php-imap is already installed. Looks like it came with the ova image. Still no host down notifications. phpmailer.log still only shows test notifications.


Looking at the Apache error logs, I dont see anything other than checks. Nothing related to phpmailer. Event logs I see:

Code: Select all

.....................
PROCESSED 0 EVENTS
....................................
PROCESSED 0 EVENTS
....................
PROCESSED 0 EVENTS
...................
PROCESSED 0 EVENTS
........................
PROCESSED 0 EVENTS
....................
PROCESSED 0 EVENTS
....................
PROCESSED 0 EVENTS
...................
PROCESSED 0 EVENTS
.....................
PROCESSED 0 EVENTS
...................
PROCESSED 0 EVENTS
.....................
PROCESSED 0 EVENTS
..................    <p><pre>SQL Error [nagiosxi] : MySQL server has gone away</pre></p>
    <p><pre>SQL Error [nagiosxi] : MySQL server has gone away</pre></p>
    <p><pre>SQL Error [nagiosxi] : MySQL server has gone away</pre></p>
..    <p><pre>SQL Error [nagiosxi] : MySQL server has gone away</pre></p>
    <p><pre>SQL Error [nagiosxi] : MySQL server has gone away</pre></p>

PROCESSED 0 EVENTS
....................
PROCESSED 0 EVENTS
....................
PROCESSED 0 EVENTS
...................
PROCESSED 0 EVENTS
.....................
PROCESSED 0 EVENTS
....................
PROCESSED 0 EVENTS
............................
PROCESSED 0 EVENTS
....................
PROCESSED 0 EVENTS
....................
PROCESSED 0 EVENTS
....................
PROCESSED 0 EVENTS
....................
PROCESSED 0 EVENTS
....................

I'm feeling that because this is a trial version, I am not able to activate notifications. Is that true?
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Notifications not sending when host goes down

Post by tgriep »

Is the trial version expired? If so, that is the reason the Notifications are not getting generated.
When the trial expires, the server will disable sending of Notifications.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked