Free tools Windows power users keep installed
One-click scans. No signup required.
To enable email alerts in Icinga 2, configure all three parts of the notification chain: a recipient User (or UserGroup) with a valid email address, a host or service Notification apply rule, and a NotificationCommand or external script that can deliver mail. Then validate the configuration with icinga2 daemon -C and test each layer separately.
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
How Icinga 2 email notifications fit together
Icinga 2 does not deliver email on its own. A check changes state, the notification rules decide whether that event should produce an alert, and a notification command hands the message to an external delivery mechanism such as a local mail transfer agent or an SMTP relay. If any link is missing, the check can still appear correctly in Icinga while no email is sent.
As an Amazon Associate I earn from qualifying purchases.
The complete path is:
- A host or service enters an eligible state, such as
CriticalorWarning. - A
Notificationobject applies to that host or service. - The notification resolves one or more users or user groups.
- The selected user accepts that state and notification type.
- The notification invokes a
NotificationCommand. - The command or script passes the message to your mail transport.
Icinga’s documentation describes notifications as an integral part of the monitoring stack, but also notes that Icinga 2 “on its own” does not know how to send notifications. Treat mail delivery as an integration you must configure and operate separately from monitoring.
Prerequisites before you edit notification rules
- A working Icinga 2 installation that can evaluate host and service checks.
- Permission to edit the configuration objects and deploy a reload through your normal Icinga process.
- A real mailbox for production testing. The example address
icinga@localhostis suitable only for a local test environment. - An available mail transport: for example, a local MTA or an authenticated SMTP relay that your notification script can use.
- A notification feature that is enabled. Notification commands are not executed when that feature is disabled.
- A delivery command or script readable and executable by the operating-system account running Icinga.
Decide first whether recipients belong centrally in User objects or should be selected by host and service data. Central user objects are easier to audit when the same people receive many alerts. Variables on a host or service are useful when routing is generated by another configuration system or differs for every monitored object.
#1 Best Overall
Step 1: Define a recipient User
Create a User object with notifications enabled and an email address. This is the smallest complete example from the official configuration pattern:
object User "icingaadmin" {
display_name = "Icinga 2 Admin"
enable_notifications = true
states = [ OK, Warning, Critical ]
types = [ Problem, Recovery ]
email = "icinga@localhost"
}
Replace the address with a mailbox that you can actually receive. Keep the address in the user object or in another controlled configuration source; an address that exists only in a comment or an unrelated variable is not a notification destination.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →What each User property controls
| Property | Purpose | Operational consequence |
|---|---|---|
enable_notifications |
Allows this user to receive notifications. | false prevents delivery even when a matching rule names the user. |
email |
Destination address used by the mail command or template. | A missing or invalid value leaves the command without a usable recipient. |
states |
Limits the check states that can notify this user. | For example, omitting Unknown means an Unknown event will not match this user. |
types |
Limits event types such as problems and recoveries. | Omitting Recovery prevents recovery mail for that user. |
If states and types are omitted, Icinga assumes all states and notification types are eligible. Explicit lists are safer for a busy installation because they make the intended alert policy visible, but they can also explain why a test event produces no message.
Step 2: Organize recipients with a UserGroup
A UserGroup lets one notification address a team rather than listing individual users repeatedly. A service notification can assign a group such as noc:
apply Notification "mail-noc" to Service {
import "mail-service-notification"
user_groups = [ "noc" ]
assign where host.vars.notification.mail
}
Every user in the group still needs its own enabled notification setting and valid email address. A group name that does not resolve to a defined group will not produce a recipient merely because the spelling looks correct.
Step 3: Apply a mail notification to services and hosts
Host and service notifications are different object types. The target in the apply rule determines which checks the rule can match, and the imported mail template must correspond to that target.
Service alerts
apply Notification "mail-noc" to Service {
import "mail-service-notification"
user_groups = [ "noc" ]
assign where host.vars.notification.mail
}
This rule applies to services whose host has the custom variable notification.mail. Your policy can use a more specific assign where expression, but it must evaluate true for the service being tested.
Host alerts
apply Notification "mail-host-noc" to Host {
import "mail-host-notification"
user_groups = [ "noc" ]
assign where vars.notification.mail
}
Use the host template for a host rule and the service template for a service rule. A service rule does not automatically create host notifications, and a host rule does not replace service notifications.
| Alert scope | Apply target | Typical imported template | Variable expression in the examples |
|---|---|---|---|
| Service state changes | to Service |
mail-service-notification |
host.vars.notification.mail |
| Host state changes | to Host |
mail-host-notification |
vars.notification.mail |
Step 4: Route recipients with notification.mail variables
Instead of hard-coding recipients in every notification rule, attach them to the monitored object. The documented nested variable format is:
vars.notification["mail"] = {
groups = [ "icingaadmins" ]
users = [ "icingaadmin" ]
}
The notification apply rule can read the groups and users members and pass them to the notification template. This approach is useful when an inventory or provisioning system generates host and service configuration, because the routing decision travels with the object.
Recommended Free Tools
Direct recipients versus variable-driven recipients
| Decision axis | Direct rule assignment | notification.mail routing |
|---|---|---|
| Where recipients live | In the notification apply rule, such as user_groups = [ "noc" ]. |
In each host or service’s vars.notification["mail"] object. |
| Best fit | A small, centrally managed recipient policy. | Per-object ownership, generated configuration, or different teams by system. |
| Rule scope | Easy to apply broadly to all matching hosts or services. | Fine-grained routing based on object data. |
| Common failure | The named user or group is undefined or disabled. | The variable is absent, misspelled, or not matched by assign where. |
Do not mix the two patterns accidentally. If a template expects users from notification.mail but the rule supplies only a fixed group, the generated notification may not reach the intended team. Keep one clearly documented source of truth for each rule.
Step 5: Provide a NotificationCommand and mail transport
Icinga 2 invokes a NotificationCommand; it does not become an SMTP client merely because a user has an email address. A fresh installation includes example host and service email scripts. Use those scripts as starting points, then adapt the sender address, transport, authentication, headers, and message formatting to your environment.
Rank #3
What the command must accomplish
- Accept the notification arguments supplied by the imported host or service template.
- Construct a message with a recipient, sender, subject, and body.
- Hand that message to a reachable local mail service or SMTP relay.
- Return a useful exit status so command failures appear in Icinga logs.
Do not assume that a script executable from your shell is executable by Icinga. The command runs as the Icinga service account, which needs execute permission on the script and read or execute permission on any interpreter, helper, certificate, or configuration file the script uses. If the script invokes a local mail binary, that binary must also be available in the service account’s execution environment.
Transport choices and their trade-offs
| Transport arrangement | Advantages | Risks to verify |
|---|---|---|
| Local MTA | Simple hand-off from the notification script and independent of an application credential. | Queueing, DNS, sender policy, and outbound firewall rules become part of the host’s operations. |
| Managed SMTP relay | Centralized delivery, authentication, and reputation controls. | Credentials, TLS settings, relay limits, and network access must be maintained outside Icinga. |
The official examples establish the command-and-script model but do not prescribe a particular SMTP provider. Select a transport that meets your organization’s authentication, retention, and delivery requirements.
Step 6: Choose states, event types, and reminder intervals
Notification filters decide which state changes are eligible. Common states include Warning, Critical, and Unknown. Common types include Problem, Acknowledgement, Recovery, and downtime-related events. A template or user without filters is treated as eligible for all states and types.
object User "oncall" {
display_name = "On-call team"
enable_notifications = true
states = [ Warning, Critical, Unknown ]
types = [ Problem, Acknowledgement, Recovery ]
email = "[email protected]"
}
The address above is an example format; use a real, controlled mailbox in your configuration. The important policy choices are the state and type lists, not the example domain.
How interval affects repeated alerts
The interval controls how often Icinga repeats a notification while the underlying problem remains active. The example configuration uses a 30-minute interval. Set interval = 0 when you want one notification without re-notifications, or choose a duration that matches your incident process.
An interval does not create the first alert; it governs repeats after an eligible notification has already been sent. A long interval can make a working configuration appear silent during a test if a previous notification is still within its suppression window. Recovery notifications are normally sent only to recipients who previously received the related problem notification.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsRank #4
- Used Book in Good Condition
Use filters deliberately
- Include
Problemwhen testing that a failure generates an initial message. - Include
Recoveryif operators must be told when the check returns to normal. - Include
Acknowledgementor downtime types only when those workflow events belong in email. - Check that the state under test is listed for both the user and the notification template.
- Temporarily use a narrow, obvious test policy rather than changing production-wide filters while diagnosing delivery.
Step 7: Validate the configuration before testing delivery
Run the configuration checker after every meaningful edit:
icinga2 daemon -C
Fix every syntax, object-name, import, and apply-rule error before investigating SMTP. A successful check means the configuration can be parsed and compiled; it does not prove that a script can connect to a relay or that a mailbox accepted a message.
After validation, deploy the configuration through your normal Icinga reload procedure. Confirm that the notification feature is enabled, because a valid command is still not executed when that feature is disabled. If you need to confirm what Icinga generated, inspect the compiled object model with the documented icinga2 object list workflow and verify that the expected host or service notification exists.
A safe test sequence
- Validate with
icinga2 daemon -C. - Confirm the target object has the expected
notification.maildata, if you use variable-driven routing. - Confirm the notification object is generated for the correct host or service type.
- Check that the recipient user is enabled and has a real email address.
- Check the selected state, event type, and interval.
- Run the delivery command using the Icinga service account in a controlled test, using the actual script and transport configuration rather than your personal shell environment.
- Trigger or observe a test event and follow the Icinga and mail-transport logs from notification creation through delivery.
Why Icinga is not sending email: a diagnostic path
1. Configuration validation fails
Start with icinga2 daemon -C. An undefined user, group, template, import, variable, or malformed apply rule prevents the intended object model from being deployed. Correct the first reported error, run the check again, and continue until validation succeeds.
2. No Notification object was generated
Inspect the generated objects and compare the rule with the target. For a service rule, verify that the rule uses to Service and that its assign where expression matches the service’s host variables. For a host rule, verify to Host and the host-level variable expression. A rule that parses successfully but evaluates false simply does not create a notification for that object.
3. The recipient is filtered out
Check enable_notifications, email, states, and types on every intended user. A user who is enabled but excludes the tested state or event type will not receive the message. If you use a group, verify that it resolves to users who individually pass these checks.
Best Value
4. The notification command is absent or disabled
Verify that the imported mail template exists and ultimately references a NotificationCommand. Confirm that the notification feature is enabled. Icinga’s documentation specifically calls out feature enablement as a prerequisite for executing notification commands.
5. The command cannot execute as the Icinga account
Inspect the script’s execute bit, its interpreter, referenced files, and environment. A command that works when run as root or as your login user can fail under Icinga because of permissions, a different PATH, a missing certificate, or a protected credential file. Make the smallest permission change necessary; do not give the monitoring account broad administrative access simply to make mail work.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →6. The command runs but transport rejects the message
At this stage, troubleshoot the external mail mechanism: relay hostname resolution, network egress, port access, TLS negotiation, authentication, sender policy, recipient rejection, and queue status. Icinga cannot correct a relay refusal. Use the transport’s logs and delivery status to distinguish a hand-off failure from a downstream mailbox problem.
7. A repeat notification is being suppressed
Check interval and the notification history. A nonzero interval intentionally suppresses repeats until the configured period elapses. A recovery is also tied to the original problem notification, so a person who did not receive the problem may not receive its recovery.
Operational practices for reliable alert mail
Keep notification policy separate from delivery credentials
User objects and apply rules describe who should be alerted and for which events. SMTP credentials, relay certificates, and transport-specific settings belong in the delivery mechanism with permissions that prevent ordinary configuration readers from obtaining them.
Make sender identity and routing explicit
Choose a sender address accepted by your relay and recognizable to operators. If different environments use different relays, keep those differences in the command or deployment layer rather than duplicating notification policy for every host.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePrevent alert storms without hiding incidents
Use state and type filters to remove events that do not belong in email, and use interval for controlled reminders. Do not set the interval to zero as a blanket fix for missing alerts; zero disables repeats but does not repair a recipient, rule, command, or transport problem.
Test both failure and recovery
An initial problem proves that the problem path works. A separate recovery test confirms that recovery is included in the type filters and that Icinga associates the recovery with recipients who received the problem. If acknowledgements or downtime notices matter operationally, test those event types as well.
Complete configuration checklist
- The recipient is a defined
Useror member of a definedUserGroup. enable_notifications = trueis set for the recipient.- The recipient has a valid production email address.
- The notification apply rule targets the correct object type:
HostorService. - The
assign whereexpression matches the intended object. - Any
notification.mailvariable contains the intendedusersandgroups. - The imported mail template or explicit
NotificationCommandexists. - The notification feature is enabled.
- The delivery script is executable by the Icinga service account.
- The state and type filters include the event being tested.
- The
intervalis not suppressing a repeat you expect immediately. icinga2 daemon -Ccompletes successfully.- The external mail transport accepts the message and provides delivery or rejection logs.
The practical answer
Email alerts work when Icinga can resolve an enabled recipient, generate a matching host or service notification, and execute an external mail command successfully. Configure those layers in that order, validate the object model, then troubleshoot execution and transport separately. This approach distinguishes an Icinga rule problem from a script-permission problem and from an SMTP delivery problem, so each failure has a specific place to fix.
Quick Recap
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.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.




