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.
mamir
Posts: 62
Joined: Tue Mar 12, 2019 9:50 am

Setup Postfix on my Nagios Xi for sending the alerts

Post by mamir »

Hello Support,

I have setup up my Nagios Xi, however sending out alerts, don't want to use my internal SMTP instead want to see if there is an option such as postfix which can be setup/installed/configured for sending out the alerts etc with in the Nagios Xi application itself.

Please, assist me with it, step by step instruction, since my NagiosXi is setup on a different network, therefore don't have an SMTP available on that network & as per our security can't use any outside SMTP providers. Therefore, option such as Postfix or even something else within NagiosXi application to setup for SMTP alerting / in order to get the alerts.

Please, assist here.
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

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

Post by benjaminsmith »

Hi @mamir,

Please take a look a the guide below as it explains this well. You can use either the default MTA installed on the Linux server ( usually Sendmail or Postfix) or an external SMTP server.

Understanding Email Sending

Please take a look and let me know if you have additional questions.
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!
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 »

Thanks support for reply.

Yea, I need to know the steps, how to setup the POSTFix option to sendout the alerts to our email addresses, & not using an internal or external SMTP server. This guide only explains about POSTFix, but I need to know how to set it up please, step by step. Please assist. Thanks much!
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

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

Post by benjaminsmith »

Hi @mamir,

Can you PM your system profile? I'd like to review your mail commands, operating system and general setup. Additionally, can you send me the output of the following commands:

Code: Select all

which mail
alternatives --display mta
To send us your system profile.
Login to the Nagios XI GUI using a web browser.
Click the "Admin" > "System Profile" Menu
Click the "Download Profile" button
Save the profile.zip file and share in a private message or upload it to the post/ticket.

General Guideline:
1. In Admin > Email Settings, you'll want to select the Sendmail option instead of SMTP. This will setup notifications to use the default Mail Transport Agent (MTA) installed on the server. In your case, this is Postfix.
sendmail.png
2. Install and configure Postfix on your server.

3. Configure the notification commands to use the correct mail commands. If your the mail command is /bin/mail. The notify-host-by-email command would be as follows:

Code: Select all

/usr/bin/printf "%b" "***** Nagios Monitor XI Alert *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
You do not have the required permissions to view the files attached to this post.
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!
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 »

[root@localhost ~]# which mail
/usr/bin/mail
[root@localhost ~]# 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.
[root@localhost ~]#
[root@localhost ~]# [root@localhost ~]# alternatives --display mta
Current `best' version is /usr/sbin/sendmail.postfix.
-bash: [root@localhost: command not found
[root@localhost ~]# mta - status is auto.
-bash: mta: command not found
[root@localhost ~]# link currently points to /usr/sbin/sendmail.postfix
link: extra operand ‘to’
Try 'link --help' for more information.
[root@localhost ~]# /usr/sbin/sendmail.postfix - priority 30
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

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

Post by benjaminsmith »

Hi @mamir,

I noticed that your have some corrupt database tables, please run repair script as root from the terminal.

Code: Select all

/usr/local/nagiosxi/scripts/repair_databases.sh
This is a pretty typical setup. You should just be able to chose the Sendmail option and then try testing it with the Send A Test Email button (check the spam folder).

Also, please try testing this with a different email address. It looks like the Nagios XI server is not able to find the host for your email address.
Jun 17 14:50:44 localhost postfix/smtp[46593]: 37D811E1288: to=<mamir@actionet.com>, relay=none, delay=4568, delays=4548/0.02/20/0, dsn=4.4.3, status=deferred (Host or domain name not found. Name service error for name=actionet.com type=MX: Host not found, try again)
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!
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 »

Hi Support,
I have ran: /usr/local/nagiosxi/scripts/repair_databases.sh that had fixed some corrupted tables, that's done.

Next, just for testing purposes, I changed the email to my personal Gmail account for testing email purpose. I'm getting the below messages.
You do not have the required permissions to view the files attached to this post.
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 believe in my last screen shot, I'm not doing it correctly, as I'm using my internal SMTP server for it. But the idea is to be able to use the Postfix option instead by using the Nagios Xi server as Postfix to have the ability to send out the alerts.

Please, let me know the exact steps, how do I do it from Nagios Xi, as I will use this Postfix method for getting the alerts instead of an internal SMTP.
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 »

If you want to send the emails directly from the Nagios server and not forward them to an SMTP server, then you will have to get your server registered on the internet with a valid IP address so the other email servers on the internet that is receiving the emails, will not block it.
You will also need a registered host name and domain name to do this as well and a MX record setup in DNS.

You can contact your local internet provider to help you set this up.


If you do have access to relay emails from the Nagios server to an SMTP server, here is a link on how to setup relaying in postfix.
http://www.postfix.org/SASL_README.html
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 »

By the way, currently, since this is a new install of Nagios Xi, do I need to anything to first setup Postfix on the Nagios Xi to make the NagiosXi to send out email alerts? Because currently there is nothing setup for Postfix or installed.
Locked