docker-nagios icon indicating copy to clipboard operation
docker-nagios copied to clipboard

[Bug]: sendmail: Cannot open mailhub:25

Open hanscees opened this issue 11 months ago • 3 comments

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

  • maintainer: Christos Manios [email protected]
  • nagiosPluginsVersion: 2.4.7
  • nagiosVersion: 4.5.0
  • name: Nagios
  • nrpeVersion: 4.1.0
  • org.opencontainers.image.authors: Christos Manios [email protected]
  • org.opencontainers.image.description: Nagios, the Industry Standard In IT Infrastructure Monitoring
  • org.opencontainers.image.documentation: https://github.com/manios/docker-nagios/blob/master/README.md
  • org.opencontainers.image.licenses: MIT
  • org.opencontainers.image.revision: 6b550aa657ddd16c8d6283cd15dfd4d495115f46
  • org.opencontainers.image.source: https://github.com/manios/docker-nagios

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 [email protected] sendmail: Cannot open mailhub:25 bash-5.0# whoami root

hanscees avatar Feb 26 '24 20:02 hanscees

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 avatar Feb 26 '24 20:02 hanscees

after creating /etc/ssmtp/ssmtp.conf

and filling it, it works.

darn, thats nice.

hanscees avatar Feb 26 '24 20:02 hanscees

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!

manios avatar May 29 '24 19:05 manios