清单 3. 配置 3:添加新主机

  1. define host{  
  2.  
  3. host_name ubuntu_1_2  
  4.  
  5. alias Ubuntu test server  
  6.  
  7. address 192.168.1.2  
  8.  
  9. check_command check-host-alive  
  10.  
  11. max_check_attempts 20  
  12.  
  13. notifications_enabled 1  
  14.  
  15. event_handler_enabled 0  
  16.  
  17. flap_detection_enabled 0  
  18.  
  19. process_perf_data 1  
  20.  
  21. retain_status_information 1  
  22.  
  23. retain_nonstatus_information 1  
  24.  
  25. notification_interval 60  
  26.  
  27. notification_period 24x7  
  28.  
  29. notification_options d,u,r  
  30.  
  31. }  
  32.  

Nagios 配置的最后一步是为配置的主机定义服务。这个示例使用了一个预定义的“ping”Nagios 插件,它将发送 Internet 控制信息协议(Internet Control Message Protocol,ICMP)回显请求以确定主机是否有响应。

清单 4. 配置 4:添加新服务

  1. define service{  
  2.  
  3. use service-template  
  4.  
  5. host_name ubuntu_1_2  
  6.  
  7. service_description PING  
  8.  
  9. check_period 24x7  
  10.  
  11. contact_groups server-admins  
  12.  
  13. notification_options c,r  
  14.  
  15. check_command check_ping!300.0,20%!1000.0,60%  
  16.  
  17. }  
  18.  

在完成了这个配置工作之后,重新启动您的 Nagios 守护进程,稍等几秒钟让 Nagios 进行初始化,然后,证实 Web 管理接口中 ping 服务的可见性。

通过文章的描述,我们知道了配置Nagios的四大点,希望大家能掌握它们!

  • 配置和安装Nagios所需的工具与命令
  • FreeBSD 7.0上的nagios安装完全攻略
  • nagios plugins之 check_http ZT
  • Nagios图形化Pnp 安装和配置 ZT
  • Redhat Nagios安装详解
  • Nagios 配置文件解析
  • Nagios安装笔记


相关内容

    暂无相关文章