Redhat配置nagios-郵件監(jiān)控
郵件監(jiān)控
本文講述的是:Redhat配置nagios。返回大綱。
郵件監(jiān)控可以配置sendmail,這里還是用mail命令完成。首先是編輯nagios.cfg,以前已經(jīng)設(shè)置了,這里看看就行了
- [root@localhost objects]# vi /usr/local/nagios/etc/nagios.cfg
- cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
這里要注意的是如果在這設(shè)置間隔和期限等是在整個(gè)nagios生效的,所有的客戶(hù)端都是按照這個(gè)配置,如果想單獨(dú)設(shè)置在各個(gè)cfg中單獨(dú)配置,一會(huì)會(huì)講。整個(gè)cfg內(nèi)容沒(méi)什么說(shuō)的了,contact_name和email,還有就是contactgroup_name在所有的地方都是設(shè)置這個(gè)名字,不要寫(xiě)錯(cuò),member可以設(shè)置多個(gè)用”,”隔開(kāi),
- [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中定義了
這個(gè)就是在服務(wù)中單獨(dú)設(shè)置,就不多講了
- define service{
- use generic-service ; Name of service template to use
- host_name test_nrpe
- service_description apache
- is_volatile 0 #類(lèi)似聲音警告功能關(guān)閉
- check_period 24x7 #監(jiān)控期限為24X7
- max_check_attempts 1 #最大重試次數(shù)
- normal_check_interval 1 #標(biāo)準(zhǔn)檢測(cè)時(shí)間間隔 1分鐘
- retry_check_interval 1 #重試時(shí)間間隔
- contact_groups admins #聯(lián)系組
- notification_options w,u,c,r # w,u,c,r 發(fā)生這四種情況時(shí),進(jìn)行通告。
- notification_interval 960 # 通告間隔
- notification_period 24x7 #通告過(guò)期時(shí)間
- check_command check_http!100.0,20%!500.0,60%
- }
【編輯推薦】