Page 1 of 1

Maildir location wrong in nagios 4?

Posted: Thu Aug 10, 2017 7:00 am
by niels.christian
Hi,

I have set up Nagios 4 on Ubuntu 16.04 successfully by compiling with the configuration:
./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagcmd --with-mail=/usr/sbin/sendmail
I also tried without the --with-mail=/usr/sbin/sendmail without any changes for my problem.

I am using a standard Postfix and s-nail setup for the email solution. This works fine from commandline - also for the nagios user (tested with: nagios@nagiosserver:~$ echo "test message" | mail -s "some subject" [email protected])

Email is received as expected. The outgoing email is seen in ~nagios/Maildir/sent as expected. I have set rwx access to all on the folders (777). I have also set and tested this for the root user.

The notifications from nagios is however not working.

In the log files I see the following error:
Aug 10 10:11:44 mon01 nagios: wproc: stderr line 01: Can't canonicalize "./Maildir"
Aug 10 10:11:44 mon01 nagios: wproc: stderr line 02: ./Maildir/sent: No such file or directory
Aug 10 10:11:44 mon01 nagios: wproc: stderr line 03: Failed to save message in "./Maildir/sent" - message not sent
Aug 10 10:11:44 mon01 nagios: wproc: stdout line 01: "./dead.letter" 19/357

It seems to me like Nagios is expecting ./Maildir to be elsewhere?

Any suggestions on solving this?

Thanks

/Niels

Re: Maildir location wrong in nagios 4?

Posted: Thu Aug 10, 2017 11:49 am
by scottwilkerson
When nagios is executing commands including sending mail, it isn't in the nagios home directory. so the relative path ./Maildir isn't going to work.

I'm not familiar with that setup but you are going to need to full path to the directory

Re: Maildir location wrong in nagios 4?

Posted: Fri Aug 11, 2017 12:54 am
by niels.christian
Hi Scott,

Your answer exactly describe my problem: Where is ./Maildir?

The log files does not in any way reveal where Nagios is running from when reporting the error, thus making any workaround to get the emails out.

It seems like "wproc" is the source of reporting the error, maybe someone know where to look for the function in workers.c so I could add in a line of debug, indicating where the "current dir" is expected to be?
Or maybe someone know where wproc is running from?

Thanx in advance

/N

Re: Maildir location wrong in nagios 4?

Posted: Fri Aug 11, 2017 12:26 pm
by scottwilkerson
./Maildir is part of s-nail setup. It is not part of Nagios.