緊接上文,現在監控了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的連結地址。