No announcement yet.

Email Notifications

  • Filter
  • Time
  • Show
Clear All
new posts

  • Email Notifications

    I am having issues with getting postfix to work. I am able to send mail using sendmail to the exchange server but when a host goes down it does not send the notification. Looking in Centreon the Notification has been in fact sent.

    Last Notification 2012/05/04 - 14:33:17
    Next Notification 2012/05/04 - 14:36:17

    I have installed Centreon 2.3.7 with nagios 3.2.1.

    I did get an error when I was installing Centreon in regards to the mail binary file. I pointed it to the /etc/init.d directory.

    I realize this my be an extremely noobie questions but any help would be greatly appreciated.

  • #2
    Here are my logical trouble shooting steps. I have looked a the Commands.cfg

    root@Monitoring:/usr/local/nagios/etc/objects# nano commands.cfg

    Here is the command that is being run by nagios:

    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type:



    /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is


    Here is a test to make sure that mailx is working and it does.

    echo somemessage | /usr/bin/mail -s somesubject

    But I'm still not getting mail but looking that the nagios log I should be.

    [1336172825] HOST NOTIFICATION: Dan_Lypian;dlypian;DOWN;host-notify-

    by-email;CRITICAL - rta nan, lost 100%

    Can any one tell me why this not working?



    • #3

      If Postfix is installed on your Centreon server, check the configuration file and make sure that you have the line "relayhhost = address_of_your_echange_server" correctly configured.
      You will maybe need to deactivate smtp authentication on your exchange server for the Centreon Server (or whitelist Centreon server).

      Then, test again to send a mail with :

      mail -s

      Don't forget the dot at the end of your email.

      Check also the /var/log/mail.log to see if everything is OK

      Ubuntu server 10.04 LTS 64 Bits - Haute dispo 4 serveurs centraux (réplication MySQL + VIP + Rsync)
      Nagios 3.3.1 | Centreon 2.3.9 | Centreon-Broker 2.1.1 | 2000 hôtes - 5000 services | 6 Remote Pollers

      Dev : CES 2.2 - Centengine - Centreon 2.4.1


      • #4
        Thanks for your help!!!

        When i do the mail command the mail is sent without any issues! I provided the command below. I have also confirmed that the relay has been configured with the proper IP. (I did find it strange that I needed to type the email address twice I dont use postfix much so not sure if that normal)

        vadmin@Monitoring:/etc/postfix$ mail -s

        When I look at the postfix log all i get is stuff that I have sent via the command line.

        May 6 07:40:15 Monitoring postfix/pickup[19972]: 5A141A4391: uid=0 from=<root>
        May 6 07:40:15 Monitoring postfix/cleanup[32276]: 5A141A4391: message-id=<20120506134015.5A141A4391@Monitoring>
        May 6 07:40:15 Monitoring postfix/qmgr[1099]: 5A141A4391: from=<>, size=634, nrcpt=1 (queu$
        May 6 07:40:15 Monitoring postfix/local[32340]: 5A141A4391: to=<>, orig_to=<root>, relay=l$
        May 6 07:40:15 Monitoring postfix/qmgr[1099]: 5A141A4391: removed
        May 6 14:58:25 Monitoring postfix/pickup[2210]: E70FEA4394: uid=1000 from=<vadmin>
        May 6 14:58:25 Monitoring postfix/cleanup[20693]: E70FEA4394: message-id=<20120506205825.E70FEA4394@Monitoring>
        May 6 14:58:26 Monitoring postfix/qmgr[1099]: E70FEA4394: from=<>, size=386, nrcpt=2 (qu$
        May 6 14:58:28 Monitoring postfix/smtp[20752]: E70FEA4394: to=<>, relay=[1$
        May 6 14:58:28 Monitoring postfix/smtp[20752]: E70FEA4394: to=<>, relay=[192.168$
        May 6 14:58:28 Monitoring postfix/qmgr[1099]: E70FEA4394: removed
        May 6 15:02:10 Monitoring postfix/pickup[2210]: D04A4A4394: uid=1000 from=<vadmin>
        May 6 15:02:10 Monitoring postfix/cleanup[19977]: D04A4A4394: message-id=<20120506210210.D04A4A4394@Monitoring>
        May 6 15:02:10 Monitoring postfix/qmgr[1099]: D04A4A4394: from=<>, size=366, nrcpt=1 (qu$
        May 6 15:02:11 Monitoring postfix/smtp[20001]: D04A4A4394: to=<>, relay=[1$
        May 6 15:02:11 Monitoring postfix/qmgr[1099]: D04A4A4394: removed

        It's as if nagios isn't sending the mail requet to Postfix. But looking in Centreon GUI it tells me the notifications are constantly being sent:

        Last Notification 2012/05/06 - 15:05:28
        Next Notification 2012/05/06 - 15:08:28
        I have rebooted the server and tried reconfigure

        /usr/local/nagios/etc/objectscommands.cfg with /usr/bin/mail and /usr/bin/mailx without and change.

        I have also checked the contacts.cfg and I can see anything wrong but I am new to nagios and centreon and I figured I'd add the config so you could look it over.

        define contact{
        contact_name Dan_Lypian
        alias admin
        contactgroups Supervisors
        host_notification_period 24x7
        service_notification_period 24x7
        host_notification_options d,u
        service_notification_options n
        host_notification_commands host-notify-by-email
        service_notification_commands service-notify-by-email

        I have also created a host that is constantly down so that it will constanly send notifications here is the hosts.cfg for that host.

        define host{
        host_name dlypian
        use generic-host
        alias dlypianVPN
        _HOST_ID 15
        check_command check_host_alive
        max_check_attempts 3
        check_interval 3
        retry_interval 3
        active_checks_enabled 1
        passive_checks_enabled 1
        check_period 24x7
        contact_groups Supervisors
        contacts Dan_Lypian
        notification_interval 3
        first_notification_delay 3
        notification_period 24x7
        notification_options d,u
        notifications_enabled 1

        I am completely stumped at this point and figure i should start looking for ways to debug nagios in further detail. It is my understanding that Nagios is whats actually running the mail command is that correct?

        Anything you can do to help would be greatlly appreciated and thanks you for you time!!!



        • #5
          I have resolved this issue. It appears all the commands are stored in SQL database and the text cfg files are simply there for Nagios to use and when you change them the simple get changed back by Ndoutils.That being said if some would like to clearify how this work that would be greatly appreciated.


          I need to go into the Centreon GUI under configuration | Commands | Notifications then select host-notify-by-email then edited the command line to the line below.

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