Page 1 of 1

Nagios Core

Posted: Wed Aug 02, 2017 6:58 pm
by ivp2015
not able to get get email notification from nagios core and contact is already added in contact.cfg,
also setup postfix and send mail use both

Use plugin

check-host-alive $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
check_dhcp $USER1$/check_dhcp $ARG1$
check_ftp $USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$
check_hpjd $USER1$/check_hpjd -H $HOSTADDRESS$ $ARG1$
check_http $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
check_imap $USER1$/check_imap -H $HOSTADDRESS$ $ARG1$
check_local_disk $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
check_local_load $USER1$/check_load -w $ARG1$ -c $ARG2$
check_local_mrtgtraf $USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$
check_local_procs $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
check_local_swap $USER1$/check_swap -w $ARG1$ -c $ARG2$
check_local_users $USER1$/check_users -w $ARG1$ -c $ARG2$
check_nt $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -s valley@@123 -v $ARG1$ $ARG2$
check_ping $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
check_pop $USER1$/check_pop -H $HOSTADDRESS$ $ARG1$
check_smtp $USER1$/check_smtp -H $HOSTADDRESS$ $ARG1$
check_snmp $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
check_ssh $USER1$/check_ssh $ARG1$ $HOSTADDRESS$
check_tcp $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
check_udp $USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
notify-host-by-email /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
notify-service-by-email /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
process-host-perfdata /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /usr/local/nagios/var/host-perfdata.out
process-service-perfdata /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /usr/local/nagios/var/service-perfdata.out

use https://www.unixmen.com/send-alerts-nag ... ail-yahoo/

https://support.nagios.com/forum/viewto ... =7&t=40122

Re: Nagios Core

Posted: Thu Aug 03, 2017 1:08 am
by tacolover101
i would try the suggestion outlined here - https://www.freelock.com/kb/postfix-relayhost

if that doesn't work, troubleshoot your way through the notification.
1. get it working over the command line, without Nagios
2. then set it up in Nagios once you confirm it's working

it could be a variety of different things ranging from your SMTP settings / where mail is installed - without any direct info it's hard to say.

Re: Nagios Core

Posted: Thu Aug 03, 2017 1:47 am
by vnoc
did you configure the mail server .

you will be finding it in below path check this once

vi /etc/mail.rc

at the bottom you have to configure the mail server ip port as below

set smtp=smtp://Mail Server IP
set from=" mail id" --from which you want to receive
set smtp-auth=login
set smtp-auth-username=username --- smtp mail username
set smtp-auth-password=password --- smtp mail password

Re: Nagios Core

Posted: Thu Aug 03, 2017 2:01 pm
by cdienger
Did the above suggestions help?

To tacolover101's point, try to determine where the problem is by trying to send an email from the command line. For example:

Code: Select all

/usr/bin/printf "test" | /bin/mail -s "test2" EXTERNALEMAIL@ADDRESS

Code: Select all

/usr/bin/printf "test" | /bin/mail -s "test2" root@localhost

Re: Nagios Core

Posted: Fri Aug 04, 2017 4:18 pm
by ivp2015
Hey its working here problem with my postfix

Thanks

Re: Nagios Core

Posted: Mon Aug 07, 2017 10:02 am
by bolson
May we close this topic?

Re: Nagios Core

Posted: Wed Aug 16, 2017 8:21 pm
by ivp2015
Yes, now my issue has been resolve Thanks a lot for your aggressive support.

Re: Nagios Core

Posted: Thu Aug 17, 2017 10:13 am
by bolson
Closing topic as resolved.

Thank you for using the Nagios Support Forum.