Nagios的客户端的安装

时间:2021-03-25 15:35:18

一、Linux服务器的nagios客户端的安装

步骤:

1、  创建目录,上传文件到该目录

mkdir /data

nagios-plugins-2.1.1.tar.gz

nrpe-2.12.tar.gz

2、  创建nagios组和用户

groupadd nagios

mkdir /usr/local/nagios

useradd nagios -d /usr/local/nagios -s /sbin/nologin -g nagios

chown -R nagios:nagios /usr/local/nagios/

3、  安装nagios-plugins

tar zxvf nagios-plugins-2.1.1.tar.gz

cd nagios-plugins-2.1.1

./configure --prefix=/usr/local/nagios --with-user=nagios --with-nagios-group=nagios

make && make install

4、  安装nrpe

tar zxvf nrpe-2.12.tar.gz

cd nrpe-2.12

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

make all

make install-plugin

make install-daemon

make install-daemon-config

make install-xinetd

chown -R nagios:nagios /usr/local/nagios/

5、  增加服务

vi /etc/services

nrpe            5666/udp                #nrpe

nrpe            5666/tcp                #nrpe

6、  允许nagios服务访问

vi /etc/xinetd.d/nrpe

  • only_from       = 10.0.0.10

故障:checking for SSL headers... configure: error: Cannot find ssl headers

解决:yum -y install openssl-devel

故障:checking for cl.exe... no

解决:yum install -y gcc-c++

注:如果没有安装xinetd服务,需要安装

yum -y install xinetd

7、  重启xinetd服务

/etc/init.d/xinetd restart

8、  测试服务是否正常

netstat –ntlup 看5666端口是否监听状态

服务器端使用

/usr/local/nagios/libexec/check_nrpe -H 10.0.0.20

获取版本信息

NRPE v2.12