手机版
你好,游客 登录 注册
背景:
阅读新闻

RHEL下Nagios安装和配置详解

[日期:2011-08-04] 来源:Linux社区  作者:danny_xcz [字体:大 中 小]

测试接收邮件

首先需要将nagios监控主机的IP加入到邮件系统的信任主机列表中。否则必须使用外部邮件系统账号发送邮件。

新建/root/testmail文件

  1. /bin/mail -v -s "test" nagios@xxx.edu.cn < /root/testmail -- -f nagios@xxx.edu.cn -F nagios  
  2.   
  3. /usr/bin/printf "%b" "test" | /bin/mail -v -s "test Alert" nagios@xxx.edu.cn -- -f nagios@xxx.edu.cn -F nagios  

修改commands.cfg

notify-host-by-email 和 notify-service-by-email 末尾均加上以下语句。为了便于通过学校邮箱转139邮箱时不被139邮箱过滤。

-- -f nagios@xxx.edu.cn -F nagios

check_http

  1. ./check_http -H www.xxx.edu.cn -w 5 -c 8 -u /index.php -s "www.xxx.edu.cn"  
  2.   
  3. define command{  
  4.         command_name    check_http  
  5.         command_line    $USER1$/check_http -H $ARG1$ -w $ARG2$ -c $ARG3$ -u $ARG4$ -s $ARG5$  
  6.         }  
  7.   
  8. define service{  
  9.         use                     generic-service  
  10.         host_name               server-www-8  
  11.         service_description     website-www-8  
  12.          check_command      check_http!www.xxx.edu.cn!5!8!/index.php!"www.xxx.edu.cn"  
  13.         }  

check_dns

  1. ./check_http -H www.xxx.edu.cn -a site's ip -w 5 -c 8  
  2.   
  3. define command {  
  4.          command_name check_dns  
  5.          command_line $USER1$/check_dns -s $HOSTADDRESS$ -H $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$  
  6. }  
  7.   
  8. define service{  
  9.         use                     generic-service  
  10.         host_name               server-dns-95  
  11.         service_description     network-dns-95  
  12.          check_command      check_dns!www.xxx.edu.cn!site's ip!5!8!  
  13.         } 

check_squid

  1. ./check_squid.pl -u http://www.xxx.edu.cn -p proxy_server_ip -l 3128 -o username -m password -e 200  
  2. ./check_squid.pl -u http://www.xxx.edu.cn -p proxy_server_ip -l 3128 -o username -m password -e 200  
  3. ./check_squid.pl -u http://www.xxx.edu.cn -p proxy_server_ip -l 3128 -e 200  
  4.   
  5. define command {  
  6.          command_name check_squid  
  7.          command_line $USER1$/check_squid.pl -u $ARG1$ -p $ARG2$ -l $ARG3$ -o $ARG4$ -m $ARG5$ -e $ARG6$  
  8. }  
  9.   
  10. define service{  
  11.         use                     generic-service  
  12.         host_name               server-proxy-68  
  13.         service_description     network-proxy-68  
  14.          check_command      check_squid!http://www.xxx.edu.cn!proxy_server_ip!3128!username!password!200!  
  15.         }  

check_dhcp

  1. /usr/local/nagios/libexec/check_dhcp -s dhcp_server_ip -i eth2 -u  
  2.   
  3. define command{  
  4.         command_name    check_dhcp  
  5.         command_line    $USER1$/check_dhcp -s $ARG1$ -i eth2 -u  
  6.         }  
  7.   
  8. define service{  
  9.         use                     generic-service  
  10.         host_name               server-dhcp-13  
  11.         service_description     network-dhcp-13  
  12.          check_command      check_dhcp!dhcp_server_ip!  
  13.         }  

DHCP服务器必须加上配置

  1. host nagios {  
  2.   hardware ethernet 00:d0:b7:c2:76:fd;  
  3.   fixed-address nagios_server_ip;  
  4. }  
  5.   
  6. subnet nagios_server_net netmask 255.255.255.0 {  
  7.   
  8. }  

check_smtp

  1. ./check_smtp -H mailserverip -A LOGIN -U username -P password  
  2.   
  3. define command{  
  4.         command_name    check_smtp  
  5.         command_line    $USER1$/check_smtp -H $HOSTADDRESS$ -A LOGIN -U $ARG1$ -P $ARG2$  
  6.         }  
  7.   
  8. define service{  
  9.         use                     generic-service  
  10.         host_name               server-mail3-17  
  11.         service_description     ecampus-mail3-smtp-17  
  12.          check_command      check_smtp!username!password!  
  13.         }  
linux
相关资讯       redhat  Nagios 
本文评论   查看全部评论 (1)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款
第 1 楼
* 114 发表于 2011/8/26 11:47:12
您可以试试 美信科技的云网管软件