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. ASP.NET web.config中数据库连接字符串connectionStrings节的配置方法

    ASP.NET web.config中数据库连接字符串connectionStrings节的配置方法 第一种情况,本地开发时,使用本地数据库,如下面的代码 <connectionStrings& ...

  2. SPOJ GSS(Can you answer the Queries)系列 7/8

    GSS1 线段树最大子段和裸题,不带修改,注意pushup. 然而并不会猫树之类的东西 #include<bits/stdc++.h> #define MAXN 50001 using n ...

  3. LOJ2540 PKUWC2018 随机算法 状压DP

    传送门 两种$DP$: ①$f_{i,j}$表示前$i$次选择,最大独立集为$j$时达到最大独立集的方案总数,转移:$a.f_{i,j}+=f_{i+1,j+2^k}$(保证$k$加入后符合条件):$ ...

  4. DIV实现水平或垂直滚动条

    添加样式: 在html中,需要创建2层div来实现.一个div包含另一个div: 效果:

  5. (转) Ubuntu 更改文件夹及子文件夹权限

    Linux系统下如何修改文档及文件夹(含子文件夹)权限,我们来看一下. 一 介绍: 可以使用命令chmod来为文件或目录赋予权限.Linux/Unix 的档案存取权限分为三级 : 档案拥有者.群组.其 ...

  6. C# 枚举基本用法及扩展方法

    没什么好说的,都是些基础! 代码如下: using System; using System.Collections.Generic; using System.ComponentModel; usi ...

  7. 太白教你学python---博客分类目录

    太白非技术类随笔(持续更新中...猛击这里!!!) python基础 python基础一 pytcharm安装详细教程 python基础二 python基础数据类型 Python最详细,最深入的代码块 ...

  8. C-数据结构-typedef的用法

    .typedef的用法 # include <stdio.h> typedef int zhang; //为数据类为int从新取名为zhang 等价于int typedef struct ...

  9. php ajax登录注册

    用户登录与退出功能应用在很多地方,而在有些项目中,我们需要使用Ajax方式进行登录,登录成功后只刷新页面局部,从而提升了用户体验度.本文将使用PHP和jQuery来实现登录和退出功能. 准备数据库 本 ...

  10. JAVA程序设计 实验一报告

    北京电子科技学院(BESTI) 实     验    报     告 课程:Java程序设计 班级:1351  姓名:李畅宇  学号:20135129 成绩:             指导教师:娄嘉鹏 ...