I have icinga2 set up on a Ubuntu xenial machine. I'm using postfix to send emails, which is working properly, i.e.
echo "hello world" | mail -s "test subject" sammy@example.com
sends an email as expected.
However, when an icinga sends an email, I find the following error message:
/var/log/icinga2/debug.log
[2017-12-12 02:56:05 +0000] notice/Process: PID 5512 > ('/etc/icinga2/scripts/mail-host-notification.sh' '-4' '$ $a.mydomain.com' (PID: 5512, arguments: '/etc/icinga2/scripts/mail-host-notification.sh' '-4' '127.0.0$ Can't canonicalize "./Maildir" ./Maildir/sent: No such file or directory Failed to save message in "./Maildir/sent" - message not sent
I know that the error is caused by the Maildir directory not being set up. However, I can't figure out how to determine which user is invoking the mail command. I also don't know what the cwd is set to in ./Maildir/sent.
I would be very grateful if anyone could help me figure out either:
Thanks in advance
I was able to get my icinga2 instance to mail properly by creating the Maildir in the / directory and setting the owner:group to nagios:nagios. Currently not sure how to configure this, but it is a working configuration!