How to configure a mail server to send nagios notifications

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Jessuzz94
Posts: 162
Joined: Thu Jun 04, 2015 12:08 pm

How to configure a mail server to send nagios notifications

Post by Jessuzz94 »

Im using CentOS and i want to configure postfix or sendmail to send notifications with a gmail account. Where i can find some tutorial? Thanks
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: How to configure a mail server to send nagios notificati

Post by jdalrymple »

Using Postfix or Sendmail to relay through Gmail is tricky. It's easier to just send straight to your mail relay from Nagios.

These are the appropriate instructions:

https://exchange.nagios.org/directory/A ... on/details
Jessuzz94
Posts: 162
Joined: Thu Jun 04, 2015 12:08 pm

Re: How to configure a mail server to send nagios notificati

Post by Jessuzz94 »

The tutorial said:

Code: Select all

Testing: 
Go into Nagios and send an alert and check the /var/log/sendEmail log file. It should say "Email was sent successfully". 
it means that one email account is sent to another email account?
Jessuzz94
Posts: 162
Joined: Thu Jun 04, 2015 12:08 pm

Re: How to configure a mail server to send nagios notificati

Post by Jessuzz94 »

And the notifications is sending to the email account that i putted in contacts.cfg?
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: How to configure a mail server to send nagios notificati

Post by jdalrymple »

Jessuzz94 wrote:it means that one email account is sent to another email account?
More accurately - it means that the sendEmail program sent mail to an email account.
Jessuzz94 wrote:And the notifications is sending to the email account that i putted in contacts.cfg?
That is how it's supposed to work.
Jessuzz94
Posts: 162
Joined: Thu Jun 04, 2015 12:08 pm

Re: How to configure a mail server to send nagios notificati

Post by Jessuzz94 »

Jessuzz94 wrote:And the notifications is sending to the email account that i putted in contacts.cfg?
That is how it's supposed to work.[/quote]

oviously, sorry, but, the email account that use sendemail to send to the email configured in contacts.cfg is the email configured in resource.cfg where the turorial says?:

Code: Select all

1) Edit /usr/local/nagios/etc/resource.cfg - add (3) new entries. 
$USER5$=your_isp_email_address 
$USER6$=your_isp_email_password 
$USER7$=your_isp_outgoing_mail_server 
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: How to configure a mail server to send nagios notificati

Post by jdalrymple »

The reason for the additional resource.cfg entries is because you're trying to send mail through a SMTP server such as mail.google.com or mail.yahoo.com. This will not work unless you authenticate with a valid user on those servers.
Jessuzz94
Posts: 162
Joined: Thu Jun 04, 2015 12:08 pm

Re: How to configure a mail server to send nagios notificati

Post by Jessuzz94 »

you mean a authentication like a certificate?
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: How to configure a mail server to send nagios notificati

Post by jdalrymple »

https://en.wikipedia.org/wiki/SMTP_Authentication

Very common way to prevent rogue mailers from causing spam. It's as simple as a username and a password to be allowed to send mail.

You cannot send gmail without a username and password
You cannot send yahoo mail without a username and password

Understand?
Jessuzz94
Posts: 162
Joined: Thu Jun 04, 2015 12:08 pm

Re: How to configure a mail server to send nagios notificati

Post by Jessuzz94 »

Yes, sorry
Locked