October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Enable Email Alerts in Icinga 2

Learn how to configure reliable Icinga 2 email notifications: define recipients, attach host or service rules, connect an external mail command, set filters and reminders, validate the configuration, and diagnose missing alerts.
WorldIcinga 2 Length10 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To enable email alerts in Icinga 2, configure all four links in the notification chain: a recipient User or UserGroup, a host or service notification rule, a NotificationCommand that calls an external mail mechanism, and an enabled notification feature. The recipient must have a valid email attribute and enable_notifications = true. State and notification-type filters decide which events qualify, while interval controls reminder frequency.

The configuration below uses Icinga’s documented object syntax. Validate it with icinga2 daemon -C before reloading Icinga, then troubleshoot in the order shown if mail does not arrive.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What an Icinga email alert needs

Icinga notifications are a chain rather than a single mail setting. A check result first has to qualify for notification, then Icinga must resolve a recipient, select a notification object, and execute a command that hands the message to a mail system.

Component What it does Minimum requirement
Recipient User or UserGroup Identifies who receives the alert and which states or event types are allowed. A valid email value and enable_notifications = true.
Host or service Notification apply rule Connects a monitored object to users or groups and imports the appropriate notification template. A rule targeted with to Host or to Service, with an assign where expression that matches.
NotificationCommand Builds the notification invocation and calls a script or other delivery mechanism. An existing command whose executable can be run by the Icinga service account.
Notification feature and mail transport Allows notification commands to run and actually transfers the message. The notification feature enabled and an external local or managed mail mechanism configured.
Filters and interval Limit alerts to selected states and event types, and determine reminder timing. Filters that include the event you want to test; an interval that does not suppress it.

Icinga 2 does not send email on its own. It invokes an external mechanism, commonly a shell script. The scripts shipped as examples are starting points: adapt their sender, authentication, transport, and message formatting to your environment rather than assuming that an installation is already connected to a mail relay.

Step 1: Define a recipient User

Create a User object for each person or service address that should receive notifications. The documented example is:

object User "icingaadmin" {
  display_name = "Icinga 2 Admin"
  enable_notifications = true
  states = [ OK, Warning, Critical ]
  types = [ Problem, Recovery ]
  email = "icinga@localhost"
}

Required attributes

  • enable_notifications = true must be present for this recipient to receive notifications.
  • email must contain a valid mailbox. Replace the example local address with a real production mailbox.
  • states determines which host or service states are eligible. The example includes OK, Warning, and Critical.
  • types determines which notification events are eligible. The example sends Problem and Recovery events.

If you omit states or types, Icinga treats the missing filter as all states or all notification types. That is convenient for a first configuration, but explicit lists make an alert policy easier to audit.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use groups when several people share a policy

A UserGroup lets a notification rule address several users without listing each address repeatedly. Put the users in the group, then assign that group in a host or service notification rule. Keep the individual email address on the User object or in another managed configuration source so recipient data has one clear owner.

Step 2: Attach a notification rule to monitored objects

A notification apply rule is separate from the check itself. It decides which users or groups are notified when an object changes state. The target in the rule is significant: host and service notifications are different object types.

Service notifications

This documented pattern applies a mail template to services and sends it to the noc group when the host’s custom variable indicates that mail routing is enabled:

apply Notification "mail-noc" to Service {
  import "mail-service-notification"
  user_groups = [ "noc" ]
  assign where host.vars.notification.mail
}

import "mail-service-notification" supplies the template’s command and default behavior. The assign where expression is evaluated for each service. If a service’s host does not have vars.notification.mail, this rule does not apply to it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Host notifications

For host-state alerts, create a corresponding rule targeted at hosts and import the host template:

apply Notification "mail-host-noc" to Host {
  import "mail-host-notification"
  user_groups = [ "noc" ]
  assign where host.vars.notification.mail
}

Using to Host with mail-host-notification keeps host events and service events on their appropriate templates. A service rule will not automatically cover host notifications, and a host rule will not automatically cover services.

Assign users directly when the scope is small

You can set users = [ "icingaadmin" ] in a notification object when one or a few named recipients should always receive that rule. Groups are usually easier to maintain when many objects share the same on-call audience. Whichever form you choose, verify that every referenced name resolves to an actual User or UserGroup.

Step 3: Route recipients with vars.notification["mail"]

Recipient routing can live with host or service data instead of inside a global notification rule. The documented nested variable format is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
vars.notification["mail"] = {
  groups = [ "icingaadmins" ]
  users = [ "icingaadmin" ]
}

This structure is useful when ownership belongs to the object itself or when another configuration system generates host and service variables. The notification apply rule can read the groups and users values and pass them to the notification object. A rule using that model can be written as:

apply Notification "mail-from-object" to Service {
  import "mail-service-notification"
  user_groups = host.vars.notification.mail.groups
  users = host.vars.notification.mail.users
  assign where host.vars.notification.mail
}

Choose either a centrally assigned audience or object-level routing deliberately. Central rules make a global change quick; object variables make exceptions visible next to the monitored object. Mixing both without a naming convention can make it unclear why a particular person receives an alert.

Step 4: Ensure a delivery command and mail transport exist

The notification object only schedules an invocation. Icinga 2 relies on a NotificationCommand to call an external mechanism, commonly a shell script. A fresh installation includes example host and service email scripts. Treat those files as templates, then adapt them for your mail transport, sender identity, authentication requirements, and message format.

Check the command path

  • Confirm that the imported mail template names a command that exists in the generated configuration.
  • Confirm that the command’s executable path points to the intended script or mail client.
  • Make the script executable by the operating-system account that runs Icinga. A script that works when launched as an administrator can still fail when Icinga runs it with its service-account permissions.
  • Check that every argument expected by the script is supplied by the notification template, including recipient, subject, and body values where applicable.

Enable the notification feature

The notification feature must be enabled for notification commands to execute. If the feature is disabled, the recipient and apply rule can be perfectly valid while no delivery command runs. Verify feature enablement before changing mail-script arguments.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Separate Icinga from mail delivery

Icinga does not provide the mail transfer itself. Your external mechanism may be a local mail command, a relay managed by your operations team, or another SMTP-capable service. The documentation establishes the hand-off point but does not prescribe a particular provider. Configure that mechanism’s sender, authentication, transport, and formatting according to its own requirements, then test it under the Icinga service account.

Step 5: Select states, event types, and reminder interval

Filters determine whether a state change produces a notification at all. Notification templates and users can specify states such as Warning, Critical, and Unknown. Event types can include Problem, Acknowledgement, Recovery, and downtime-related events.

Build a policy that matches the event

  • Include Problem if the first failure should generate mail.
  • Include Recovery if the same incident should generate a clear message when it returns to normal.
  • Include Acknowledgement or downtime events only when those workflow changes belong in email.
  • Include the state being tested. A service in Unknown will not match a filter containing only Warning and Critical.

When no state or type filter is specified, Icinga assumes all states and notification types. This can help prove the wiring during initial setup, after which you can narrow the policy.

Understand interval

The notification interval controls reminders while an incident remains in a notifying state. The example configuration uses a 30-minute interval; that value is a configuration example, not a performance or adoption statistic. Set interval = 0 for one notification without repeat reminders, or choose a duration that fits the incident workflow. A nonzero interval can make a working configuration appear silent if you are waiting for a repeat sooner than the configured period.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recovery notifications are normally sent only to recipients who previously received the related problem notification. Therefore, adding a recipient after a problem was already delivered does not necessarily produce a recovery message for that earlier event.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Step 6: Validate the configuration before reloading

  1. Run icinga2 daemon -C on the Icinga server. Fix every syntax, object-reference, and apply-rule error it reports before attempting a reload.
  2. Confirm that the recipient object exists, has a valid email, and has enable_notifications = true.
  3. Confirm that the host or service actually matches the rule’s assign where expression.
  4. Confirm that every user, group, imported template, and notification command name resolves.
  5. Confirm that the notification feature is enabled.
  6. Inspect the generated object model with the documented icinga2 object list workflow when inheritance or apply-rule matching is unclear. This lets you verify the resulting notification object rather than only the source file.
  7. After validation succeeds, reload Icinga using your normal service-management procedure and observe the notification logs while performing a controlled test event.

Why Icinga may not send email

Symptom Likely cause What to check
No notification object appears The apply rule did not match. Check whether the object is a host or service, then evaluate the assign where expression and required custom variables.
Object exists but no recipient is listed User or group assignment is empty or unresolved. Check users, user_groups, and the names under vars.notification["mail"].
Recipient is listed but receives nothing Notifications are disabled for that user or the email value is invalid. Check enable_notifications and the exact email attribute.
Problem mail is filtered out The event’s state or type is not allowed. Compare the test event with the configured states and types.
Only one message arrives That may be intentional. Check whether interval = 0 disables reminders.
Reminders never arrive The interval has not elapsed or a filter prevents the event. Check the configured interval and wait the full duration before judging repeat behavior.
Neither problem nor recovery mail arrives The notification feature or command is unavailable. Verify feature enablement, imported command existence, executable permissions, and command execution as the Icinga account.
Command runs but mail is not delivered The external transport rejected or could not relay the message. Run the delivery script as the Icinga service account and inspect that transport’s own result and logs.
Host alerts work but service alerts do not The wrong target or template was configured. Use a service rule with to Service and the service mail template; host rules do not automatically cover services.

Direct recipient rules versus object-driven routing

Both approaches use the same notification engine. The practical difference is where recipient data and scope are maintained.

Decision axis Direct or centrally managed rule Object-driven or generated rule
Recipient location User and UserGroup assignments live in notification configuration. vars.notification["mail"] stores users and groups with host or service data.
Rule scope One apply rule can cover every matching host or service. Each object’s variables determine whether and to whom it alerts.
Filtering precision Set shared states and types in a template or rule. Keep shared filters in a template while generating recipient routing per object.
Repeat behavior Set one shared interval for the rule or imported template. Use the same notification behavior unless generated configuration deliberately overrides it.
Delivery mechanism Both still call an external NotificationCommand. Object-level routing changes recipients, not the underlying mail transport.

Use central rules when the same operations group owns a broad set of checks. Use object variables when ownership differs by host or service, or when a configuration generator already emits those variables. In either model, validate the generated notification object and command path instead of assuming that an imported template applied as expected.

A practical first-alert checklist

  • Create one test User with a real mailbox, enable_notifications = true, and broad temporary state and type filters.
  • Choose either a host or service test object and write the matching apply rule with the correct to target.
  • Assign the test user directly or through a group whose membership you have verified.
  • Import the corresponding mail template and confirm that its NotificationCommand exists.
  • Verify the notification feature is enabled and that the command is executable by the Icinga service account.
  • Run icinga2 daemon -C and resolve all validation errors.
  • Inspect the resulting notification object if the rule’s inheritance or assignment is uncertain.
  • Perform a controlled problem-and-recovery test, allowing for the configured interval and remembering that recovery normally goes only to recipients who received the problem.
  • After delivery is proven, narrow states and types, set the reminder interval, and remove any temporary broad testing policy.

Key boundaries to keep in mind

An email address alone does not create an alert. A user without a matching notification object is never selected; a notification object without a command cannot deliver; and a command without an enabled notification feature is not executed. Likewise, a correctly delivered problem message does not guarantee that every recipient will receive a later recovery message, because recovery follows the original notification relationship.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The most reliable troubleshooting order follows that same chain: validate configuration, prove object matching, prove recipient resolution, prove feature and command execution, and only then investigate the external mail transport. This isolates Icinga configuration errors from delivery-system errors without changing several layers at once.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.