Page 1 of 1

Email notification not working (sendmail)

Posted: Thu Mar 24, 2016 7:22 pm
by arvmanya
Hi, I have installed sendmail and did the configuration with my SMTP server but email notification is not working. I am able to send emails command line with both root and nagios users. I checked the configuraion in commands.cfg file and it seems ok to me. Below logs from Nagios.log file and mail.log file.

Nagios.log -
[1458863451] HOST NOTIFICATION: nagiosadmin;Windows S1;CUSTOM (UP);notify-host-by-email;PING OK - Packet loss = 0%, RTA = 0.61 ms;Nagios Admin;Sample Custom
[1458863470] SERVICE NOTIFICATION: nagiosadmin;Windows S1;C:\ Drive Space;CRITICAL;notify-service-by-email;c:\ - total: 63.66 Gb - used: 61.75 Gb (97%) - free 1.90 Gb (3%)
[1458863478] HOST ALERT: NWPrinter1;DOWN;SOFT;7;PING CRITICAL - Packet loss = 100%
[1458863481] wproc: Core Worker 1205: job 22 (pid=5746) timed out. Killing it
[1458863481] wproc: NOTIFY job 22 from worker Core Worker 1205 timed out after 30.01s
[1458863481] wproc: host=Windows 8.1 Pro; service=(none); contact=nagiosadmin
[1458863481] wproc: early_timeout=1; exited_ok=0; wait_status=0; error_code=62;
[1458863481] Warning: Notifying contact 'nagiosadmin' of host 'Windows S1' by command '/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: CUSTOM\nHost: Windows S1\nState: UP\nAddress: 10.221.55.15\nInfo: PING OK - Packet loss = 0%, RTA = 0.61 ms\n\nDate/Time: Thu Mar 24 16:50:51 PDT 2016\n" | /usr/sbin/sendmail -s 10.221.176.3:2525 -t [email protected] -f [email protected] -l /var/log/sendemail -u "** CUSTOM Host Alert: Windows S1 is UP **" -m "***** Nagios *****\n\nNotification Type: CUSTOM\nHost: Windows S1\nState: UP\nAddress: 10.221.55.15\nInfo: PING OK - Packet loss = 0%, RTA = 0.61 ms\n\nDate/Time: Thu Mar 24 16:50:51 PDT 2016\n"' timed out after 0.00 seconds
[1458863481] wproc: Core Worker 1205: job 22 (pid=5746): Dormant child reaped
[1458863482] SERVICE NOTIFICATION: nagiosadmin;Windows 8.1 Pro;Printer1;UNKNOWN;notify-service-by-email;Unknown command(s): check_pqueue
[1458863492] HOST ALERT: NWPrinter;DOWN;SOFT;8;PING CRITICAL - Packet loss = 100%
[1458863494] SERVICE NOTIFICATION: nagiosadmin;Windows 8.1 Pro;testps1;WARNING;notify-service-by-email;Test
[1458863500] wproc: Core Worker 1204: job 23 (pid=5811) timed out. Killing it
[1458863500] wproc: NOTIFY job 23 from worker Core Worker 1204 timed out after 30.01s
[1458863500] wproc: host=Windows 8.1 Pro; service=C:\ Drive Space; contact=nagiosadmin
[1458863500] wproc: early_timeout=1; exited_ok=0; wait_status=0; error_code=62;
[1458863500] Warning: Notifying contact 'nagiosadmin' of service 'C:\ Drive Space' on host 'Windows S1' by command '/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: PROBLEM\n\nService: C:\ Drive Space\nHost: windows S1\nAddress: 10.221.55.15\nState: CRITICAL\n\nDate/Time: Thu Mar 24 16:51:10 PDT 2016\n\nAdditional Info:\n\nc:\ - total: 63.66 Gb - used: 61.75 Gb (97%) - free 1.90 Gb (3%)" | /usr/sbin/sendmail -s 10.221.176.3:2525 -t [email protected] -f [email protected] -l /var/log/sendemail -u "** PROBLEM Service Alert: windows S1/C:\ Drive Space is CRITICAL **" -m "***** Nagios *****\n\nNotification Type: PROBLEM\n\nService: C:\ Drive Space\nHost: windows S1\nAddress: 10.211.55.15\nState: CRITICAL\n\nDate/Time: Thu Mar 24 16:51:10 PDT 2016\n\nAdditional Info:\n\nc:\ - total: 63.66 Gb - used: 61.75 Gb (97%) - free 1.90 Gb (3%)"' timed out after 0.00 seconds
[1458863500] wproc: Core Worker 1204: job 23 (pid=5811): Dormant child reaped

Mail.log -

Mar 24 16:43:41 ubuntu sm-mta[3467]: starting daemon (8.14.4): SMTP+queueing@00:10:00
Mar 24 16:43:43 ubuntu sm-msp-queue[2530]: unable to qualify my own domain name (ubuntu) -- using short name
Mar 24 16:43:43 ubuntu sm-msp-queue[2530]: dangerous permissions=42775 on queue directory /var/spool/mqueue-client/
Mar 24 16:44:09 ubuntu sendmail[4226]: My unqualified host name (ubuntu) unknown; sleeping for retry
Mar 24 16:44:27 ubuntu sendmail[4335]: My unqualified host name (ubuntu) unknown; sleeping for retry
Mar 24 16:45:21 ubuntu sendmail[4526]: My unqualified host name (ubuntu) unknown; sleeping for retry
Mar 24 16:45:27 ubuntu sendmail[4559]: My unqualified host name (ubuntu) unknown; sleeping for retry
Mar 24 16:46:02 ubuntu sendmail[4753]: My unqualified host name (ubuntu) unknown; sleeping for retry
Mar 24 16:47:14 ubuntu sendmail[5003]: My unqualified host name (ubuntu) unknown; sleeping for retry
Mar 24 16:47:25 ubuntu sendmail[5044]: My unqualified host name (ubuntu) unknown; sleeping for retry
Mar 24 16:50:11 ubuntu sendmail[5612]: My unqualified host name (ubuntu) unknow$
Mar 24 16:50:51 ubuntu sendmail[5748]: My unqualified host name (ubuntu) unknow$

Could you please help and let me know solution of it.

Regards,
Arvind

Re: Email notification not working (sendmail)

Posted: Fri Mar 25, 2016 6:12 am
by rhassing
I think you should start by setting a FQDN for your host. mail.log complains about Ubuntu is an unqualified host name

Re: Email notification not working (sendmail)

Posted: Fri Mar 25, 2016 9:49 am
by rkennedy
@rhassing is right, set a FQDN and let us know what your maillog is showing after doing so. The Nagios portion is firing the notification properly.

Re: Email notification not working (sendmail)

Posted: Sun Mar 27, 2016 5:38 pm
by arvmanya
Thanks for the help !
I did the changes, as suggested, and now I am getting permission denied error. Following Nagios log and mail log.

Nagios log -
[1458920200] EXTERNAL COMMAND: SEND_CUSTOM_SVC_NOTIFICATION;Windows S1;C:\ Drive Space;0;Nagios Admin;Test Notificatio$
[1458920200] SERVICE NOTIFICATION: nagiosadmin;Windows S1;C:\ Drive Space;CUSTOM (CRITICAL);notify-service-by-email;c:$
[1458920200] wproc: NOTIFY job 5 from worker Core Worker 1260 is a non-check helper but exited with return code 71
[1458920200] wproc: host=Windows S1; service=C:\ Drive Space; contact=nagiosadmin
[1458920200] wproc: early_timeout=0; exited_ok=1; wait_status=18176; error_code=0;
[1458920200] wproc: stdout line 01: WARNING: RunAsUser for MSP ignored, check group ids (egid=1001, want=127)
[1458920200] wproc: stdout line 02: can not write to queue directory /var/spool/mqueue-client/ (RunAsGid=1001, required=1$

Mail log -
Mar 25 08:34:30 arvind sm-mta[1556]: gethostbyaddr(10.221.55.10) failed: 2
Mar 25 08:34:30 arvind sm-mta[1576]: starting daemon (8.14.4): SMTP+queueing@00:10:00
Mar 25 08:34:32 arvind sm-msp-queue[2609]: dangerous permissions=42775 on queue directory /var/spool/mqueue-client/
Mar 25 08:36:40 arvind sendmail[4730]: NOQUEUE: SYSERR(nagios): can not write to queue directory /var/spool/mqueue-client/$
Mar 25 08:36:40 arvind sendmail[4730]: dangerous permissions=42775 on queue directory /var/spool/mqueue-client/

I updated the permissions as well, for the /var/spool/mqueue-client/ directory, tried 775 and 770, but no luck. Also, added nagios user to smmsp group, even that did not work. Will check it further and update you all.

Regards,
Arvind

Re: Email notification not working (sendmail)

Posted: Mon Mar 28, 2016 9:35 am
by rkennedy
Are you running SELinux on this machine? Can you run the following commands, and post the output?

Code: Select all

getenforce
ls -l  /var/spool/mqueue-client/
 /var/spool/

Re: Email notification not working (sendmail)

Posted: Mon Mar 28, 2016 11:54 am
by arvmanya
No, SELinus is not installed on this machine. Output of the commands, as asked.

getenforce
The program 'getenforce' is currently not installed. You can install it by typing:
sudo apt-get install selinux-utils

ls -l /var/spool/mqueue-client/
total 0

ls -l /var/spool/
total 36
drwxr-xr-x 2 root root 4096 Apr 21 2015 anacron
drwxr-xr-x 3 root root 4096 Feb 18 2015 cron
drwx--x--- 3 root lp 4096 Feb 18 2015 cups
drwxr-xr-x 3 root root 4096 Feb 18 2015 libreoffice
drwxr-xr-x 2 root root 4096 Mar 29 2014 lintian
lrwxrwxrwx 1 root root 7 Apr 21 2015 mail -> ../mail
drwxr-sr-x 2 smmta smmsp 4096 Mar 18 16:20 mqueue
drwxrws--- 2 smmsp smmsp 4096 Mar 18 15:32 mqueue-client
drwxr-xr-x 2 root root 4096 Apr 11 2014 plymouth
drwx------ 2 syslog adm 4096 Dec 4 2013 rsyslog

Re: Email notification not working (sendmail)

Posted: Mon Mar 28, 2016 2:34 pm
by hsmith
What was the error in the mail log after you changed the permissions on the mqueue-client directory?

Did you follow a guide to set this up? If so, can you please link us to said guide?