- 论坛徽章:
- 0
|
本帖最后由 badeager 于 2011-09-17 08:01 编辑
各位大侠,请指教!
折腾了好几天了, 邮件无法发送,
后来创建了一个/bin/mail程序调试之后,才发现,竟然是contact的$CONTACTEMAIL$这个变量并没有吧用户的信息替换上去,只显示了$
后来测试了短信的,同样的问题
认为制造了一些故障后
报警信息中 $CONTACTEMAIL$ $CONTACTPAGER$ 都是$ , 但是在contacts.cfg中,都是确实填写好的
EMAIL-
- 2011-09-17 07:14:09 : $ | ** Service Alert: LN CLUSTER 92 node/check ssh service is CRITICAL ** | ***** Nagios ***** -- Notification Type: -- Service: check ssh service -- Host: LN CLUSTER 92 node -- Address: 172.21.92.23 -- State: CRITICAL - Date/Time: Sat Sept 17 07:14:09 CST 2011 -- Additional Info: -- Connection refused
- 2011-09-17 07:17:29 : $ | ** Service Alert: LN CLUSTER 92 node/check ssh service is CRITICAL ** | ***** Nagios ***** -- Notification Type: -- Service: check ssh service -- Host: LN CLUSTER 92 node -- Address: 172.21.92.233 -- State: CRITICAL - Date/Time: Sat Sept 17 07:17:29 CST 2011 -- Additional Info: -- CRITICAL - Socket timeout after 10 seconds
- 2011-09-17 07:18:09 : $ | ** Host Alert: ln1 is DOWN ** | ***** Nagios ***** -- Notification Type: - Host: ln1 - State: DOWN - Address: 172.21.92.233 - Info: (Host Check Timed Out) -- Date/Time: Sat Sept 17 07:18:09 CST 2011
- 2011-09-17 07:18:23 : $ | ** Host Alert: ln1 is UP ** | ***** Nagios ***** -- Notification Type: - Host: ln1 - State: UP - Address: 172.21.92.23 - Info: PING OK - Packet loss = 0%, RTA = 0.16 ms -- Date/Time: Sat Sept 17 07:18:23 CST 2011
- 2011-09-17 07:18:33 : $ | ** Service Alert: LN CLUSTER 92 node/check ssh service is OK ** | ***** Nagios ***** -- Notification Type: -- Service: check ssh service -- Host: LN CLUSTER 92 node -- Address: 172.21.92.23 -- State: OK - Date/Time: Sat Sept 17 07:18:33 CST 2011 -- Additional Info: -- SSH OK - OpenSSH_3.9p1 (protocol 1.99)
- 2011-09-17 07:20:29 :$ | ** Service Alert: LN CLUSTER 92 node/check ssh service is CRITICAL ** | ***** Nagios ***** -- Notification Type: -- Service: check ssh service -- Host: LN CLUSTER 92 node -- Address: 172.21.92.23 -- State: CRITICAL - Date/Time: Sat Sept 17 07:20:29 CST 2011 -- Additional Info: -- Connection refused
- 2011-09-17 07:23:29 :$ | ** Service Alert: LN CLUSTER 92 node/check ssh service is CRITICAL ** | ***** Nagios ***** -- Notification Type: -- Service: check ssh service -- Host: LN CLUSTER 92 node -- Address: 172.21.92.23 -- State: CRITICAL - Date/Time: Sat Sept 17 07:23:29 CST 2011 -- Additional Info: -- Connection refused
- 2011-09-17 07:26:29 : $ | ** Service Alert: LN CLUSTER 92 node/check ssh service is CRITICAL ** | ***** Nagios ***** -- Notification Type: -- Service: check ssh service -- Host: LN CLUSTER 92 node -- Address: 172.21.92.23 -- State: CRITICAL - Date/Time: Sat Sept 17 07:26:29 CST 2011 -- Additional Info: -- Connection refused
- 2011-09-17 07:29:29 : $ | ** Service Alert: LN CLUSTER 92 node/check ssh service is CRITICAL ** | ***** Nagios ***** -- Notification Type: -- Service: check ssh service -- Host: LN CLUSTER 92 node -- Address: 172.21.92.23 -- State: CRITICAL - Date/Time: Sat Sept 17 07:29:29 CST 2011 -- Additional Info: -- Connection refused
复制代码 短信信息
- Sat Sep 17 07:40:58 CST 2011:$ Service LN CLUSTER 92 node/check ssh service is OK ! on '$'
复制代码
- define contact {
- contact_name nagiosadmin
- alias Nagios Admin
- host_notifications_enabled 1
- service_notifications_enabled 1
- host_notification_period 24x7
- service_notification_period 24x7
- host_notification_options d,r,f,s,n
- service_notification_options w,c,f
- email nagios@localhost
- pager 11111111111
- use generic-contact
- }
复制代码 contacts.cfg
- define contactgroup {
- contactgroup_name admins
- alias Nagios Administrators
- members nagiosadmin
- }
复制代码 contactgroup.cfg
- ......
- define command {
- command_name notify-host-by-email
- command_line /bin/mail "$CONTACTEMAIL$" "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" "***** Nagios ***** -- Notification Type: $NOTIFICATIONTYPE$ - Host: $HOSTNAME$ - State: $HOSTSTATE$ - Address: $HOSTADDRESS$ - Info: $HOSTOUTPUT$ -- Date/Time: $LONGDATETIME$"
- }
- define command {
- command_name notify-host-by-sms
- command_line /opt/sms/sms.sh $CONTACTPAGER$ "Host $HOSTSTATE$ alert for $HOSTNAME$! on '$DATETIME$'"
- }
- define command {
- command_name notify-service-by-email
- command_line /bin/mail "$CONTACTEMAIL$" "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" "***** Nagios ***** -- Notification Type: $NOTIFICATIONTYPE$ -- Service: $SERVICEDESC$ -- Host: $HOSTALIAS$ -- Address: $HOSTADDRESS$ -- State: $SERVICESTATE$ - Date/Time: $LONGDATETIME$ -- Additional Info: -- $SERVICEOUTPUT$"
- }
- define command {
- command_name notify-service-by-sms
- command_line /opt/sms/sms.sh $CONTACTPAGER$ "Service $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ ! on '$DATETIME$'"
- }
- define command {
- command_name nrpe_check_users
- command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c check_users
- }
- .....
复制代码 commands.cfg
- define service {
- host_name ln1
- service_description check ssh service
- use generic-service
- check_command check_ssh
- initial_state u
- max_check_attempts 999
- check_interval 3
- retry_interval 3
- check_period 24x7
- event_handler notify-service-by-sms
- flap_detection_enabled 1
- flap_detection_options o
- notification_interval 120
- notification_period 24x7
- notification_options w,c
- notifications_enabled 1
- contact_groups admins
- icon_image ssh_icon.png
- register 1
- }
复制代码 services/ssh.cfg
- define host {
- host_name ln1
- alias LN CLUSTER 92 node
- address 172.21.92.23
- check_command check-host-alive
- initial_state u
- max_check_attempts 999
- check_period 24x7
- event_handler notify-host-by-email
- contact_groups admins
- notifications_enabled 1
- notification_interval 120
- notification_period 24x7
- icon_image rack_linux.png
- statusmap_image rack_linux.png
- register 1
- }
复制代码 hosts/ln1.cfg |
|