zoukankan      html  css  js  c++  java
  • CentOS7下nrpe3.0安装(转)

    本人菜鸟一枚,在学习nagios的时候碰到了很多问题,在网上找了很多相关的教程,都是老版本的,怎么装都不对,强迫症的我非要按装新版本,老版本的教程怎么搞都不行,只能自己研究了。

    首先,下载nrpe3.0的源码包:https://github.com/NagiosEnterprises/nrpe/archive/3.0.1.tar.gz

    在客户端运行nrpe时需要nagios插件的支持,我下载的是nagios-plugins-2.1.4.tar.gz

    https://nagios-plugins.org/download/nagios-plugins-2.1.4.tar.gz#_ga=1.211119574.2100594639.1487639657

    编译安装前先检查有没有安装gcc xinetd openssl-devel这三个包,因为编译安装时需要这三个包的支持。

    yum install -y gcc xinetd openssl-devel

    创建nagios用户及用户组

    useradd -s /sbin/nologin nagios

    创建nagios插件安装目录

    mkdir /usr/local/nagios

    修改目录权限

    chown -R nagios.nagios /usr/local/nagios

    解压下载的nagios插件

    tar zxvf nagios-plugins-2.1.4.tar.gz

    cd nagios-plugins-2.1.4

    编译安装插件

    ./configure --prefix=/usr/local/nagios

    make && make install

    解压下载的nrpe 3.0源码包

    tar zxvf nrpe-3.0.1.tar

    编译安装时跟网上那些教程中的老版本有些不同

    cd nrpe-3.0.1

    ./configure

    make all

    make install

    安装check_nrpe插件:

    make install-plugin

    好像被监控端不需要安装check_nrpe插件,但为了方便测试,还是安装上吧

    安装daemon

    make install-daemon

    nrpe daemon会运行相应的nagios插件来检查信息,并将信息返回给check_nrpe插件然后交给nagios处理

    安装配置文件:

    网上那些讲老版的教程在这里都是执行make install-daemon-config,在nrpe3.01版本下执行此命令时会提示没有这个参数

    [root@localhost nrpe-3.0.1]# make install-daemon-config

    make: *** No rule to make target `install-daemon-config'. Stop.

    在nrpe3.0.1版本下需要执行

    [root@localhost nrpe-3.0.1]# make install-config

    /usr/bin/install -c -m 775 -o nagios -g nagios -d /usr/local/nagios/etc

    /usr/bin/install -c -m 644 -o nagios -g nagios sample-config/nrpe.cfg /usr/local/nagios/etc

    这时可以看到安装时修改了etc目录的权限,把配置文件复制到了etc目录下

    安装起动文件:

    make install-inetd

    #install the startup files for inetd, launchd, etc.";

    make install-init

    #install the startup files for init, systemd, etc

    修改配置文件:

    vim /usr/local/nagios/etc/nrpe.cfg

    在配置文件中找到

    allowed_hosts=127.0.0.1

    这行表示允许本地访问。这里是客户端,需要允许服务器端访问,我们需要在这行下面再添加一行

    allowed_hosts=192.168.1.8

    设置nagios服务器的的ip。

    启动服务

    systemctl start nrpe

    设置开机启动

    systemctl enable nrpe

    使用check_nrpe插件进行测试,我们按装的check_nrpe及其它nagios插件都安装在/usr/local/nagios/libexec目录下,进入此目录执行

    [root@localhost libexec]# ./check_nrpe -H 127.0.0.1

    NRPE v3.0.1

    正确显示版本号表示安装成功

    服务器端

    之前我们已经配置好nagios服务器,现在只需安装check_nrpe插件就行了

    解压下载的nrpe 3.0源码包

    tar zxvf nrpe-3.0.1.tar

    cd nrpe-3.0.1

    ./configure

    make all

    安装check_nrpe插件:

    make install-plugin

    现在测试一下与客户端通信是否正常,进入/usr/local/nagios/libexec目录,执行

    ./check_nrpe -H 192.168.1.12

    ip地址请根据实际情况,如果正确返回版本信息,表示已经正常工作

    转自http://comic945.lofter.com/post/1ead6bdb_e5ce67f

  • 相关阅读:
    Cannot allocate memory(1)
    tomcat server.xml配置属性
    HTB-靶机-Nibbles
    HTB-靶机-CrimeStoppers
    HTB-靶机-FluxCapacitor
    HTB-靶机-Bashed
    HTB-靶机-Inception
    HTB-靶机-Fulcrum
    HTB-靶机-Ariekei
    HTB-靶机-Enterprise
  • 原文地址:https://www.cnblogs.com/lgh344902118/p/7521059.html
Copyright © 2011-2022 走看看