jjethwa / icinga2

GNU General Public License v3.0
223 stars 189 forks source link

mail error #32

Closed ismaello closed 8 years ago

ismaello commented 8 years ago

Hi Jordan,

The first, thanks you for your icinga docker imagen. I was testing it and now I have this little issue sending notification:

/etc/icinga2/scripts/mail-host-notification.sh') terminated with exit code 36, output: mail: cannot stat /root/.mail': Permission denied mail: Cannot open/root/.mailrc': Permission denied mail: cannot send message: Process exited with a non-zero status mail: Cannot open file /root/dead.letter: Permission denied"

I guess the issue is about nagios and home dir "/root".

jjethwa commented 8 years ago

Hi @ismaello

Thanks so much! I hope it will be useful for you to test and adopt Icinga2, my favourite monitoring platform :)

For email notifications in containers, I recommend using SSMTP. SSMTP is already included in the container and doesn't require another daemon running in the container. You'll have to configure it here: /etc/ssmtp/ssmtp.conf and also modify the mail notifications scripts.

Let me know if you need help with configuring it. I've left the configurations and scripts as default as possible in the container to limit missing changes from upstream.

Quentinvarquet commented 8 years ago

I confirm, I had to install ssmtp on my old icinga container (Yes I have the same container since one year !) and it's works very well.

jjethwa commented 8 years ago

That's great news! Thanks, @Quentinvarquet 😃

mdevey commented 8 years ago

I concur. Everytime I update my image, mainly just removing the things from my own child dockerfile that @jjethwa is adding. Keep up the good work!

jjethwa commented 8 years ago

Hi @ismaello

Just checking in with you on this issue. Were you able to get ssmtp up and running? If so, can you close this issue? Thanks :)

jjethwa commented 8 years ago

No response from user, so I'm closing this issue. Please re-open it if you need further support :)

nisamudeen97 commented 6 years ago

Hi,

I am also facing the same issue for custom notification and getting the error on Icinga monitoring server log. [2018-01-18 08:38:17 +0100] information/Notification: Completed sending 'Custom' notification 'srv.----.de!procs!mail-icingaadmin' for checkable 'srv.-----.de!procs' and user 'icingaadmin'. [2018-01-18 08:38:17 +0100] warning/PluginNotificationTask: Notification command for object 'srv.------.de!procs' (PID: 18136, arguments: '/etc/icinga2/scripts/mail-service-notification.sh') terminated with exit code 1, output: mail: cannot stat `/root/.mail': Permission denied

jjethwa commented 6 years ago

Hi @nisamudeen97

Did you try my recommendation to use SSMTP above?

nisamudeen97 commented 6 years ago

Hi,

We are not having "ssmtp.conf", we have postfix deamon running and we don't need SMTP enabled for notifications.

bebehei commented 6 years ago

ssmtp is needed for your internal resolving of mail routes. With ssmtp.conf you give the container credentials to your global mail configuration, which specify an account on your postfix SMTP server. All traffic then gets sent via this SMTP account on your postfix server, which won't produce invalid e-mails.

ssmtp acts as a proxy in your container to send valid mails from your monitoring instance.