-1

I've tried to figure this out but im failing thus or maybe im overlooking something. I've setup nagios server and clients. The problem im having is that the server does not send an email to the contact or contactgroup. Instead I see all the notifications in /var/log/syslog (ubuntu server).

Postfix is installed fine and i have sent numerous tests using mail and mailx (read somewhere that mailx was preferred by nagios3).

I should also mention, the same problem is happening on Icinga which runs on the same host.

Any help would be greatly appreciated.

Thanks,

Patrick

pdtpatrick
  • 175
  • 2
  • 8

2 Answers2

0

You config file command.cfg should have something similar to this:

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$
}

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$" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}

And edit file contact.cfg so it looks something like this:

define contact{
        contact_name                    nagiosadmin             ; Short name of user
        use                             generic-contact         ; Inherit default 
        alias                           Nagios Admin            ; Full name of user


       email                           tandn@eposi.vn  ; <<***** CHANGE THIS TO Email
        }

Afterwards, check nagios then restart it:

sudo /usr/local/nagios/bin/nagios -v /etc/nagios/nagios.cfg
sudo /etc/init.d/nagios restart
Mei
  • 1,129
  • 1
  • 11
  • 20
Dominic
  • 5
  • 1
  • 5
-1

Stop postfix and try with Sendmail, It will work

amber_linux
  • 197
  • 1
  • 3