Page 1 of 1

Nagios Core 3.4 Issue in notification

Posted: Fri Aug 16, 2013 2:43 pm
by praveen.ks
I configured nagios core 3.4 in ubuntu 12.04, it's working fine and I installed postfix for mail notification

when am typing in terminal
root@ns:~# mail [email protected]
________________am getting mail____________


but, in nagios am not getting notification. In command.cfg file i given like this

'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}

# 'notify-service-by-email' command definition
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\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}


In contacts.cfg file i given like this

define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of user
email [email protected] ; CHANGE THIS TO YOUR EMAIL ADDRESS ******
}


Can anyone please check and tell me, how to resolve the issue

Re: Nagios Core 3.4 Issue in notification

Posted: Mon Aug 19, 2013 3:57 am
by gshergill
Hi praveen.ks,

We have a post on our website which goes through the installation of a mail server on Nagios for Ubuntu (or at least the best way I could find to). It is quite old but should still apply:

http://www.globility.co.uk/?p=386

In essence, you need to install heirloom-mailx after postfix, then edit the commands.cfg by changing the paths from /usr/bin/mail to /usr/bin/mailx.

Good luck!

Kind Regards,

Gary Shergill

Re: Nagios Core 3.4 Issue in notification

Posted: Mon Aug 19, 2013 12:34 pm
by lmiltchev
praveen.ks,

Let us know if the solution, posted by gshergill solved your problem.