Health Checks Plugin

This is a simple plugin, to provide basic (but configurable) health checks. This is a server intercept plugin, and it takes one single configuration option in plugin.config, the configuration file name.

Configuration

To enable the healthchecks plugin, insert the following line in plugin.config:

healthchecks.so <healthcheck-configuration-file>

The required <healthcheck-configuration-file> may reference either an absolute or relative path to the file containing the healthcheck configuration.

This configuration may contain one or more lines of the format:

<URI-path> <file-path> <mime> <file-exists-code> <file-missing-code>

Note

The URI-path can not be “/” only.

Note

This configuration is not reloadable.

The content of the file specified in the file-path, if any, is sent as the body of the response. The existence of the file is sufficient to get an “OK” status. Performance wise, everything is served out of memory, and it only stats / opens files as necessary. However, the content of the status file is limited to 16KB, so this is not a generic static file serving plugin.

Example

This line would define a health check link available at http://www.example.com/__hc that would check if the file /var/run/ts-alive existed on the server. If the file exists, a response is built with the contents of the ts-alive file, a mime type of text/plain and a status code of 200. If the file does not exist, a 403 response is sent:

/__hc  /var/run/ts-alive  text/plain 200  403