2

The automated notifications from Nagios 3.5.0 (on Ubuntu) don't seem to work and the error given is "No contacts were found for notification purposes. No notification was sent out". The below can be found in the debug log:

[1370347017.047457] [032.0] [pid=30297] ** Service Notification Attempt ** Host:     'nbsrvcomp-11', Service: 'Number open file descriptors', Type: 0, Options: 0, Current State: 1, Last Notification: Thu Jan  1 01:00:00 1970
[1370347017.047520] [032.0] [pid=30297] Notification viability test passed.
[1370347017.047530] [032.1] [pid=30297] Current notification number: 1 (incremented)
[1370347017.047539] [032.1] [pid=30297] Service notification will NOT be escalated.
[1370347017.047545] [032.1] [pid=30297] Adding normal contacts for service to notification list.
[1370347017.047555] [032.0] [pid=30297] No contacts were found for notification purposes.  No notification was sent out.

Checking the config I can't see any problems:

root@nbsrvnagi-01v:/etc/apache2# grep -i enable_notifications /usr/local/nagios/etc/nagios.cfg
enable_notifications=1

root@nbsrvnagi-01v:/etc/apache2# grep cfg /usr/local/nagios/etc/nagios.cfg
cfg_file=/etc/nagiosql/timeperiods.cfg
cfg_file=/etc/nagiosql/commands.cfg
cfg_file=/etc/nagiosql/contacts.cfg
cfg_file=/etc/nagiosql/contactgroups.cfg
cfg_file=/etc/nagiosql/contacttemplates.cfg
cfg_dir=/etc/nagiosql/hosts
cfg_file=/etc/nagiosql/hosttemplates.cfg
cfg_file=/etc/nagiosql/hostgroups.cfg
cfg_file=/etc/nagiosql/hostextinfo.cfg
cfg_file=/etc/nagiosql/hostescalations.cfg
cfg_file=/etc/nagiosql/hostdependencies.cfg
cfg_dir=/etc/nagiosql/services
cfg_file=/etc/nagiosql/servicetemplates.cfg
cfg_file=/etc/nagiosql/servicegroups.cfg
cfg_file=/etc/nagiosql/serviceextinfo.cfg
cfg_file=/etc/nagiosql/serviceescalations.cfg
cfg_file=/etc/nagiosql/servicedependencies.cfg

root@nbsrvnagi-01v:/etc/apache2# cat /etc/nagiosql/contactgroups.cfg
define contactgroup {
        contactgroup_name               admins
        alias                           Nagios Administrators
        members                         chlewis
        register                        1
}
root@nbsrvnagi-01v:/etc/apache2# cat /etc/nagiosql/contacts.cfg
define contact {
        contact_name                    chlewis
        alias                           Chris Lewis
        contactgroups                   admins
        host_notifications_enabled      1
        service_notifications_enabled   1
        host_notification_period        24x7
        service_notification_period     24x7
        host_notification_options       d,u,r,f,s,n
        service_notification_options    w,u,c,r,f,s,n
        host_notification_commands      notify-host-by-email
        service_notification_commands   notify-service-by-email
        can_submit_commands             1
        email                           <removed>
        register                        1
        }
root@nbsrvnagi-01v:/etc/apache2# cat /etc/nagiosql/services/check_open_fds.cfg
define service {
        #NAGIOSQL_CONFIG_NAME           check_open_fds
        hostgroup_name                  *
        service_description             Number open file descriptors
        display_name                    Number open file descriptors
        check_command                   check_nrpe!check_oepn_fds
        max_check_attempts              5
        check_interval                  5
        retry_interval                  3
        check_period                    24x7
        event_handler                   notify-service-by-email
        notification_interval           120
        notification_period             24x7
        notification_options            w,u,c,r,f,s
        contact_groups                  admins
        register                        1
}
root@nbsrvnagi-01v:/etc/apache2# cat /etc/nagiosql/servicetemplates.cfg
define service {
        name                            generic-service
        is_volatile                     0
        max_check_attempts              4
        check_interval                  5
        retry_interval                  1
        active_checks_enabled           1
        passive_checks_enabled          1
        check_period                    24x7
        parallelize_check               1
        obsess_over_service             1
        check_freshness                 0
        event_handler                   notify-service-by-email
        event_handler_enabled           1
        flap_detection_enabled          1
        process_perf_data               1
        retain_status_information       1    
        retain_nonstatus_information    1
        notification_interval           0
        notification_period             24x7
        notification_options            w,u,c,r
        notifications_enabled           1
        contact_groups                  admins
        failure_prediction_enabled      1
        register                        0    
}

root@nbsrvnagi-01v:/etc/apache2# cat /etc/nagiosql/commands.cfg
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$
        register                        1
}

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

One strange this is that custom notifications work:

[1370347216.906200] [032.0] [pid=30297] ** Service Notification Attempt ** Host: 'nbsrvcomp-11', Service: 'Number open file descriptors', Type: 99, Options: 0, Current State: 1, Last Notification: Thu Jan  1 01:00:00 1970
[1370347216.906295] [032.0] [pid=30297] Notification viability test passed.
[1370347216.906304] [032.1] [pid=30297] Current notification number: 0 (unchanged)
[1370347216.906317] [032.1] [pid=30297] Service notification will NOT be escalated.
[1370347216.906329] [032.1] [pid=30297] Adding normal contacts for service to notification list.

Any help will be much appreciated.

2 Answers2

2

The problem is due to you have defined the contact with all the options:

host_notification_options       d,u,r,f,s,n
service_notification_options    w,u,c,r,f,s,n

and among them, is the option n (none). So, you didn't receive any notifications. Remove option n from host and service notification in contact and problem resolved.

HBruijn
  • 77,029
  • 24
  • 135
  • 201
Marisa
  • 21
  • 2
0

I think that contactgroups must be contact_groups

adekock11
  • 109
  • 1