首页 > 代码库 > nagios客户端安装监控

nagios客户端安装监控

1、在客户端机器上安装epel扩展源
yum install -y epel-release
2、yum安装nagios及依赖包软件
yum install -y nagios-plugins
nagios-plugins-all nrpe nagios-plugins-nrpe
3、编辑nrpe配置文件 vim /etc/nagios/nrpe.cfg
修改如下:(1)将allowed_hosts=127.0.0.1改为
allowed_hosts=127.0.0.1,192.168.81.131。
其后ip为服务端ip.
(2)找到“dont_blame_nrpe=0”
改为“dont_blame_nrpe=1”
4、启动客户端
/etc/init.d/nrpe start
5、服务端配置监控的客户端
vim /etc/nagios/conf.d/192.168.81.132.cfg
配置如下:
define host{
use linux-server
host_name 192.168.81.132
alias 81.132
address 192.168.81.132
}
define service{
use generic-service
host_name 192.168.81.132
service_description check_ping
check_command check_ping!100.0,20%!200.0,50%
max_check_attempts 5
normal_check_interval 1
}
define service{
use generic-service
host_name 192.168.81.132
service_description check_ssh
check_command check_ssh
max_check_attempts 5
normal_check_interval 1
}

define service{
use generic-service
host_name 192.168.81.132
service_description check_http
check_command check_http
max_check_attempts 5
normal_check_interval 1
}
6、服务端重启nagios服务
service nagios restart

2、编辑监控的客户端配置文件
vim /etc/nagios/conf/192.168.81.132.cfg
加入如下内容:
#监控负载
define service{
use generic-service
host_name 192.168.81.132
service_description check_load
check_command check_nrpe!check_load
max_check_attempts 5
normal_check_interval 1
}
#监控
define service{
use generic-service
host_name 192.168.81.132
service_description check_disk_hda1
check_command check_nrpe!check_hda1
max_check_attempts 5
normal_check_interval 1
}
define service{
use generic-service
host_name 192.168.81.132
service_description check_disk_hda3
check_command check_nrpe!check_hda3
max_check_attempts 5
normal_check_interval 1
}
3、客户端配置文件nrpe.cfg
修改如下:
(1)找到check_hda1 更改/dev/hda1为/dev/sda1
增加一行
command[check_hda2]=..../devsda2. 同check_hda1
4、重新启动客户端nrpe服务 :/etc/init.d/nrpe restart
5、重新启动服务端nagios服务
service nagios restart

nagios客户端安装监控