码迷,mamicode.com
首页 > 移动开发 > 详细

install nagios pnp4nagios on centos 6

时间:2015-06-11 22:45:14      阅读:233      评论:0      收藏:0      [点我收藏+]

标签:

  1. 安装配置Apache、PHP(忽略此次安装步骤)
  2. 安装nagios
    rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
    rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
    yum -y install nagios nagios-plugins-all nagios-plugins-nrpe nrpe php httpd bc
  3. 创建密码文件
    htpasswd -c /etc/nagios/passwd nagiosadmin
    (此步完成即可通过Web访问Nagios)
  4. 安装PNPNagios
    yum –y install perl-Time-HiRes pnpnagios
  5. 修改 /etc/nagios/nagios.cfg
    process_performance_data=1                                          // 将0 修改为 1 
    host_perfdata_command=process-host-perfdata               // 取消注释
    service_perfdata_command=process-service-perfdata       // 取消注释
  6. 修改 /etc/nagios/objects/commands.cfg

    技术分享
    # process-host-perfdata command definition  
    define command{  
        command_name    process-host-perfdata  
        command_line    /usr/libexec/pnp4nagios/process_perfdata.pl  -d HOSTPERFDATA  
        }  
       
       
    # process-service-perfdata command definition  
    define command{  
        command_name    process-service-perfdata  
        command_line    /usr/libexec/pnp4nagios/process_perfdata.pl 
        }  
    commands.cfg Code
  7. 修改配置文件/etc/nagios/objects/templates.cfg, 添加以下内容
    技术分享
    define host {   
           name       hosts-pnp   
           register   0   
           action_url /pnp4nagios/graph?host=$HOSTNAME$  
           process_perf_data              1   
    }   
    define service {   
           name       srv-pnp   
           register   0   
           action_url /pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$   
           process_perf_data              1   
    }
    templates.cfg Code
  8. 修改服务器配置文件/etc/nagios/objects/localhost.cfg

    技术分享
    define host{   
           use                    linux-server,hosts-pnp   
           host_name              localhost   
           alias                  localhost   
           address                127.0.0.1   
           }   
        
    define service{   
           use                            local-service,srv-pnp   
           host_name                      localhost   
           service_description            PING   
           check_command                   check_ping!100.0,20%!500.0,60%   
           } 
    localhost.cfg Code
  9. 修改 /etc/nagios/cgi.cfg 里的用户名是无效的

    default_user_name=nagiosadmin

  10. 重启nagios 和 apache
    chkcofing httpd on
    chkconfig nrpe on
    chkconfig npcd on
    chkconfig nagios on

  11. 遇到的问题

    ping图片报错:
    cd /var/lib
    chown -R nagios.nagios php/
    原理:php是apache的组,而我的httpd.conf中将httpd的服务改成了nagios用户和组php权限改为nagios即可

  12. 参考文档:

    https://www.digitalocean.com/community/tutorials/how-to-install-nagios-on-centos-6

    http://blog.csdn.net/tch8502/article/details/22151525

    http://www.cnblogs.com/mchina/archive/2013/02/20/2883404.html (不推荐其安装过程)

install nagios pnp4nagios on centos 6

标签:

原文地址:http://www.cnblogs.com/Mrhuangrui/p/4570170.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!