我从 Icinga 收到和未收到的通知似乎没有意义,我希望这里有人能帮助我。这是在 Ubuntu 12.04.3 LTS 上运行的 Icinga 1.10.1
当主机从正常运行变为宕机时,它会检查 5 次,然后进入硬状态。日志显示主机通知过程已触发,它会尝试通过电子邮件通知主机来发送电子邮件。但什么也没发生。
ping、正常运行时间和上行链路服务立即进入严重关键和未知状态,并且不会触发通过电子邮件通知服务事件。
如果上行服务有一个链接被删除,它就会进入警告状态,检查 5 次,然后成功发出通知电子邮件。
希望我没有错过任何显而易见的事情。
我的通用服务、主机和联系人模板以及相关设备的主机和服务定义如下。
# generic service template definition
define service{
name generic-service ; The 'name' of this service template
active_checks_enabled 1 ; Active service checks are enabled
passive_checks_enabled 1 ; Passive service checks are enabled/accepted
parallelize_check 1 ; Active service checks should be parallelized (disabling this can lead to major performance problems)
obsess_over_service 1 ; We should obsess over this service (if necessary)
check_freshness 0 ; Default is to NOT check service 'freshness'
notifications_enabled 1 ; Service notifications are enabled
event_handler_enabled 1 ; Service 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
max_check_attempts 5
check_interval 1
retry_interval 1
check_period 24x7
notification_interval 30
notification_period 24x7
notification_options w,u,c,r
contact_groups sys-admins
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE!
}
#service definitions in localhost_icinga.cfg
#check uptime
define service{
use generic-service
host_name 1.switch.foo.com
service_description Uptime Test
check_command check_snmp!public!sysUpTime.0
}
#check ping for AS5 for test notifications
define service{
use generic-service
host_name 1.switch.foo.com
service_description Ping Test
check_command check_ping!200.0,20%!600.0,60%
}
define service{
use generic-service
host_name 1.switch.foo.com
service_description Uplink Ports Check
check_command check_multi_snmp!/etc/icinga/objects/switches/1s_uplink.cmd!15
}
。
# Generic host definition template - This is NOT a real host, just a template!
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
check_command check-host-alive
check_interval 1
retry_interval 1
max_check_attempts 5
check_period 24x7
contact_groups sys-admins
notification_interval 30
notification_period 24x7
notification_options d,u,r
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}
# Define a template for switches that we can reuse
define host{
name generic-switch ; The name of this host template
use generic-host ; Inherit default values from the generic-host template
register 0 ; DONT REGISTER THIS - ITS JUST A TEMPLATE
}
#Host definition in localhost_icinga.cfg
define host{
use generic-switch ; Inherit default values from a template
host_name 1.switch.foo.com ; The name we're giving to this switch
alias S1 - HP Pro-Curve 1800-24G J9028B ; A longer name associated with the switch
address 10.1.1.242 ; IP address of the switch
hostgroups switches ; Host groups this switch is associated with
}
。
#Define a generic contact for Icinga
define contact{
name generic-contact
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r,f,s
host_notification_options d,u,r,f,s
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
register 0
}
#icinga_contacts.cfg
define contact{
contact_name bob
use generic-contact
alias bob (Sysadmin)
email [email protected]
}
define contactgroup{
contactgroup_name sys-admins
alias System Administrator
members bob
}