NagMon logo NagMon
  1. Home
  2. Guides
  3. Nagios Email Notifications
Nagios Guides · Alerting

Nagios Email Notifications: Setup, Tuning & Troubleshooting

Email is still how Nagios tells you something broke — and when tuned well, it's a remarkably good channel. Here's how to set it up, cut the noise, and debug it when the messages stop coming.

Updated July 2026 · Applies to Nagios Core 4.x

On this page
  1. How the notification pipeline works
  2. Step 1: a working mail path
  3. Step 2: contacts
  4. Step 3: the notification command
  5. Tuning out the noise
  6. Troubleshooting "no emails"
  7. From email to fixed

How the notification pipeline works

Every Nagios email is the end of a chain, and debugging is easiest when you know the links:

  1. A check fails, then keeps failing through its retries until the object enters a hard problem state. Soft states never notify — that's by design, and it's the number-one source of "why didn't I get an email?" confusion. (Refresher: soft vs. hard states.)
  2. Nagios evaluates notification logic: are notifications enabled globally and on the object? Does the state match notification_options? Is the current time inside notification_period? Is the object acknowledged or in downtime?
  3. Each eligible contact is matched against their own notification options and timeperiod.
  4. The contact's notification command runs — for email, a shell pipeline that formats a message and hands it to the local mail command.
  5. Your MTA (Postfix, or a relay like msmtp) actually delivers it.

Step 1: a working mail path

Before touching Nagios config, prove the server can send mail as the nagios user:

sudo -u nagios /bin/mail -s "Nagios mail test" you@example.com <<< "It works."

If that doesn't arrive, no amount of Nagios configuration will help. On a modern network you'll usually relay through an authenticated smarthost (your provider's SMTP, or a transactional mail service) rather than delivering straight to the internet — configure Postfix's relayhost or use msmtp as a lightweight sendmail replacement, and check the spam folder before blaming the config.

Step 2: contacts

A minimal contact and contact group in contacts.cfg:

define contact {
    contact_name                    rvetter
    alias                           Richard
    email                           you@example.com
    host_notification_period        24x7
    service_notification_period     24x7
    host_notification_options       d,u,r
    service_notification_options    w,c,r
    host_notification_commands      notify-host-by-email
    service_notification_commands   notify-service-by-email
}

define contactgroup {
    contactgroup_name   admins
    alias               Nagios Administrators
    members             rvetter
}

The notification_options letters decide which transitions email you: d down, u unreachable (hosts) / unknown (services), w warning, c critical, r recovery, f flapping, s scheduled downtime, n none. Then reference the contact group from your hosts and services (typically via a template's contact_groups admins).

Step 3: the notification command

Nagios Core's sample config ships working notify-host-by-email and notify-service-by-email commands in commands.cfg — a printf pipeline into /bin/mail expanding macros like $HOSTNAME$, $SERVICEDESC$, $SERVICESTATE$, and $SERVICEOUTPUT$. Two upgrades worth making:

Finally, make sure the master switch is on in nagios.cfg: enable_notifications=1, and that hosts/services have notifications_enabled 1 (the default).

Tuning out the noise

An inbox you've learned to ignore is worse than no alerting. The levers, in order of impact:

Troubleshooting "Nagios isn't sending emails"

Work down the pipeline — nagios.log tells you exactly how far a notification got:

grep 'NOTIFICATION' /usr/local/nagios/var/nagios.log | tail

From email to fixed

The email is the starting gun, not the finish line. A workflow that works well for on-call admins: the notification lands on your phone with state and host in the subject; you open a mobile client like NagMon to see the blast radius — is it one service, or is the whole rack unreachable? — read the live plugin output, and acknowledge so repeat notifications stop and colleagues see it's handled. Then fix the thing.

NagMon app icon

Triage Nagios alerts from your pocket

NagMon shows live scope, plugin output, and lets you acknowledge or schedule downtime — the perfect follow-through to a well-tuned email alert.

Download NagMon