回到 /usr/local/src
cd /usr/local/src
解压 nrpe-2.13.tar.gz
sudo tar zxvf nrpe-2.13.tar.gz
cd nrpe-2.13
编译nrpe
sudo./configure –prefix=/usr/local/nagios –with-ssl-inc=/usr/include –with-ssl-lib=/usr/lib/x86-linux-gnu
安装nrpe
sudo make all
sudo make install-plugin
sudo make install-daemon
sudo make install-daemon-config
sudo make install-xinetd
检查是否安装xinetd服务(一般没有安装)
sudodpkg -L xinetd
如果返回”未曾安装软件包xinetd“ 的提示,就需要安装xinetd服务
sudo apt-get install xinetd
将xinetd添加到启动级别中
sudo update-rc.dxinetd defaults
设为随机自启动
sudochkconfigxinetd on
编辑 /etc/services配置文件,添加nrpe的服务端口
sudo vim /etc/services
在尾行添加如下配置
nrpe 5666/tcp # NRPE Service Port
如果是被监控端,还需要编辑 /etc/xinted.d/nrpe
sudo vim /etc/xinetd.d/nrpe
only_from = 127.0.0.1 10.1.10.23(添加nagios的ip地址)
退出并保存
sudochkconfignrpe on
sudo /etc/init.d/xinetd restart
检查nrpe服务是否正常
sudonetstat -at | grepnrpe
如果返回“tcp 0 0 *:nrpe *:* LISTEN”,说明服务正常
启动服务
更改/usr/local/nagios目录的属主和属组
suduochown -R nagios.nagcmd /usr/local/nagios
将nagios添加到启动级别中
sudo update-rc.dnagios defaults
设为随机自启动
sudochkconfignagios on
启动nagios服务
sudo /etc/init.d/nagios start
重启 apache2服务
sudo /etc/init.d/apache2 restart
登录http://localhost/nagios查看页面是否正常
配置nagios主配置文件
sudo vim /usr/local/nagios/etc/nagios.cfg
添加所添加的配置文件
cfg_file=/usr/local/nagios/etc/objects/beyondsoft_servers.cfg
cfg_file=/usr/local/nagios/etc/objects/bys_servers_group.cfg
cfg_file=/usr/local/nagios/etc/objects/services.cfg
beyondsoft_servers.cfg是定义主机的配置文件
bys_servers_group.cfg是定义主机组的配置文件
services.cfg是定义服务并和主机组相关联的配置文件

