LINUX.ORG.RU
решено ФорумAdmin

nagios notify-by-email


0

1

Приветствую.

Проблема следующая, в логе появляются записи о состоянии сервиса, но email не отправляется. Сам скрипт отправки e-mail работает нормально. Куда копать?

/var/log/nagios/nagios.log

[1296308446] SERVICE ALERT: 46.4.69.98;MySQL_nti-sys;CRITICAL;SOFT;1;Access denied for user 'nag'@'localhost' (using password: YES)
[1296308456] SERVICE ALERT: 46.4.69.98;MySQL_nti-sys;CRITICAL;SOFT;2;Access denied for user 'nag'@'localhost' (using password: YES)
[1296308466] SERVICE ALERT: 46.4.69.98;MySQL_nti-sys;CRITICAL;SOFT;3;Access denied for user 'nag'@'localhost' (using password: YES)
[1296308476] SERVICE ALERT: 46.4.69.98;MySQL_nti-sys;CRITICAL;HARD;4;Access denied for user 'nag'@'localhost' (using password: YES)
[1296308476] SERVICE NOTIFICATION: nagios-admin;46.4.69.98;MySQL_nti-sys;CRITICAL;notify-by-email;Access denied for user 'nag'@'localhost' (using password: YES)
[1296308776] SERVICE NOTIFICATION: nagios-admin;46.4.69.98;MySQL_nti-sys;CRITICAL;notify-by-email;Access denied for user 'nag'@'localhost' (using password: YES)
[1296309076] SERVICE NOTIFICATION: nagios-admin;46.4.69.98;MySQL_nti-sys;CRITICAL;notify-by-email;Access denied for user 'nag'@'localhost' (using password: YES)
[1296309376] SERVICE NOTIFICATION: nagios-admin;46.4.69.98;MySQL_nti-sys;CRITICAL;notify-by-email;Access denied for user 'nag'@'localhost' (using password: YES)
[1296309676] SERVICE NOTIFICATION: nagios-admin;46.4.69.98;MySQL_nti-sys;CRITICAL;notify-by-email;Access denied for user 'nag'@'localhost' (using password: YES)
[1296309976] SERVICE NOTIFICATION: nagios-admin;46.4.69.98;MySQL_nti-sys;CRITICAL;notify-by-email;Access denied for user 'nag'@'localhost' (using password: YES)
[1296310276] SERVICE NOTIFICATION: nagios-admin;46.4.69.98;MySQL_nti-sys;CRITICAL;notify-by-email;Access denied for user 'nag'@'localhost' (using password: YES)
[1296310426] SERVICE ALERT: 46.4.69.98;MySQL_nti-sys;OK;HARD;4;Uptime: 49631  Threads: 3  Questions: 1740956  Slow queries: 0  Opens: 88389  Flush tables: 1  Open tables: 40  Queries per second avg: 35.078
[1296310426] SERVICE NOTIFICATION: nagios-admin;46.4.69.98;MySQL_nti-sys;OK;notify-by-email;Uptime: 49631  Threads: 3  Questions: 1740956  Slow queries: 0  Opens: 88389  Flush tables: 1  Open tables: 40  Queries per second avg: 35.078

commands.cfg

# 'notify-by-email' command definition
define command{
        command_name    notify-by-email
        command_line    sh /etc/nagios/msg.sh "notify-by-email $NOTIFICATIONTYPE$  $HOSTNAME$" "$HOSTNAME$  $HOSTADDRESS$  $HOSTOUTPUT$ $HOSTSTATE$ $LONGDATETIME$"
        }

localhost.cfg

define host{
        name                            generic-host    ; The name of this host template
        notifications_enabled           1               ; Host notifications are enabled
        event_handler_enabled           1               ; Host event handler is enabled
        flap_detection_enabled          1               ; Flap detection is enabled
        failure_prediction_enabled      1               ; Failure prediction is enabled
        process_perf_data               1               ; Process performance data
        retain_status_information       1               ; Retain status information across program restarts
        retain_nonstatus_information    1               ; Retain non-status information across program restarts
        notification_period             24x7            ; Send host notifications at any time
        register                        0               ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
        }


# Linux host definition template - This is NOT a real host, just a template!

define host{
        name                            linux-server    ; The name of this host template
        use                             generic-host    ; This template inherits other values from the generic-host template
        check_period                    24x7            ; By default, Linux hosts are checked round the clock
        max_check_attempts              10              ; Check each Linux host 10 times (max)
        check_command                   check-host-alive ; Default command to check Linux hosts
        notification_period             workhours       ; Linux admins hate to be woken up, so we only notify during the day
                                                        ; Note that the notification_period variable is being overridden from
                                                        ; the value that is inherited from the generic-host template!
        notification_interval           20              ; Resend notification every 2 hours
        notification_options            d,u,r           ; Only send notifications for specific host states
        contact_groups                  admins          ; Notifications get sent to the admins by default
        register                        0               ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
        }



define service{
        name                            local-service           ; The name of this service template
        use                             generic-service         ; Inherit default values from the generic-service definition
        check_period                    24x7                    ; The service can be checked at any time of the day
        max_check_attempts              4                       ; Re-check the service up to 4 times in order to determine its final (hard) state
        normal_check_interval           5                       ; Check the service every 5 minutes under normal conditions
        retry_check_interval            1                       ; Re-check the service every minute until a hard state can be determined
        contact_groups                  admins                  ; Notifications get sent out to everyone in the 'admins' group
        notification_options            w,u,c,r                 ; Send notifications about warning, unknown, critical, and recovery events
        notification_interval           60                      ; Re-notify about service problems every hour
        notification_period             24x7                    ; Notifications can be sent out at any time
        register                        0                       ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
        }

define service{
        use                             local-service
        host_name                       xx.xx.xx.xx
        service_description             MySQL_nti-sys
        check_command                   check_nrpe!check_mysql
        }



Хотя нет, приходит бред какой-то:

Nagios notify-by-email PROBLEM xx.xx.xx.xx

xx.xx.xx.xx  PING OK - Packet loss = 0%, RTA = 0.58 ms UP Sat Jan 29 09:21:16 EST 2011
Nagios notify-by-email RECOVERY xx.xx.xx.xx

xx.xx.xx.xx  PING OK - Packet loss = 0%, RTA = 0.58 ms UP Sat Jan 29 09:21:16 EST 2011

Хотя поверка пинга вообще не настроена для этого сервиса.

kmua
() автор топика
Ответ на: комментарий от kmua

Параметры копипастил с host-notify-by-email, поэтому и слало ерунду.

kmua
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.