Email Notifications

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Email Notifications

Postby workid » Wed Oct 31, 2018 11:30 am

Hi, could someone help me or point me in the direction of an up-to-date guide of setting email notifications with Nagios Core?

I have setup my mail contacts in contacts.cfg

I understand i need to install a 3rd party such as Postfix to relay the mail, i did find a guide but this also used a program called Heirloom-MailX, which i understand does not exists now. The guide was from years ago so anything up-to-date that points me in the right direction would be great.

I would be wanting to send emails to myself & colleagues who's mail is on an exchange server, would that need to be setup to allow mails from Nagios or Postfix as well?

Any info would be great.

Thanks
Pete
workid
 
Posts: 26
Joined: Wed Oct 10, 2018 7:28 am

Re: Email Notifications

Postby tgriep » Wed Oct 31, 2018 4:51 pm

If you have already installed postfix on the server and are looking for instructions for relaying the emais to your exchange server, the following link has an example for you to setup Postfix to relay emails and instructions on setting up authentication to the relay server. You would need to do this if the Exchange server requires it.
https://www.howtoforge.com/postfix_relaying_through_another_mailserver

Is this what you are looking for?
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!
User avatar
tgriep
Madmin
 
Posts: 7229
Joined: Thu Oct 30, 2014 9:02 am

Re: Email Notifications

Postby workid » Mon Nov 05, 2018 10:41 am

Thanks for that.

I now have postfix setup and can mail to internal linux user.

I followed the guide above and have it all setup, but I'm unable to to send any mail, checking the logs im getting a error:

Code: Select all
Nov  5 15:35:00 GC-NAGIOS postfix/smtp[9093]: 3FA883E2A2D: to=<my.user@mymail.ac.uk>, relay=mail.mymail.ac.uk[123.19.1.19]:25, delay=1100, delays=1095/0.01/5/0, dsn=4.7.3, status=deferred (SASL authentication failed; server mail.mymail.ac.uk[123.19.1.19] said: 535 5.7.3 Authentication unsuccessful)


The username and password are correct so i don't know why it wont authenticate with the mail server, i have checked it is in the right format (username:password), i don't know if there is anything i need to to do on the exchange server side for this to work.
anyone got any ideas?
workid
 
Posts: 26
Joined: Wed Oct 10, 2018 7:28 am

Re: Email Notifications

Postby tgriep » Mon Nov 05, 2018 4:05 pm

You would check to see if port 25 is the correct port the exchange server needs as well as what type of security settings it needs.
TLS or SSL.

The administrator of the server should be able to answer those 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!
User avatar
tgriep
Madmin
 
Posts: 7229
Joined: Thu Oct 30, 2014 9:02 am

Re: Email Notifications

Postby workid » Tue Nov 06, 2018 8:41 am

Thanks for that... i needed to add the server as an allowed relay in Exchange 2016.

One last thing... do i need to tell Nagios Core that Postfix is installed in Nagios somewhere?
How does Nagios and Postfix link, so that it can send the notifications?
workid
 
Posts: 26
Joined: Wed Oct 10, 2018 7:28 am

Re: Email Notifications

Postby tgriep » Tue Nov 06, 2018 12:36 pm

The commands that are defined in Core by default use the mail application to send the emails to the local Mailer Daemon which is Postfix in your case.
That is the default way it works and you do not have to link them to work.
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!
User avatar
tgriep
Madmin
 
Posts: 7229
Joined: Thu Oct 30, 2014 9:02 am

Re: Email Notifications

Postby workid » Wed Nov 07, 2018 8:20 am

Ok, just im not receiving any notifications from Nagios.

I have setup contacts and a contact group,

Code: Select all
define contact {

    contact_name            Phudson             ; Short name of user
    use                     generic-contact         ; Inherit default values from generic-contact template (defined above)
    alias                   Nagios Admin            ; Full name of user
    email                   myname@mymail.ac.uk ;
}

define contact {

    contact_name            ITservices             ; Short name of user
    use                     generic-contact         ; Inherit default values from generic-contact template (defined above)
    alias                   IT Services            ; Full name of user
    email                  anothername@mymail.ac.uk ;
}

define contactgroup {

    contactgroup_name       admins
    alias                   Nagios Administrators
    members                 Phudson, ITservices
}




i have also set notification on a host and also a service.

Code: Select all
define host {
   use             windows-server
   host_name         windows10-thinapp   
   alias            Test
   address            123.14.136.147
   max_check_attempts       5
   check_period         24x7
   notification_interval      30   
   notification_period      24x7
   contact_groups         admins
}

define service {

    use                     local-service           ; Name of service template to use
    host_name               windows10-thinapp
    service_description     PING
    check_command           check_ping!100.0,20%!500.0,60%
    notifications_enabled   1
    contact_groups       admins
}


The notification log shows that there is an error and the actions but i don't receive any emails, i have attached a screenshot of the notifications log

Postfix is working as i can email from there through my exchange server to the notification email address, but Nagios does not seem to be sending emails through Postfix.

Got any ideas if im going wrong somewhere
Attachments
nagios error.png
workid
 
Posts: 26
Joined: Wed Oct 10, 2018 7:28 am

Re: Email Notifications

Postby tgriep » Wed Nov 07, 2018 11:45 am

Do you see any errors in the /var/log/maillog file when the emails are generated by Nagios?
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!
User avatar
tgriep
Madmin
 
Posts: 7229
Joined: Thu Oct 30, 2014 9:02 am

Re: Email Notifications

Postby workid » Thu Nov 08, 2018 8:07 am

There are no errors in there for the notifications, there are no details at all of any attempts to send an email for notifications, only logs of successful emails sent from postfix where i have tested the relay through the exchange server.
workid
 
Posts: 26
Joined: Wed Oct 10, 2018 7:28 am

Re: Email Notifications

Postby workid » Thu Nov 08, 2018 9:02 am

I have got it working.

I needed to make a change in the commands.cfg file

\bin\mail to \usr\bin\mailx

Thanks for your help with this, you can lock this now.
workid
 
Posts: 26
Joined: Wed Oct 10, 2018 7:28 am

Next

Return to Nagios Core

Who is online

Users browsing this forum: No registered users and 29 guests