manios / docker-nagios

Docker image for Nagios Core in Alpine Linux with basic plugins, available for x86, x64 , ARM v6, ARM v7 and ARM64.
https://www.nagios.org/
Other
60 stars 28 forks source link

[Bug]: sendmail: Cannot open mailhub:25 #67

Closed hanscees closed 3 months ago

hanscees commented 8 months ago

What happened?

Hi,

My nagios is at last working but it wont send email with this error: stderr line 01: sendmail: Cannot open mailhub:25 It probably has to do with the fact that I used another account for the main user nagiosadmin.

I found this tip somewhere: https://unix.stackexchange.com/questions/351401/ssmtp-not-sending-mails-cannot-open-mailhub25-tldr-file-permissions-when-u

and tried this: chmod 777 /etc/ssmtp /etc/ssmtp/*

but that does not work.

where is the ssmtp configuration? Or how do you fill your mailhub variable?

Image information

Image architecture

x86

Relevant log output

I logged into the container

root@deb-2024-template:~/containers/nagios# docker exec -it nagios-nagios-1 bash bash-5.0# echo yo | /usr/sbin/sendmail -v hanscees@hanscees.com sendmail: Cannot open mailhub:25 bash-5.0# whoami root

hanscees commented 8 months ago

strangely enough /etc/ssmtp seems to be empty

bash-5.0# ls -all /etc/ssmtp total 12 drwxrwxrwx 2 root root 4096 Feb 24 20:01 . drwxr-xr-x 1 root root 4096 Feb 26 19:49 ..

hanscees commented 8 months ago

after creating /etc/ssmtp/ssmtp.conf

and filling it, it works.

darn, thats nice.

manios commented 5 months ago

Hi @hanscees !

Sorry for the late response! If you mount a volume to /etc/ssmtp/ then this container checks if the directory is empty and if it does, it adds a sample ssmtp.conf file. You can find it here: overlay/etc/ssmtp/ssmtp.conf.

Since it was not that clear, I have updated the README.md file accordingly in 2bdffc955a3c0dcd51c87e38d4fa72ad1b914564.

If I understand correctly you fixed it yourself, right? If so , you may close the issue. Thanks!