Redhat配置nagios-郵件監控
郵件監控
本文講述的是:Redhat配置nagios。返回大綱。
郵件監控可以配置sendmail,這里還是用mail命令完成。首先是編輯nagios.cfg,以前已經設置了,這里看看就行了
- [root@localhost objects]# vi /usr/local/nagios/etc/nagios.cfg
- cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
這里要注意的是如果在這設置間隔和期限等是在整個nagios生效的,所有的客戶端都是按照這個配置,如果想單獨設置在各個cfg中單獨配置,一會會講。整個cfg內容沒什么說的了,contact_name和email,還有就是contactgroup_name在所有的地方都是設置這個名字,不要寫錯,member可以設置多個用”,”隔開,
- [root@localhost objects]# vi contacts.cfg
- define contact{
- contact_name user1
- alias Nagios Admin
- service_notification_period 24x7
- host_notification_period 24x7
- service_notification_options w,u,c,r
- host_notification_options d,r
- service_notification_commands notify-by-email
- host_notification_commands host-notify-by-email
- email xxxx@163.com
- pager 13800138000
- }
- define contactgroup{
- contactgroup_name admins
- alias Nagios Administrators
- members user1
- }
notify-by-email和host-notify-by-email在command.cfg中定義了
這個就是在服務中單獨設置,就不多講了
- define service{
- use generic-service ; Name of service template to use
- host_name test_nrpe
- service_description apache
- is_volatile 0 #類似聲音警告功能關閉
- check_period 24x7 #監控期限為24X7
- max_check_attempts 1 #最大重試次數
- normal_check_interval 1 #標準檢測時間間隔 1分鐘
- retry_check_interval 1 #重試時間間隔
- contact_groups admins #聯系組
- notification_options w,u,c,r # w,u,c,r 發生這四種情況時,進行通告。
- notification_interval 960 # 通告間隔
- notification_period 24x7 #通告過期時間
- check_command check_http!100.0,20%!500.0,60%
- }
【編輯推薦】