Monitoring : URL monitoring with Shinken

Shinken is an excellent monitoring platform which scales considerably better than competing solutions like Nagios or Zabbix. While the documentation is generally very good the problem is there are a number of lose ends where the documentation is not that clear. One element is how to monitor URL’s for a web site using shinken.

In etc/hosts/<hostname>.cfg you should have the following
define host{
     use           http
     host_name     www.google.com
     address       www.google.com
 }

Where www.google.com is the site that you want to monitor. Now by default that will only monitor port 80 with a simple HTTP check. To change that so that you are now monitoring a URL you can add the following configuration

define host{
     use           http
     host_name     www.google.com
     address       www.google.com
     _CHECK_HTTP_URI    /translate/
 }

By adding the MACRO CHECK_HTTP_URL the check_http template will automatically start to monitor the new url /TRANSLATE/ you can change that to whatever you want as long as it is a valid URL on the destination server. there are a number of other MACRO’s built into the HTTP and HTTPS health checks. They are:

_CHECK_HTTP_PORT

_CHECK_HTTP_DOMAIN_NAME

_CHECK_HTTP_URI

_CHECK_HTTPS_PORT

_CHECK_HTTPS_DOMAIN_NAME

_CHECK_HTTPS_URI

Each one should be very descriptive by their names.

NOTE: by default the check_http script uses SNI for HTTPS validation.
NOTE: /translate/ will result in a 404 error which will show that the monitor works. Try /translate to get the correct answer

 

 

Tags: , , ,