Nagios xi not mailing

This support forum board is for support questions relating to Nagios xi, our flagship commercial network monitoring solution.
connected

Nagios xi not mailing

Post by connected »

I've recently upgraded from Nagios xi 5.x to 5.8 and in this process had to migrate from Centos 6 to 7.
Thus got the new Centos 7 VMware image from the Nagios website and restored a backup.

Everything seems to working fine and I can also send a test mail from the Nagios GUI, but when an host goes down there is no message send (or at least not received ;) )

Where do I begin to troubleshoot this?
gsmith
Posts: 1253
Joined: Tue Mar 02, 2021 11:15 am

Re: Nagios xi not mailing

Post by gsmith »

Hi

Do you have a service or host you can play with to force a notification to be sent?

For example sometimes I set up a service for "number of users", then set the warning and critical settings at 1 and 2.
Then I log in to that server via ssh in 3 different sessions to force a critical alert. Make sure you set up the notification
for this alert to email you.

When you do that and see the alert, get the /var/log/maillog file and send it to me.

Also grab a System Profile for me:

To send us your system profile.
1. Login to the Nagios xi GUI using a web browser.
2. Click the "Admin" > "System Profile" Menu
3. Click the "Download Profile" button
4. Save the profile.zip file and share this in a private message and then reply to this post to bring it up in the queue.

Thanks
connected

Re: Nagios xi not mailing

Post by connected »

Added the files as PM.

The /var/spool/root log files is mailing as root@mydomain.lan to root@mydomain.lan.
This is wrong I suppose, but not sure how to fix this. The hostname is set via nmtui.

The testmail button works fine. Perhaps there is an additional config file that is missing some data?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Nagios xi not mailing

Post by ssax »

Your old system likely had a relayhost added to /etc/postfix/main.cf to relay properly for contacts that use notify-host-by-email and notify-service-by-email commands.

Does your SMTP server require authentication (username and password)?

if so, you can follow this:

https://devops.ionos.com/tutorials/conf ... -centos-7/

If not, you can add it to /etc/postfix/main.cf:
- Change your.mail.server and the port if necessary

Code: Select all

relayhost = [your.mail.server]:25
Then restart postfix:

Code: Select all

systemctl restart postfix
See if that resolves it.
connected

Re: Nagios xi not mailing

Post by connected »

The postfix main.cf file has it's default values.
We are just using sendmail. No SMTP.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Nagios xi not mailing

Post by ssax »

What is the output of this command?

Code: Select all

alternatives --display mta
connected

Re: Nagios xi not mailing

Post by connected »

[root@nagios ~]# alternatives --display mta
mta - status is auto.
link currently points to /usr/sbin/sendmail.postfix
/usr/sbin/sendmail.postfix - priority 30
slave mta-pam: /etc/pam.d/smtp.postfix
slave mta-mailq: /usr/bin/mailq.postfix
slave mta-newaliases: /usr/bin/newaliases.postfix
slave mta-rmail: /usr/bin/rmail.postfix
slave mta-sendmail: /usr/lib/sendmail.postfix
slave mta-mailqman: /usr/share/man/man1/mailq.postfix.1.gz
slave mta-newaliasesman: /usr/share/man/man1/newaliases.postfix.1.gz
slave mta-aliasesman: /usr/share/man/man5/aliases.postfix.5.gz
slave mta-sendmailman: /usr/share/man/man1/sendmail.postfix.1.gz
Current `best' version is /usr/sbin/sendmail.postfix.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Nagios xi not mailing

Post by ssax »

Code: Select all

link currently points to /usr/sbin/sendmail.postfix
The Admin > Email Settings > Sendmail setting will use the backend MTA which your system is showing as postfix.

If you have an SMTP server to relay through you can set it up by following this guide:

https://devops.ionos.com/tutorials/conf ... -centos-7/

Then it will work.

Do you still have access to the old system? If so, what does this show on it?

Code: Select all

alternatives --display mta
EDIT: If you do not have an SMTP relay there is a high probability that the mail servers will reject them, check /var/log/maillog to see the activity.
connected

Re: Nagios xi not mailing

Post by connected »

The old system is still accessible indeed.
The output looks quite similar.

[root@VCAMSSV24 ~]# alternatives --display mta
mta - status is auto.
link currently points to /usr/sbin/sendmail.postfix
/usr/sbin/sendmail.postfix - priority 30
slave mta-pam: /etc/pam.d/smtp.postfix
slave mta-mailq: /usr/bin/mailq.postfix
slave mta-newaliases: /usr/bin/newaliases.postfix
slave mta-rmail: /usr/bin/rmail.postfix
slave mta-sendmail: /usr/lib/sendmail.postfix
slave mta-mailqman: /usr/share/man/man1/mailq.postfix.1.gz
slave mta-newaliasesman: /usr/share/man/man1/newaliases.postfix.1.gz
slave mta-aliasesman: /usr/share/man/man5/aliases.postfix.5.gz
slave mta-sendmailman: /usr/share/man/man1/sendmail.postfix.1.gz
Current `best' version is /usr/sbin/sendmail.postfix.

Configuring Sendmail and SMTP on the GUI both works when pressing the 'Send a Test Email' button. Our spamfilters and SPF records are set up propery and allow for this to be properly received.
Except when an alert is triggered.

/etc/postfix/main.cf on the old system is also pretty default.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Nagios xi not mailing

Post by ssax »

The send a test email button will use PHPMailer, the contacts using notify-host-by-email and notify-service-by-email will not and requires the backend MTA be setup.

Please do a diff of this file from both servers, they are both setup to use postfix on the backend:

Code: Select all

/etc/postfix/main.cf
Does Admin > Email Settings have Sendmail selected on the old one as well?