Nagios email alerts

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.
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Nagios email alerts

Post 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. :)
spyder13337
Posts: 68
Joined: Tue Oct 06, 2015 9:50 pm

Re: Nagios email alerts

Post by spyder13337 »

do i need to config sendmail
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Nagios email alerts

Post 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.
spyder13337
Posts: 68
Joined: Tue Oct 06, 2015 9:50 pm

Re: Nagios email alerts

Post 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
spyder13337
Posts: 68
Joined: Tue Oct 06, 2015 9:50 pm

Re: Nagios email alerts

Post by spyder13337 »

if i install postfix i have to removed sendmail-bin
should i install ???
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Nagios email alerts

Post 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.
spyder13337
Posts: 68
Joined: Tue Oct 06, 2015 9:50 pm

Re: Nagios email alerts

Post 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
spyder13337
Posts: 68
Joined: Tue Oct 06, 2015 9:50 pm

Re: Nagios email alerts

Post 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
spyder13337
Posts: 68
Joined: Tue Oct 06, 2015 9:50 pm

Re: Nagios email alerts

Post 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
spyder13337
Posts: 68
Joined: Tue Oct 06, 2015 9:50 pm

Re: Nagios email alerts

Post by spyder13337 »

issue resoled i need to commnet oout host-perfdata in nagios.cfg file it work perfect now
Locked