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)
    http://yourip/nagios
  4. 安装PNPNagios
    yum -y install perl-Time-HiRes pnp4nagios
    若提示没有pnp4nagios软件包
    yum -y groupinstall "Development Tools"
    wget https://sourceforge.net/projects/pnp4nagios/files/latest
    mv latest pnp4nagios-Version.tar.gz
    tar -xvzf pnp4nagios-Version.tar.gz
    yum -y install rrdtool rrdtool-perl
    cd pnp4nagios-0.6.25
    ./configure
    make all
    make fullinstall
    mv /usr/local/pnp4nagios/share/install.php /usr/local/pnp4nagios/share/install.php.ignore
    ln -s /usr/local/pnp4nagios/ /var/www/html/pnp4nagios
  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 (注释默认配置再添加)

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

    commands.cfg Code

  7. 修改 /etc/nagios/cgi.cfg 里的用户名是无效的
    default_user_name=nagiosadmin

  8. 修改 /etc/httpd/conf.d/pnp4nagios.conf
    #AuthUserFile /usr/local/nagios/etc/htpasswd.users # 注释这一行
    AuthUserFile /etc/nagios/passwd # 添加此行

  9. 重启nagios 和 apache
    chkconfig httpd on
    chkconfig nrpe on
    chkconfig npcd on
    chkconfig nagios on
    打开 http://yourip/pnp4nagios/ 即可看到pnp图

  10. 添加pnp4nagios记录模版
    修改/etc/nagios/objects/templates.cfg,添加如下内容
    define host {
    name host-pnp
    action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$'class='tips'rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=_HOST_
    register
    process_perf_data
    } define service {
    name srv-pnp
    action_url /pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=$SERVICEDESC$'class='tips'rel='/pnp4nagios/index.php/popup?host=$HOSTNAME$&srv=$SERVICEDESC$
    register
    process_perf_data
    }

    templates.cfg Code

  11. 在host和service定义中使用pnp4nagios模版
    编辑localhost.cfg文件,vi /etc/nagios/objects/localhost.cfg
    将use linux-server 修改为 use linux-server,host-pnp
    将use local-services修改为 use local-services,srv-pnp
    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,%!500.0,%
    }

    pnp services Code

    被监控机需要显示pnp按钮,修改vi /etc/nagios/objects/services.cfg
    将use local-services修改为 use local-services,srv-pnp

  12. 出现的问题

    关闭 selinux
    setenforce 0
    sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
    sed -i "s/SELINUXTYPE=targeted/#SELINUXTYPE=targeted/g" /etc/selinux/config
  13. 参考文档:

    https://www.digitalocean.com/community/tutorials/how-to-install-nagios-on-centos-6http://geekpeek.net/pnp4nagios-centos-install/http://blog.csdn.net/tch8502/article/details/22151525http://www.huangzhongzhang.cn/nagios-pnp4nagios-an-zhuang-bi-ji.html

install nagios pnp4nagios on centos 6的更多相关文章

  1. install Nagios on Unbuntu Unix

    Ubuntu Quickstart Up To: ContentsSee Also: Quickstart Installation Guides, Security Considerations I ...

  2. Install .Net Core For CentOS

    Install .NET Core SDK Before you start, please remove any previous versions of .NET Core from your s ...

  3. [转载]How to Install Firefox 33 on CentOS, Redhat and Other Linux Distributions

    FROM: http://tecadmin.net/install-firefox-on-linux/ Firefox 33 has been released for Systems and And ...

  4. Install RabbitMQ server in CentOS 7

    About RabbitMQ RabbitMQ is an open source message broker software, also sometimes known as message-o ...

  5. Install Docker Engine on CentOS 在CentOS 7 上安装Docker

    Install Docker Engine on CentOS OS Requirements 系统要求 To install Docker Engine,you need a maintained ...

  6. Centos 7.5 通过yum安装GNOME Desktop时出现:file /boot/efi/EFI/centos from install of fwupdate-efi-12-5.el7.centos.x86_64 conflicts with file from package grub2-common-1:2.02-0.65.el7.centos.2.noarch

    系统版本为: [root@s10 ~]# cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core) 由于管理kvm虚拟机的需求,需要安装 ...

  7. Nagios+pnp4nagios+rrdtool 安装配置nagios(一)

    基于的软件版本 Apache-2.0.63  php-5.3.2 nagios-3.2.3  nagios-plugins-1.4.15  rrdtool-1.4.5 nrpe-2.12 pnp4na ...

  8. nginx下的nagios pnp4nagios

    #Spawn-FCGI 一个通用的FastCGI管理服务器,它是lighttpd中的一部份,很多人都用Lighttpd的Spawn-FCGI进行FastCGI模式下的管理工作 #fcgiwrap(Si ...

  9. 转载--How to Install VMware Tools on CentOS 6.3

    源地址:http://www.ehowstuff.com/how-to-install-vmware-tools-on-centos-6-3/ VMware Tools is a group of u ...

随机推荐

  1. Window环境下配置MySQL 5.6的主从复制

    原文:Window环境下配置MySQL 5.6的主从复制 1.环境准备 Windows 7 64位 MySQL 5.6 主库:192.168.103.207 从库:192.168.103.208 2. ...

  2. 腾讯云 ubuntu 上tomcat加载项目很慢

    问题原因 随机数引起线程阻塞. tomcat不断启动,关闭, 启动关闭.几次后会出现卡死状况.需很久才能加载完成 阿里云同样配置,同样系统,则很难出现卡死状况.  即使出现过几十秒后也会释放出来. 而 ...

  3. Luogu P2597 [ZJOI2012]灾难

    一道非常综合的好题然后就莫名其妙地知道了动态LCA的求法 果然是ZJOI的题目,只能说这思路服了 首先我们发现每次操作只会灭绝一种动物,然后我们想一下就知道如果有\(n(n>=2)\)个食物的动 ...

  4. Luogu P1341 无序字母对

    突然发现我现在很喜欢打图论题. 然而都是很easy的. 这道题很坑,用C++打了一遍莫名Too many or too few lines. 然后我打出了我的独门绝技Pascal.这可能是我最后一次用 ...

  5. Shell编程基础篇-上

    1.1 前言 1.1.1 为什么学Shell Shell脚本语言是实现Linux/UNIX系统管理及自动化运维所必备的重要工具, Linux/UNIX系统的底层及基础应用软件的核心大都涉及Shell脚 ...

  6. centos下升级git版本的操作记录

    在使用git pull.git push.git clone的时候,或者在使用jenkins发版的时候,可能会报类似如下的错误: error: The requested URL returned e ...

  7. linux下向一个文件中的某行插入数据的做法

    sed -i 'ni\x' test.file        表示向test.file文件里的第n行的前面添加x内容sed -i 'na\x' test.file       表示向test.file ...

  8. shiro课程的学习

    1.shiro的课程目标 (1)shiro的整体框架 各组件的概念 (2)shiro 认证 授权的过程 (3)shiro自定义的Reaml Filter (4)shiro session 管理 (5) ...

  9. Mock.js的简易使用

    一:安装 npm install mockjs --save-dev 二:引入 在src目录下创建mock.js文件,输入以下代码: // 引入mockjs const Mock = require( ...

  10. Spring注解 开发