一、监控远程主机的公有服务(比如监控192.168.3.244,192.168.3.233是否存活,并检查192.168.3.233的http是否正常)
1、在objects目录下创建remote.cfg
define host{
use linux-server
host_name 192.168.3.244
alias 192.168.3.244
address 192.168.3.244
}
define host{
use linux-server
host_name 192.168.3.233
alias 192.168.3.233
address 192.168.3.233
}
define hostgroup{
hostgroup_name remote linux-servers
alias remote Linux Servers
members 192.168.3.244,192.168.3.233
}
define service{
use local-service
hostgroup_name remote linux-servers
service_description PING-alive
check_command check_ping!100,20%!500.0,60%
}
define service{
use local-service
host_name 192.168.3.233
service_description HTTP
check_command check_http
}
2、在nagios.cfg文件中添加remote.cfg
cfg_file=/usr/local/nagios/etc/objects/remote.cfg
3、重启nagios服务
systemctl restart nagios
来源:https://www.cnblogs.com/lyz108/p/10297255.html