User Tools

Site Tools



config:legacy_email

Legacy Email Configuration

These instructions are for legacy NEMS deployments only (NEMS 1.1 to 1.2.x). If you are using NEMS 1.3+, please visit the current documentation.

A step-by-step guide to configuring Email Notifications on your NEMS Server.

Configure your resource.cfg

sudo nano /etc/nagios3/resource.cfg

Modify all the variables according to your configuration. To save, press CTRL-O, to exit press CTRL-X.

  1. If using a port other than 25 for your SMTP server, specify it on the USER7 line with :port. For example:
    smtp.gmail.com:587

Using Gmail SMTP For Nagios Notification Sending

When using Gmail for SMTP, a few extra steps are required.

First, if you are a G Suite user (that is to say, you're using Gmail but have an @yourdomain.com email address on their service as opposed to an @gmail.com address), visit this page and configure the SMTP Relay Service like this:

Of course, if you happen to have a static public IP address on your NEMS server, go ahead and enable IP filtering for even more security.

Then, visit this page and enable “Allow users to manage their access to less secure apps”.

Now that you've done that, or if you are not a G Suite user, you'll need to enable the setting for “less secure apps” here: https://myaccount.google.com/lesssecureapps

2017/10/03 08:33 · Robbie Ferguson

Test Your Email Notification Settings

I've written an easy-to-use script which will load your settings from resource.cfg and send you a test email. It will also show you in the terminal the results, which may be helpful if you believe there is an error (since you'll be able to see the output of sendemail).

To run the test script: 

sudo nems-mailtest youremail@yourdomain.com

 where [email protected] is your actual recipient email address (must be different than the one you set in resource.cfg).

2017/10/03 08:27 · Robbie Ferguson
Setup the target email address
  1. Login to NEMS-nConf and visit the Contacts section. You'll see your user there (which you setup with nems-init). Edit it and change the email address to the one you would like.
  2. Setup notifications for each service
  3. Set Enable Notifications to 1, and Notification Type to whatever you'd like.
NEMS Email Notification Definitions

Configuring notifications in NEMS (or Nagios for that matter) requires a knowledge of what the single-character options mean. Here is an overview:

When you see w,u,c,r,f,n these are the definitions:

  • w Notify if in warning state,
  • u Notify if in unknown state,
  • c Notify if in critical state,
  • r Notify if recovered from a previously bad state,
  • f Notify if the service is flapping (on and off and on and off)
  • n Never notify.

When you see d,u,r,f,s,n these are the definitions:

  • d Notify if host is down,
  • u Notify if host is unreachable (eg. Internet down),
  • r Notify upon recovery,
  • f Notify if the host is flapping,
  • s Notify if a scheduled service downtime begins or ends,
  • n Never notify.
2017/10/03 08:21 · Robbie Ferguson
config/legacy_email.txt · Last modified: 2017/10/27 14:49 (external edit)