紧接上文,现在监控了10.112.18.131 host,但是没有任何public service被监控。该机上已经安装了nginx,监听80端口,提供了静态文件服务器。
第一步:确保nginx提供了根目录的访问
location / {
root /opt;
index index.html;
}
手动通过浏览器测试一下:
可以看到index.html的内容就行了。
第二步:在/usr/local/icinga/etc/object/linux.cfg文件中添加一个service
File Edit Options Buffers Tools Minibuf Help
define host{
use linux-server ; Inherit default values from a template
host_name StaticFileServer ; The name we're giving to this host
alias static filer server for 3D and jenksins server for CloudEngine ; A longer name associated with the host
address 10.112.18.131 ; IP address of the host
contact_groups admins ; Host groups this host is associated with
}
# check that web services are running
define service {
host_name StaticFileServer
service_description HTTP
check_command check_http
use generic-service
action_url
notification_interval 0 ; set > 0 if you want to be renotified
}
好。测试一下:
/usr/local/icinga/bin/icinga -v /usr/local/icinga/etc/icinga.cfg
然后重新加载:
service icinga reload
现在刷新网页: