Configuring email notifications in NEMS

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

  1. 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.
    • If using a port other than 25 for your SMTP server, specify it on the USER7 line with :port. For example:
  2. Gmail SMTP Extra Steps
    First, if you are a G Suite user, visit… and configure the SMTP Relay Service like this:

    Of course, if you happen to have a static IP on your NEMS server, go ahead and enable IP filtering for even more security.And then visit…….subtab=lesssecureappsaccess 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:
  3. Test your 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 /home/pi/nems-scripts/ where is your actual recipient email address (must be different than the one you set in resource.cfg).
  4. Setup the target email address
    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.
  5. Setup notifications for each service
    Set Enable Notifications to 1, and Notification Type to whatever you’d like: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,
    • f Notify if the service is flapping (on and off and on and off)
    • n None… don’t 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.

Leave a Reply

12 Comments on "Configuring email notifications in NEMS"

Notify of
Sort by:   newest | oldest | most voted


I have a problem with sendt email from the nems, i get a error.

The error from the log /var/log/nagios3/nagios.log
[1502294875] HOST NOTIFICATION: admin;router;DOWN;notify-host-by-email;(Return code of 127 is out of bounds – plugin may be missing)

I have run the test script sudo /home/pi/nems-scripts/ [my mail adresse]
I get a error from my mail server
Aug 09 18:38:57 nems sendemail[19275]: SUCCESS => Received: 250 OK
Aug 09 18:38:57 nems sendemail[19275]: INFO => Sending: DATA
Aug 09 18:38:57 nems sendemail[19275]: SUCCESS => Received: 354 OK, send.
Aug 09 18:38:57 nems sendemail[19275]: INFO => Sending message body
Aug 09 18:38:57 nems sendemail[19275]: Setting content-type: text/plain
Aug 09 18:38:57 nems sendemail[19275]: ERROR => Received: 554 Rejected – Message containing bare LF’s.

I hope you can help?



I have sent e-mail according to your instructions. If I send via console a testmail with sendmail it comes. But NEMS does not send me any news. I have entereda contact the e-mail address. I ask for help.


Dan Ellison

Hello. Very nice distro. I have a small issue that I hope you can assist with.

I don’t seem to be able to get host or service notifications to be delivered via notify-***-by-email command. I have a verified forwarding gateway configured in the mail system. Using postfix. When I send a custom notification to test delivery I get this in the log: NEMS postfix/sendmail[30287]: fatal: nagios(111): No recipient addresses found in message header

I have created a contact and and added that contact to the necessary contact group. Everything appears to be correctly configured but this error persists. Almost like the $CONTACTEMAIL$ macro is not being defined correctly…. Any guidance in resolving this will be greatly appreciated.

Keep up the good work!