I am very new to Icinga and have struggled to get where I am by following online guides. I have successfully setup all my hosts and services but I am now struggling with notifications. I followed this to get Icinga up and running (Icinga Docker Setup Made Easy with Docker Compose | Tutorial). I think I have properly set everything up for a notification for both hosts and services but when I try to apply the notification to a host or service, I get this error:
[2026-02-07 11:47:58 +0000] information/cli: Icinga application loader (version: v2.15.1)
[2026-02-07 11:47:58 +0000] information/cli: Loading configuration file(s).
[2026-02-07 11:47:58 +0000] information/ConfigItem: Committing config item(s).
[2026-02-07 11:47:58 +0000] information/ApiListener: My API identity: Icinga2
[2026-02-07 11:47:58 +0000] critical/config: Error: Validation failed for object 'DesktopMasterBedroom!Notifications HOST' of type 'Notification'; Attribute 'command': Object 'mail-service-notification' of type 'NotificationCommand' does not exist.
Location: in [stage]/zones.d/master/notification_templates.conf: 2:5-2:41
[stage]/zones.d/master/notification_templates.conf(1): template Notification "HOST Notifications" {
[stage]/zones.d/master/notification_templates.conf(2): command = "mail-service-notification"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[stage]/zones.d/master/notification_templates.conf(3): period = "Always"
[stage]/zones.d/master/notification_templates.conf(4): states = [ Down, Up ]
So I have made some progress today as I now see notifications being sent under history. This is what I did:
cd /etc/icinga2/zones.d
mkdir master
cd master
cp /etc/icinga2/conf.d/commands.conf /etc/icinga2/zones.d/master/commands.conf
Curious if this will persist docker starts and stops?
Now I am getting the error:
terminated with exit code 1, output: mail: cannot send message: Process exited with a non-zero status
I have Exim4 configured on the host and it works fine. I also have bsd-mailx installed as I think it installs with Exim4. mail, Mail, and mailx are all symlinked to /usr/bin/bsd-mailx
Thank you for this response @adn77 as this is likely my issue. I have a couple questions if you could be so kind. 1) If install ssmtp inside the container, do I need to do anything to make the installation persist reboots of the host or restarts of the container 2) Do I configure ssmtp to forward mail to exim4 on the host or straight to the gmail smtp server
If you want the ICINGA2 container to send mail, you will already find MSMTP installed in the image:
To notify by e-mail, provide an msmtp configuration - either by mounting the /etc/msmtprc file or by specifying the desired content of ~icinga/.msmtprc via the environment variable MSMTPRC.
As to the second question, it depends on your local mail sending policy… I usually use a local smarthost in our network.
## Set default values for all following accounts.
#defaults
#auth on
#tls on
#tls_trust_file /etc/ssl/certs/ca-certificates.crt
#logfile ~/.msmtp.log
# Gmail
account gmail
host smtp.gmail.com
port 587
tls_starttls on
from user@gmail.com
user user
password app-password
## A freemail service
#account freemail
#host smtp.freemail.example
#from joe_smith@freemail.example
#...
## Accounts can inherit info from another account
#account postmasterfreemail : freemail
#from postmaster*@freemail.example
# Set a default account
account default: gmail
then I try to send mail from inside the container using: mail -s "Icinga Raspi 5 Test" gmailuser@gmail.com
and I get cannot send message: Process exited with a non-zero status
I have mail working inside the container now. I can send mail using the mail -s "test" user@gmail.com. Icinga shows notification history indicating notifications are being generated but I still get the cannot send message: Process exited with a non-zero status inside the container when reviewing docker logs.