1、安装nrpe服务
解压缩
[root@nagios ~]# tar -zxvf nrpe-2.14.tar.gz
[root@nagios ~]# cd nrpe-2.14
编译
[[root@nagios nrpe-2.14]#./configure
root@nagios nrpe-2.14]# make all
[root@nagios nrpe-2.14]# make install-plugin
只运行这一步就行了,因为只需要check_nrpe插件
3、配置监控对象(工作站及其服务等)
[root@nagios ~]# vim /usr/local/nagios/etc/nagios.cfg
在cfg_file=/usr/local/nagios/etc/objects/localhost.cfg下添加:
cfg_file=/usr/local/nagios/etc/objects/linux.cfg
:wq
4、新建linux.cfg设置要监控的内容
[root@nagios ~]# cd /usr/local/nagios/etc/object
[root@nagios ~]# vim linux.cfg
define host{
use linux-server
host_name web
alias web
address 10.10.10.253
}
define service{
use generic-service
host_name web
service_description check-swap
check_command check_nrpe!check_swap
}
define service{
use generic-service
host_name web
service_description check-load
check_command check_nrpe!check_load
}
define service{
use generic-service
host_name web
service_description check-disk
check_command check_nrpe!check_had1
}
define service{
use generic-service
host_name web
service_description check-users
check_command check_nrpe!check_users
}
define service{
use generic-service
host_name web
service_description otal_procs
check_command check_nrpe!check_total_procs
}
6、测试无法访问,检查一下IPtables是否关闭。
[root@nagios ~]# service iptables status
添加nrpe 5666端口:
[root@nagios ~]# vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5666 -j ACCEPT
[root@nagios ~]# service iptables restart
3、安装nrpe服务
解压缩
[root@web ~]# tar -zxvf nrpe-2.14.tar.gz
[root@web ~]# cd nrpe-2.14
编译
[root@web nrpe-2.14]#./configure
输出如下
*** Configuration summary for nrpe 2.8.1 05-10-2007 ***:
General Options:
-------------------------
NRPE port: 5666
NRPE user: nagios
NRPE group: nagios
Nagios user: nagios
Nagios group: nagios
Review the options above for accuracy. If they look okay,
type 'make all' to compile the NRPE daemon and client.
可以看到NRPE的端口是5666,下一步是make all
[root@web nrpe-2.14]# make all
输出如下
*** Compile finished ***
If the NRPE daemon and client compiled without any errors, you
can continue with the installation or upgrade process.
Read the PDF documentation (NRPE.pdf) for information on the next
steps you should take to complete the installation or upgrade.
接下来安装NPRE插件,daemon和示例配置文件
安装check_nrpe这个插件
[root@web nrpe-2.14]# make install-plugin
之前说过监控机需要安装check_nrpe这个插件,被监控机并不需要,我们在这里安装它是为了测试的目的
安装deamon
[root@web nrpe-2.14]# make install-daemon
安装配置文件
[root@web nrpe-2.14]# make install-daemon-config
现在再查看nagios目录就会发现有5个目录
[root@web nrpe-2.14]# ls /usr/local/nagios/
bin etc include libexec share
按照安装文档的说明,是将NRPE deamon作为xinetd下的一个服务运行的.在这样的情况下xinetd就必须要先安装好,不过一般系统已经默认装了
6、测试无法访问,检查一下IPtables是否关闭。
[root@web ~]# service iptables status
添加nrpe 5666端口:
[root@web ~]# vim /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5666 -j ACCEPT
[root@web ~]# service iptables restart