icinga 添加http service

来源:互联网 发布:鼎力测试软件下载 编辑:程序博客网 时间:2024/06/04 20:00

紧接上文,现在监控了10.112.18.131 host,但是没有任何public service被监控。该机上已经安装了nginx,监听80端口,提供了静态文件服务器。

第一步:确保nginx提供了根目录的访问

               location / {                        root   /opt;                        index  index.html;               }
手动通过浏览器测试一下:http://10.112.18.131

可以看到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                      http://10.112.18.131/ArcGIS/rest/services/SanFrancisco/3DFeatureServer                                                                           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

现在刷新网页:



一切OK. 点击HTTP右边的齿轮按钮,可以打开action_url的链接地址。

原创粉丝点击