Sunday, February 17, 2013

Centreon Not Sending Notification Emails

Problem


After finally installing Centreon 2.4 on CentOS 6.3, all was up and running, one issue I had left. No email notifications were sent when a host was down although everything seemed to be correctly configured from the GUI (contacts, notification period, etc).

Looking at  /var/log/maillog gave no hints.
But checking /usr/local/nagios/var/nagios.log was helpful.
[1361058638] HOST NOTIFICATION: Supervisor;Centreon2;DOWN;host-notify-by-email;CRITICAL - 192.168.189.59: Host unreachable @ 192.168.189.36. rta nan, lost 100%
[1361058638] Warning: Attempting to execute the command "/usr/bin/printf "%b" "***** centreon Notification *****\n\nType:PROBLEM\nHost: Centreon2\nState: DOWN\nAddress: 192.168.189.59\nInfo: CRITICAL - 192.168.189.59: Host unreachable @ 192.168.189.36. rta nan, lost 100%\nDate/Time: 17-02-2013" |  -s "Host DOWN alert for Centreon2!" email@gmail.com" resulted in a return code of 127.  Make sure the script or binary you are trying to execute actually exists...

There is no command before the -s and the pipe. This results in email delivery failure.


Solution


This can be fixed from the GUI.
In Centreon go to Configuration -> Commands, select Notifications from the left.
Two commands need to be edited: host-notify-by-email and service-notify-by-email.
The string /bin/mail has to be inserted after the pipe. Then, export Nagios settings. Of course this fix implies that running /bin/mail from the command line results in successful email delivery.





5 comments:

  1. Replies
    1. Thanks ;)

      Do you receive an irrelevant "HOST UP" mail with every CRITICAL/WARNING... mail ?

      Delete
  2. Mickaël,

    With your Centreon, please try the steps as below:

    1. Click Configuration>Users, and then click the user account which has such issue.
    2. At "Service Notification Commands", add "notify-by-sendmailservices" to the "Selected" field, and remove "host-notify-by-sendmailhost" or "host-notify-by-email", if any.
    3. Click "save", and restart Nagios.

    I wish this might be helpful to you.

    ReplyDelete
  3. I had the same problem, and I had it in the configuration of my order "Service-notify-by-email" at SERVICEOUTPUT $ $ \ n "| / bin / mail-s" I put "/ usr / bin / mail-s "instead of" / bin / mail-s "

    ReplyDelete
  4. How do i check email queue to be sent to make sure this is working

    ReplyDelete