Page 2 of 3

Re: Nagios email alerts

Posted: Fri Jan 06, 2017 4:28 pm
by dwhitfield
spyder13337 wrote:Damm sorry about that it
No problem.

So, there's a difference in ls -l between Cent and Debian, so let's try ls -la /usr/sbin/sendmail instead.

It's not your issue, but NRPE is now on version 3.01, so that's something to think about. :)

Re: Nagios email alerts

Posted: Mon Jan 09, 2017 12:53 pm
by spyder13337
do i need to config sendmail

Re: Nagios email alerts

Posted: Mon Jan 09, 2017 1:00 pm
by dwhitfield
Not necessarily differently than you have, and not necessarily at all.

Here's what mine looks like in CentOS

Code: Select all

[root@centos7x64 ~]# ls -l /usr/sbin/sendmail
lrwxrwxrwx. 1 root root 21 Mar  1  2016 /usr/sbin/sendmail -> /etc/alternatives/mta
What I'm trying to get at is whether sendmail is actually sendmail. There's generally some aliasing that goes on with mail clients.

Let's go ahead and get the output for mail as well. On mine, that looks like the following.

Code: Select all

[root@centos7x64 ~]# ls -l /usr/bin/mail
lrwxrwxrwx 1 root root 5 Dec 21 11:37 /usr/bin/mail -> mailx
And finally, postfix:

Code: Select all

[root@centos7x64 ~]# ls -l /usr/sbin/postfix
-rwxr-xr-x. 1 root root 121992 Jun  9  2014 /usr/sbin/postfix
It would be handy to see your postfix configuration as well, scrubbed of course.

Re: Nagios email alerts

Posted: Mon Jan 09, 2017 4:48 pm
by spyder13337
i have this errror that i keep getting in nagios log file

SERVICE NOTIFICATION: nagiosadmin;LATA Connect.158;Load Balance;CRITICAL;notify-service-by-email;CRITICAL - load average: 26.40, 24.22, 22.98
[1483997419] wproc: NOTIFY job 18263 from worker Core Worker 26231 is a non-check helper but exited with return code 2
[1483997419] wproc: host=LATA Connect.158; service=Load Balance; contact=nagiosadmin
[1483997419] wproc: early_timeout=0; exited_ok=1; wait_status=512; error_code=0;
[1483997419] wproc: stderr line 01: /bin/sh: 1: Syntax error: Unterminated quoted string

how can i debug this i believe this where the issue lies

Re: Nagios email alerts

Posted: Mon Jan 09, 2017 4:50 pm
by spyder13337
if i install postfix i have to removed sendmail-bin
should i install ???

Re: Nagios email alerts

Posted: Mon Jan 09, 2017 5:00 pm
by dwhitfield
Looks like you are missing a " in the following:

Code: Select all

define command {
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\Additional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -a “** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
I only count 5. I think that's where your issue is.

Re: Nagios email alerts

Posted: Mon Jan 09, 2017 5:30 pm
by spyder13337
i notice the issue too i made the adjustment

is this correct i

under /var/spool

drwxr-s--- 2 smmta smmsp 4096 Jul 3 2016 mqueue
drwxrws--- 2 smmsp smmsp 4096 Jul 3 2016 mqueue-client

i gettting this issue

SERVICE NOTIFICATION: nagiosadmin;Physicians Preferred Pharmacy;Memory Usage;CRITICAL;notify-service-by-email;CRITICAL - 0.8% (34176 kB) free!
Jan 09 17:24:39 Nagios sendmail[19060]: NOQUEUE: SYSERR(nagios): can not chdir(/var/spool/mqueue-client/): Permission denied
Jan 09 17:24:39 Nagios nagios[18722]: wproc: NOTIFY job 36 from worker Core Worker 18726 is a non-check helper but exited with return code 78
Jan 09 17:24:39 Nagios nagios[18722]: wproc: host=Physicians Preferred Pharmacy; service=Memory Usage; contact=nagiosadmin
Jan 09 17:24:39 Nagios nagios[18722]: wproc: early_timeout=0; exited_ok=1; wait_status=19968; error_code=0;
Jan 09 17:24:39 Nagios nagios[18722]: wproc: stderr line 01: Program mode requires special privileges, e.g., root or TrustedUser.
Jan 09 17:24:39 Nagios nagios[18722]: wproc: stdout line 01: WARNING: RunAsUser for MSP ignored, check group ids (egid=1001, want=124)
Jan 09 17:24:39 Nagios nagios[18722]: wproc: stdout line 02: can not chdir(/var/spool/mqueue-client/): Permission denied

Re: Nagios email alerts

Posted: Mon Jan 09, 2017 7:26 pm
by spyder13337
i kinda sotred got pass that Permissed issue ands now i get

wproc: NOTIFY job 154 from worker Core Worker 22099 is a non-check helper but exited with return code 64
[1484007416] wproc: host=Genuine Debt Solutions; service=Total Processes; contact=nagiosadmin
[1484007416] wproc: early_timeout=0; exited_ok=1; wait_status=16384; error_code=0;
[1484007416] wproc: stdout line 01: WARNING: RunAsUser for MSP ignored, check group ids (egid=1001, want=124)
[1484007416] wproc: stdout line 02: Alert:... List:; syntax illegal for recipient addresses


i also ran this command

usermod -a -G snmsp nagios

Re: Nagios email alerts

Posted: Mon Jan 09, 2017 7:42 pm
by spyder13337
i got it to work had to switch form /usr/sbin/sendmail-s to /usr/bin/mail -s

but know i have a blank subject line

Re: Nagios email alerts

Posted: Mon Jan 09, 2017 8:00 pm
by spyder13337
issue resoled i need to commnet oout host-perfdata in nagios.cfg file it work perfect now