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

yum install nagios and pnp4nagios

时间:2014-07-15 12:11:36      阅读:259      评论:0      收藏:0      [点我收藏+]

标签:nagios   pnp4nagios   

环境:centos6.2


1.下载并安装epel包

    links    http://fedoraproject.org/wiki/EPEL


2.安装nagios及插件

    yum install nagios nagios-nrpe nagios-plugins* -y


3.启动httpd

    service httpd start;chkconfig httpd on


4.创建管理用户

    htpasswd -cm /etc/nagios/passwd user1


5.更改默认的管理用户名

    vim /etc/nagios/cgi.cfg

    :%s/nagiosadmin/user1/g


6.配置nagios 和pnp4nagios

    6.1.    vim /etc/nagios/nagios.cfg

                    process_performance_data=0        //0改成1

                    host_perfdata_command=process-host-perfdata                //去掉注释
                    service_perfdata_command=process-service-perfdata       //去掉注释

    6.2.    vim /etc/nagios/objects/commands.cfg

                    define command{
                             command_name    process-host-perfdata
                             command_line    /usr/bin/perl /usr/libexec/pnp4nagios/process_perfdata.pl -d                                           HOSTPERFDATA
                }

                    define command{
                            command_name    process-service-perfdata

                            command_line    /user/bin/perl /usr/libexec/pnp4nagios/process_perfdata.pl
                }
    6.3.    vim /etc/nagios/objects/templates.cfg

                         define host{
                                name                            host-pnp
                                action_url                      /pnp4nagios/graph?host=$HOSTNAME$&srv=_HOST_
                                register                        0
                                process_perf_data               1
                }

                        define service{
                                name                            service-pnp
                                action_url                      /pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$
                                register                        0
                                process_perf_data               1
                }
    6.4.    cd /etc/nagios/objects/                //默认localhost.cfg文件包含本机及本机服务的配置

                vim hosts.cfg                                //新建主机配置文件hosts.cfg

                    define host{
                        use                     linux-server,host-pnp
                        host_name               localhost
                        alias                   localhost
                        address                 127.0.0.1
                                        }
                    define hostgroup{
                            hostgroup_name  linux-servers
                            alias           Linux Servers
                            members         localhost
                                                    }

                    vim services.cfg                    //新建主机的服务配置文件

                            define service{
                                use                             local-service,service-pnp
                                host_name                       localhost
                                service_description             PING
                                check_command                   check_ping!100.0,20%!500.0,60%
                                                        }
        6.5.    vim /etc/nagios/nagios.cfg                //新增以下2条

                               cfg_file=/etc/nagios/objects/hosts.cfg                    
                                cfg_file=/etc/nagios/objects/services.cfg
        6.6.    vim /etc/nagios/cgi.cfg

                         #default_user_name=guest        //去掉注释,修改成nagios管理用户userr1

                           default_user_name=user1


7.启动nagios服务

    service npcd start;chkconfig npcd on

    service nagios start;chkconfig nagios on





本文出自 “卫国保家” 博客,请务必保留此出处http://zengbaobao.blog.51cto.com/2672985/1438075

yum install nagios and pnp4nagios,布布扣,bubuko.com

yum install nagios and pnp4nagios

标签:nagios   pnp4nagios   

原文地址:http://zengbaobao.blog.51cto.com/2672985/1438075

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