Setup Postfix on my Nagios Xi for sending the alerts

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Setup Postfix on my Nagios Xi for sending the alerts

Post by tgriep »

In the XI GUI, go to the Admin > Email Settings menu and set the Send Method to Sendmail and save the changes.

That will tell Nagios to use the local mailer daemon.

I took a look at the profile you sent in 3 days ago, it looks like the postfix daemon is installed and running on the server so it should be there.

Run this as root to see if the daemon is running

Code: Select all

systemctl status postfix
To troubleshoot the sending of emails using the postfix daemon, look at the /var/log/maillog file.
In there you will see the errors on why the server cannot send emails.
Be sure to check out our Knowledgebase for helpful articles and solutions!
mamir
Posts: 62
Joined: Tue Mar 12, 2019 9:50 am

Re: Setup Postfix on my Nagios Xi for sending the alerts

Post by mamir »

Hello Support,

I was sending to a Gmail account, this was just for testing purposes to check if I receive an email or not. I actually need to have my Nagios Xi be sending alerts to our company domain email address, however currently it is blocked, until I tell my IT team to allow. However before I reach out to my IT team, I wanted to check/test to send to a personal email address. I want to check/confirm, is there anything need to be installed/configured on Nagios Xi, meaning how do I make my Nagios Xi as Postfix work as an SMTP email server as well? Please assist.
mamir
Posts: 62
Joined: Tue Mar 12, 2019 9:50 am

Re: Setup Postfix on my Nagios Xi for sending the alerts

Post by mamir »

Ok, sorry. I didn't see your last post, before I replied. Here are the results. I have changed the Emails settings menu and send method to sendmail method. For send from currently, I have the IP Address of Nagios Xi, do I need to change it to something else?

Below are the results, when I run the command: systemctl status postfix

Please see results below.

[root@localhost ~]# systemctl status postfix
● postfix.service - Postfix Mail Transport Agent
Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor pres et: disabled)
Active: active (running) since Thu 2019-06-20 10:42:44 EDT; 4h 36min ago
Process: 6286 ExecStart=/usr/sbin/postfix start (code=exited, status=0/SUCCESS )
Process: 6280 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, st atus=0/SUCCESS)
Process: 6203 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status =0/SUCCESS)
Main PID: 6959 (master)
CGroup: /system.slice/postfix.service
├─ 6959 /usr/libexec/postfix/master -w
├─ 6974 qmgr -l -t unix -u
├─19721 pickup -l -t unix -u
├─45524 cleanup -z -t unix -u
├─45525 trivial-rewrite -n rewrite -t unix -u
├─45526 smtp -t unix -u
├─45529 smtp -t unix -u
├─45593 smtp -t unix -u
└─45609 bounce -z -n defer -t unix -u

Jun 20 15:17:41 localhost.localdomain postfix/pickup[19721]: 25A591E134E: uid...
Jun 20 15:17:41 localhost.localdomain postfix/cleanup[45524]: 25A591E134E: me...
Jun 20 15:17:41 localhost.localdomain postfix/qmgr[6974]: 25A591E134E: from=<...
Jun 20 15:17:41 localhost.localdomain postfix/pickup[19721]: 2EC391E134F: uid...
Jun 20 15:17:41 localhost.localdomain postfix/cleanup[45524]: 2EC391E134F: me...
Jun 20 15:17:41 localhost.localdomain postfix/qmgr[6974]: 2EC391E134F: from=<...
Jun 20 15:17:46 localhost.localdomain postfix/qmgr[6974]: 1E34D1E1349: from=<...
Jun 20 15:18:01 localhost.localdomain postfix/smtp[45526]: 25A591E134E: to=<m...
Jun 20 15:18:01 localhost.localdomain postfix/smtp[45529]: 2EC391E134F: to=<m...
Jun 20 15:18:06 localhost.localdomain postfix/smtp[45593]: 1E34D1E1349: to=<m...
Hint: Some lines were ellipsized, use -l to show in full.

The logs under /usr/local/nagiosxi/tmp/phpmailer.log states as below mail sent & nothing else.

Also the log states: [06-20-2019 15:12:20] Message sent! (method=sendmail), Referer: admin/testemail.php
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Setup Postfix on my Nagios Xi for sending the alerts

Post by tgriep »

Simply put, a SMTP server is a Sendmail or Postfix server that allows inbound emails from other email servers.
It is a little more than that.

The simplest thing to do it to talk to your email admin and have them setup the corporate email system to allow the Nagios server to relay emails.
Then, change the Send Method in XI to use the corporate SMTP server.

When the Send Method is set to Sendmail, it ignores the IP address in the SMTP field so it does not matter what is in there.

The log entry from the phpmailer.log files shows that XI send the email to the postfix daemon and it accepted it.
From what I have seen, postfix is setup to receive emails from the local server and the message shows that to be true.
Now, you need to look at the /var/log/maillog for the errors on which servers are blocking the Nagios server from sending emails.
Bring them to your IT Department and have them help you resolve them.
Be sure to check out our Knowledgebase for helpful articles and solutions!
mamir
Posts: 62
Joined: Tue Mar 12, 2019 9:50 am

Re: Setup Postfix on my Nagios Xi for sending the alerts

Post by mamir »

Please, see the attachment, so Send Mail From: (What do I put here)? Please, let me know to be using the Postfix.
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: Setup Postfix on my Nagios Xi for sending the alerts

Post by tgriep »

What most people do is to ask the email admin to setup a special email address on the corporate email server and then you would use that in the From Field.
Be sure to check out our Knowledgebase for helpful articles and solutions!
mamir
Posts: 62
Joined: Tue Mar 12, 2019 9:50 am

Re: Setup Postfix on my Nagios Xi for sending the alerts

Post by mamir »

Yes, I understand. But for rightnow, I'm just checking/testing, even I used my personal gmail account as from address & sending my personal gmail email account doesn't seems to send the email. There is something wrong here. By the way, I setup this Nagios Xi as a VM template, does that makes any difference. There is some issue.
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: Setup Postfix on my Nagios Xi for sending the alerts

Post by tgriep »

What you are trying to do when you are sending to your gmail account is the Postfix daemon is trying to send directly to the gmail email servers or it is trying to use your corporate email servers to route the emails and they are blocking it.

What error are you seeing in the /var/log/maillog file?

Do you want to setup the Postfix daemon to use the gmail smtp servers to relay emails through them?
If so, look at this article.
https://www.howtoforge.com/tutorial/con ... ail-relay/
Be sure to check out our Knowledgebase for helpful articles and solutions!
mamir
Posts: 62
Joined: Tue Mar 12, 2019 9:50 am

Re: Setup Postfix on my Nagios Xi for sending the alerts

Post by mamir »

Hello Support,

For now, I'm just trying to test to see if the "Send Mail" feature can work in order to send alerts. I do understand, that work sending to our company email, it is blocking it & I will have to ask our Email Admins to allow from this server, but before I reach out to them. I would like to check if my Nagios server can even send emails to an email using the "Send Mail" feature, because idea is too not use any SMTP server weather it is internal or external, I would like to only use the "Send Mail" feature & no SMTP. Therefore, when I try to send to my personal Gmail, I was under the impression it will send directly to my Gmail & doesn't need to involve my internal SMTP.

By the way, when I do try to send it says email has successfully sent, but the logs under /var/log/mailog file says the following below, whats the issue here below?

Jun 21 09:45:22 localhost postfix/smtp[36668]: DC8C21E13EE: to=<coolguy22193@gmail.com>, relay=none, delay=20, delays=0.02/0.01/20/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=gmail.com type=MX: Host not found, try again)
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Setup Postfix on my Nagios Xi for sending the alerts

Post by scottwilkerson »

This looks like your system cannot resolve the domain gmail.com

Do you have name server setup?

Code: Select all

cat /etc/resolv.conf
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked