上一篇Nagios监控窗口中已经写到Nagios的安装过程,这里不再重复。
基于NPRE检测linux
在linux主机上安装NRPE,并通过5666端口让服务端check_nrpe跟NRPE进行通讯
NRPE插件(Nagios远程执行人)是用于在远端服务器上运行检测命令的守护进程,他用于让Nagios监控端基于安装的方式触发远端主机上的检测命令,并将检测结果输出至监控端,而其执行的开销远低于基于SSH的检测方式,而且检测过程并补需要远程主机上的系统账号等信息,其按期性也高于SSH的检测方式
安装前准备
调整系统时间
下载nagios-plugins-2.2.1.tar。广州
https://www.nagios.org/downloads/nagios-plugins/
下载nrpe-3.1.0.tar。广州
=============================================================
配置被监控端Nagios客户
1。安装nrpe和nagios插件
[root@client ~] # yum安装openssl openssl-devel xinetd gcc使
[root@client ~] # useradd nagios
[root@client ~] # tar xvf nagios-plugins-2.2.1.tar。广州
[root@client ~] # cd nagios-plugins-2.2.1
[root@client nagios-plugins-2.2.1] # ./configure,,使,,使安装
[root@client ~] # tar xvf nrpe-2.13.tar。广州
[root@client ~] # cd nrpe - 2.13
[root@client nrpe - 2.13] # ./configure,,使,,使安装
[root@client nrpe - 2.13] #让install-daemon-config
[root@client nrpe - 2.13] #让安装xinetd
[root@client nrpe - 2.13] # vim/etc/xinetd.d/nrpe
#默认值:alt=" Nagios4.3.1监控Centos6.7”> [root@client nrpe - 2.12] # vim/etc/services
nrpe 5666/tcp # nrpe//添加该行
[root@client nrpe - 2.13] #服务重新启动xinetd
[root@client nrpe - 2.13] # chkconfig xinetd alt=" Nagios4.3.1监控Centos6.7”>
2。配置监控本地私有资源
[root@client nrpe - 2.12] # vim/usr/local/nagios/etc/nrpe.cfg
命令[check_user]=/usr/地方/nagios/libexec/check_user 5 - c - w 10
命令[check_load]=/usr/地方/nagios/libexec/check_load - w 15日10日5 - c 30日,25日,20
命令[check_root]=/usr/地方/nagios/libexec/check_disk - w - c - p/dev/mapper/vg01-lv_root 10% 20%
命令[check_home]=/usr/地方/nagios/libexec/check_disk - w - c - p/dev/mapper/vg01-lv_home 10% 20%
命令[check_zombie_procs]=/usr/地方/nagios/libexec/check_procs 10 5 - c - w - s Z
命令[check_total_procs]=/usr/地方/nagios/libexec/check_procs - w 150 - c 200
命令[check_swap]=/usr/地方/nagios/libexec/check_swap - w - c
40% 50% (root@client ~) #服务重新启动xinetd
开放5666端口并重启防火墙
[root@localhost/] # vim/etc/sysconfig/iptables
-输入- m状态——国家新的tcp - p tcp——dport 5666 - j - m接受
========================================================
配置监控中心Nagios服务器
1。安装nrpe插件并测试
[root@master ~ # tar xvf nrpe-2.13.tar。广州//仅需要check_nrpe插件
[root@master nrpe - 2.13] # ./configure,,让所有,,使安装
[root@master ~] #/usr/local/nagios/libexec/check_nrpe - h 10.200.1.24
NRPE v2.13
定义主机和定义服务
[root@linyangjun当地]# cd/etc/nagios/
编辑nagiios。cfg
增加cfg_file=/etc/nagios/对象/centos6.cfg 保存后退出
在/usr/地方/nagios/libexec下,使用cher_nrpe - h 10.200.1.24测试链接,显示版本号表示链接正常
重启完毕打开监控web界面,登录之后可以看到centos6已经在监控列表中