Nagios 3.5 não envia notificações

2

As notificações automáticas do Nagios 3.5.0 (no Ubuntu) parecem não funcionar e o erro dado é "Nenhum contato foi encontrado para fins de notificação. Nenhuma notificação foi enviada". O abaixo pode ser encontrado no log de depuração:

[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.

Verificando a configuração Não vejo nenhum problema:

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
}

Um estranho é que as notificações personalizadas funcionam:

[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.

Qualquer ajuda será muito apreciada.

    
por Chris Lewis 04.06.2013 / 23:14

2 respostas

2

O problema é que você definiu o contato com todas as opções:

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

e entre eles, é a opção n (nenhum). Então você não recebeu nenhuma notificação. Remova a opção n do host e notificação de serviço em contato e problema resolvido.

    
por 11.11.2014 / 14:44
0

Acho que contactgroups deve ser contact_groups

    
por 11.07.2014 / 12:03