Nagios不發郵件通知的解決
Nagios不發郵件通知的解決
***個想到的是warning報警發了郵件,而CRITICAL就報警不發郵件通知了,又看了一下nagios的日志,我service的狀態變化是出在周六,也就是從warning轉變成critical就不發郵件了,問題可能出在服務報警通知那部分,于是先看了一下我定義的所有服務和主機的模板文件,內容如下:
- # vi genericdef.cfg
- define host{
- name generic-host
- check_period 24x7
- notifications_enabled 1
- event_handler_enabled 1
- process_perf_data 1
- retain_nonstatus_information 0
- contact_groups admins
- notification_interval 60
- notification_period 24x7
- notification_options d,u,r
- stalking_options o,d,u
- register 0
- }
- define service{
- name generic-service
- active_checks_enabled 1
- passive_checks_enabled 1
- notifications_enabled 1
- event_handler_enabled 1
- check_period 24x7
- max_check_attempts 3
- normal_check_interval 10
- retry_check_interval 2
- contact_groups admins
- notification_options w,u,c,r
- notification_interval 60
- notification_period 24x7
- register 0
- }
從上面service定義來看,通知選項已經加入了c(CRITICAL)這個參數了,看了問題不是出在這里。
第二個我想到的地方就是contract的配置文件,打開看了一下
- define contact{
- contact_name nagios-msn-admin
- alias Nagios msn Admin
- email harvey_liu@wenzizone.cn
- host_notification_commands notify-host-by-msn
- host_notification_options d,u
- host_notification_period 24x7
- service_notification_period 24x7
- service_notification_options w,u,r,c //這個位置之前是沒有c
- service_notification_commands notify-service-by-msn
- }
- define contact{
- contact_name nagios-mail-admin
- alias Nagios mail Admin
- email hanzhao.liu@wenzizone.cn
- host_notification_commands notify-host-by-email
- host_notification_options d,u
- host_notification_period 24x7
- service_notification_period 24x7
- service_notification_options w,u,r,c //這個位置之前沒有c
- service_notification_commands notify-service-by-email
- }
在上面的第9和21行的位置加上c之后,然后重新reload一下nagios,如果沒有報錯,說明配置更新完畢,很快蚊子又可以收到報警的郵件了。Nagios調整是一個細致的活,大家解決了Nagios不發郵件的情況了嗎?
【編輯推薦】