nagios配置文件说明

  • (1)、配置主机文件hosts.cfg  
  • define host{  
  • host_name                               web1## 主机名为web1,可以在hostname里查看  
  • alias Nagios                            Server  ##主机别名为Server  
  • address                                 192.168.10.223##主机的ip地址  
  • check_command                           check-host-alive ##检查使用的命令,需要在命令定  
  • 义文件定义,默认是定义好的。  
  • check_interval                          5  ##检测的时间间隔  
  • retry_interval                          1 ##检测失败后重试的时间间隔  
  • max_check_attempts                      5 ##最大重试次数  
  • check_period                            24x7 ##检测的时段  
  • process_perf_data                       0  
  • retain_nonstatus_information            0  
  • contact_groups                          admin       ###联系组,就是设置邮件报警的组  
  • notification_interval                   30    ##通知间隔  
  • notification_period                     24x7  ##通知周期设置  
  • notification_options                    d,u,r    ####定义什么状态时报警,定义报警状态中的w表示warning,u表示unknown,c表示critial,r表示recovery(即恢复后是否发送通知);报警选项一般生产环境下设置w,c,r即可  
  • }  
  • (2)、配置主机组文件hostgroups.cfg  
  • define hostgroup {  
  • hostgroup_name                          Nagios-Example  ##定义主机组的名字  
  • alias Nagios                            Example         ##定义主机组的别名  
  • members                                 web1            ##主机组的成员,跟hosts.cfg里的hostname一致,否则出错  
  • }  
  • (3)、配置联系人文件contacts.cfg  
  • define contact{  
  • contact_name                            nagiosadmin                 #联系名称  
  • alias                                   Nagios Admin                #联系别名  
  • service_notification_period             24x7                        #服务监控时间为任何时候  
  • host_notification_period                24x7                        #主机监控时间为任何时候  
  • service_notification_options            w,u,c,r                     #服务监控的状态  
  • host_notification_options               d,u,r                       #主机监控的状态  
  • service_notification_commands           notify-service-by-email     #邮件报警  
  • host_notification_commands              notify-host-by-email        #同上  
  • email                                   denglei@ctfo.com            #接收报警的邮箱  
  • }  (4)、配置联系组文件contactgroups.cfg  
  • define contactgroup{  
  • contactgroup_name               admin                       #联系组的名字  
  • alias                           Nagios Administrators       #联系组的别名  
  • members                         nagiosadmin                 #联系组里的成员,与contacts.cfg里的contact_name 保存一致  
  •  
  • }  
  • (5)、配置服务文件 services.cfg  
  • define service {  
  • host_name                 web1                #与hosts.cfg里的host-name保持一致  
  • service_description          check-host-alive #服务描述  
  • check_period                 24x7     #服务描述  
  • max_check_attempts           4 #最大检测次数  
  • normal_check_interval           3 #检测的时间间隔  
  • retry_check_interval            2 #重复检测的时间间隔  
  • contact_groups               admin #发生故障通知的联系人组  
  • notification_interval           10 #通知间隔  
  • notification_period             24x7 #通知的时间段  
  • notification_options            w,u,c,r #定义什么状态时报警,定义报警状态中  
  • check_command                check-host-alive #检测的命令  
  • }  
  • define service {  
  • host_name                web1   
  • service_description             PING  
  • check_period                 24x7   
  • max_check_attempts           4   
  • normal_check_interval           3  
  • retry_check_interval            2  
  • contact_groups               admin   
  • notification_interval           10  
  • notification_period             24x7   
  • notification_options            w,u,c,r  
  • check_command                check_ping!100.0,20%!500.0,60%  
  • }  
  • define service {  
  • host_name                web1   
  • service_description             Root Partition  
  • check_period                 24x7   
  • max_check_attempts           4   
  • normal_check_interval           3  
  • retry_check_interval            2  
  • contact_groups               admin   
  • notification_interval           10  
  • notification_period             24x7   
  • notification_options            w,u,c,r  
  • check_command                check_local_disk!20%!10%!/  
  • }  
  • define service {  
  • host_name                web1   
  • service_description             Current Users  
  • check_period                 24x7   
  • max_check_attempts           4   
  • normal_check_interval           3  
  • retry_check_interval            2  
  • contact_groups               admin   
  • notification_interval           10  
  • notification_period             24x7   
  • notification_options            w,u,c,r  
  • check_command                check_local_users!20!50  
  • }  
  • define service {  
  • host_name                web1   
  • service_description             Total Processes  
  • check_period                 24x7   
  • max_check_attempts           4   
  • normal_check_interval           3  
  • retry_check_interval            2  
  • contact_groups               admin   
  • notification_interval           10  
  • notification_period             24x7   
  • notification_options            w,u,c,r  
  • check_command                check_local_procs!250!400!RSZDT  
  • }  
  • define service {  
  • host_name                web1   
  • service_description             Current Load  
  • check_period                 24x7   
  • max_check_attempts           4   
  • normal_check_interval           3  
  • retry_check_interval            2  
  • contact_groups               admin   
  • notification_interval           10  
  • notification_period             24x7   
  • notification_options            w,u,c,r  
  • check_command                check_local_load!5.0,4.0,3.0!10.0,6.0,4.0  
  • }  
  • define service {  
  • host_name                web1   
  • service_description             Swap Usage  
  • check_period                 24x7   
  • max_check_attempts           4   
  • normal_check_interval           3  
  • retry_check_interval            2  
  • contact_groups               admin   
  • notification_interval           10  
  • notification_period             24x7   
  • notification_options            w,u,c,r  
  • check_command                check_local_swap!20!10  
  • }  
  • define service {  
  • host_name                web1   
  • service_description             SSH  
  • check_period                 24x7   
  • max_check_attempts           4   
  • normal_check_interval           3  
  • retry_check_interval            2  
  • contact_groups               admin   
  • notification_interval           10  
  • notification_period             24x7   
  • notifications_enabled           0  
  • notification_options            w,u,c,r  
  • check_command                check_ssh  
  • }  
  • define service {  
  • host_name                web1   
  • service_description             HTTP  
  • check_period                 24x7   
  • max_check_attempts           4   
  • normal_check_interval           3  
  • retry_check_interval            2  
  • contact_groups               admin   
  • notification_interval           10  
  • notification_period             24x7   
  • notifications_enabled           0  
  • notification_options            w,u,c,r  
  • check_command                check_http  
  • }  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值