can't send email with nagios [solved]

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
majed
Posts: 98
Joined: Mon Mar 17, 2014 5:29 am

can't send email with nagios [solved]

Post by majed »

Peace,
i am using sendmail and i am not able to send mail.

the log shows:


Code: Select all

nagios nagios[3650]: wproc:   stderr line 01: Program mode requires special privileges, e.g., root or TrustedUser.
Aug  7 10:17:04 nagios nagios[3650]: wproc:   stdout line 01: WARNING: RunAsUser for MSP ignored, check group ids (egid=1000, want=209)
Aug  7 10:17:04 nagios nagios[3650]: wproc:   stdout line 02: can not chdir(/var/spool/clientmqueue/): Permission denied
when i try to send mail from command line, i get:

Code: Select all

nagios sendmail[8645]: t777J1Cm008645: to=email adress ,great,test, ctladdr=root (0/0), delay=00:00:03, xdelay=00:00:00, mailer=relay, pri=90003, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: 421 4.3.0 collect: Cannot write ./dft777J4ZY008665 (bfcommit, uid=0, gid=209): Permission denied
the permissions to /var/spool are no as follows:


Code: Select all

nagios ~ # ls -l /var/spool
total 16
drwxrwx--- 2 smmsp smmsp 4096 Aug  7 10:20 clientmqueue
drwxr-x--- 4 root  cron  4096 Jul 31 16:50 cron
drwxrwxr-x 2 mail  root  4096 Aug  7 09:37 mail
drwxr-xr-x 2 smmsp root  4096 Aug  7 09:38 mqueue
i'm sure it's a permission or/and ownership problem, but i just don't know what file or folder to check.
Last edited by majed on Wed Aug 12, 2015 1:01 am, edited 1 time in total.
Seek and you shall find, knock and it shall be opened, cry and you shall find comfort
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: can't send email with nagios

Post by jdalrymple »

No idea what you have going on here. Is this truly sendmail, or is it Postfix, Exim, or some other?

What OS, and what version?

How did you install/configure your mailer?

What happens when you su to root and try to send mail?

This is more of a system issue than a Nagios issue. We're happy to help, but you might get better assistance on forums dedicated to your flavor of Linux since it's likely a problem that has been run into before.
majed
Posts: 98
Joined: Mon Mar 17, 2014 5:29 am

Re: can't send email with nagios

Post by majed »

the os is gentoo, there no mailer on the system other than sendmail. i had no luck in getting a reply on the gentoo forum.

i tried:

Code: Select all

nagios@nagios ~ $ echo "test sendmail" | /usr/sbin/sendmail -s "test" yourmail@domain.tld
got:

Code: Select all

WARNING: RunAsUser for MSP ignored, check group ids (egid=1000, want=209)
in /etc/passwd
nagios group id was 1000 and smmsp gid was 209. so i changed guid of nagios to 209 and added it to group smmsp but what mattered was changed the gid.

then the command started executing without error but in /var/log/messages:
i get:

Code: Select all

Aug 11 15:10:06 nagios sendmail[5813]: t7BCA6je005813: to=email address,test, ctladdr=nagios (1000/209), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=60014, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: 421 4.3.0 collect: Cannot write ./dft7BCA64D005814 (bfcommit, uid=0, gid=0): Permission denied
uid and gid=0 is that of root so i tried doing

Code: Select all

chown nagios:smmsp /usr/sbin/sendmail


and restarted sendmail, but that didn't help.

Code: Select all

nagios ~ # ls -l /var/spool/                                                total 120
drwxrwxr-x 2 smmsp nagios 106496 Aug 11 15:26 clientmqueue
drwxr-x--- 4 root  cron     4096 Jul 31 16:50 cron
drwxrwxr-x 2 smmsp nagios   4096 Aug  7 09:37 mail
drwxr-xr-x 2 smmsp nagios   4096 Aug  7 09:38 mqueue
knowing that nagios and smmsp groups have gid= 209

it's obviously a permission problem but i still don't know who needs the permission.
Seek and you shall find, knock and it shall be opened, cry and you shall find comfort
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: can't send email with nagios

Post by tgriep »

Take a look at this link to see if it helps you.
https://forums.gentoo.org/viewtopic-t-8 ... 51e74c042f
Be sure to check out our Knowledgebase for helpful articles and solutions!
majed
Posts: 98
Joined: Mon Mar 17, 2014 5:29 am

Re: can't send email with nagios

Post by majed »

thank you very much, weird i didn't find this post while searching the internet.
what solved it for me was setting the directory /var/spool/mqueue to root:root and then,

Code: Select all

chmod g+w /var/spool/mqueue
Seek and you shall find, knock and it shall be opened, cry and you shall find comfort
User avatar
tgriep
Madmin
Posts: 9177
Joined: Thu Oct 30, 2014 9:02 am

Re: can't send email with nagios [solved]

Post by tgriep »

That is good to hear. Shall I lock up this post?
Be sure to check out our Knowledgebase for helpful articles and solutions!
majed
Posts: 98
Joined: Mon Mar 17, 2014 5:29 am

Re: can't send email with nagios [solved]

Post by majed »

farewell
Seek and you shall find, knock and it shall be opened, cry and you shall find comfort
Locked