服务端
一. nagios 的配置文件在 /usr/local/nagios/etc
1.vi cgi.cfg
refresh_rate=30 #nagios主页的刷新时间,我设置成30秒自动刷新
use_authentication=0 #关闭认证功能,当nagios配置好后,建议开回来
2.在配置文件/usr/local/nagios/etc/nagios.cfg
已经定义了所用主机文件都在servers
3.在servers 下创建新建主机目录
例:被监控的主机IP:192.168.66.221
[root@localhost etc]# cd /usr/local/nagios/etc/servers
[root@localhost servers]# vi 192.168.66.221.cfg
编辑内容为:
define service{
use generic-service
host_name 192.168.66.221 (被监控主机的IP)
service_description check_sda1
check_command check_nrpe!check_sda1
max_check_attempts 5
normal_check_interval 1
}
define host{
use linux-server
host_name 192.168.66.221 (被监控主机的IP)
alias 192.168.66.221 (被监控主机的IP)
address 192.168.66.221 (被监控主机的IP)
}
define service{
use generic-service
host_name 192.168.66.221 (被监控主机的IP)
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.66.221 (被监控主机的IP)
service_description check_ftp
check_command check_ftp!21
max_check_attempts 5
normal_check_interval 1
}
define service{
use generic-service
host_name 192.168.66.221 (被监控主机的IP)
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.66.221 (被监控主机的IP)
service_description check_http
check_command check_http
max_check_attempts 5
normal_check_interval 1
}
被监控端
在/usr/local/nagios/etc 下的nrpe.cfg
修改配置;server_address=192.168.66.221(本地IP)
allowed_hosts=192.168.211.129(服务端IP)
未完