在监控主机Nagios-server上安装NRPE插件
上传nrpe包
[root@localhost ~]# ls
anaconda-ks.cfg nagios-4.2.4 nrpe-2.15.tar.gz 图片 桌面
Firefox_wallpaper.png nagios-4.2.4.tar.gz 公共的 文档
install.log nagios-plugins-2.2.1 模板 下载
install.log.syslog nagios-plugins-2.2.1.tar.gz 视频 音乐
[root@localhost ~]#
解压并进去目录:
[root@localhost ~]# tar zxf nrpe-2.15.tar.gz
[root@localhost ~]# cd nrpe-2.15
检测环境并指定安装路径:
[root@localhost nrpe-2.15]# ./configure --prefix=/usr/local/nagios/
根据提示继续执行make all命令:
[root@localhost nrpe-2.15]# make all
执行make install-plugin、make install-daemon安装插件:
[root@localhost nrpe-2.15]# make install-plugin && make install-daemon
查看插件是否安装成功:
[root@localhost nrpe-2.15]# ls /usr/local/nagios/libexec/check_nrpe
/usr/local/nagios/libexec/check_nrpe
[root@localhost nrpe-2.15]#
以上都可以通过 “echo $?” 进行判断是否正确
在监控主机的resource.cfg配置文件中添加:
[root@localhost nrpe-2.15]# vim /usr/local/nagios/etc/objects/commands.cfg
#'check_nrpe' command definition
define command{
command_name check_nrpe
command_line $USER2$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
#此处按照check_nrpe命令的用法去配置,可通过check_nrpe –h查看帮助。
}
重启nrpe
[root@localhost objects]# /etc/init.d/nagios restart
Running configuration check...
Stopping nagios: done.
Starting nagios: done.
[root@localhost objects]# echo $?
0
[root@localhost objects]#