Healthcheck middleware plugins

class oslo_middleware.healthcheck.Healthcheck(application, conf)

Healthcheck middleware used for monitoring.

If the path is /healthcheck, it will respond 200 with “OK” as the body. Or 503 with the reason as the body if one of the backend report an application issue.

This is useful for the following reasons:

  1. Load balancers can ‘ping’ this url to determine service availability.
  2. Provides an endpoint that is similar to ‘mod_status’ in apache which can provide details (or no details, depending on if configured) about the activity of the server.

Example requests/responses:

$ curl -i -X HEAD “http://0.0.0.0:8775/status” HTTP/1.1 204 No Content Content-Type: text/plain; charset=UTF-8 Content-Length: 0 Date: Fri, 11 Sep 2015 18:55:08 GMT

$ curl -i “http://0.0.0.0:8775/status” HTTP/1.1 200 OK Content-Type: text/plain; charset=UTF-8 Content-Length: 2 Date: Fri, 11 Sep 2015 18:55:43 GMT

OK

Example of paste configuration:

[filter:healthcheck]
paste.filter_factory = oslo_middleware:Healthcheck.factory
path = /healthcheck
backends = disable_by_file
disable_by_file_path = /var/run/nova/healthcheck_disable

[pipeline:public_api]
pipeline = healthcheck sizelimit [...] public_service

Multiple filter sections can be defined if it desired to have pipelines with different healthcheck configuration, example:

[pipeline:public_api]
pipeline = healthcheck_public sizelimit [...] public_service

[pipeline:admin_api]
pipeline = healthcheck_admin sizelimit [...] admin_service

[filter:healthcheck_public]
paste.filter_factory = oslo_middleware:Healthcheck.factory
path = /healthcheck_public
backends = disable_by_file
disable_by_file_path = /var/run/nova/healthcheck_public_disable

[filter:healthcheck_admin]
paste.filter_factory = oslo_middleware:Healthcheck.factory
path = /healthcheck_admin
backends = disable_by_file
disable_by_file_path = /var/run/nova/healthcheck_admin_disable

More details on available backends and their configuration can be found on this page: Healthcheck middleware plugins.

class oslo_middleware.healthcheck.disable_by_file.DisableByFileHealthcheck(conf)

DisableByFile healthcheck middleware plugin

This plugin checks presence of a file to report if the service is unavailable or not.

Example of middleware configuration:

[filter:healthcheck]
paste.filter_factory = oslo_middleware:Healthcheck.factory
path = /healthcheck
backends = disable_by_file
disable_by_file_path = /var/run/nova/healthcheck_disable
class oslo_middleware.healthcheck.disable_by_file.DisableByFilesPortsHealthcheck(conf)

DisableByFilesPorts healthcheck middleware plugin

This plugin checks presence of a file that is provided for a application running on a certain port to report if the service is unavailable or not.

Example of middleware configuration:

[filter:healthcheck]
paste.filter_factory = oslo_middleware:Healthcheck.factory
path = /healthcheck
backends = disable_by_files_ports
disable_by_file_paths = 5000:/var/run/keystone/healthcheck_disable,             35357:/var/run/keystone/admin_healthcheck_disable

Available Plugins

disable_by_file

DisableByFile healthcheck middleware plugin

This plugin checks presence of a file to report if the service is unavailable or not.

Example of middleware configuration:

[filter:healthcheck]
paste.filter_factory = oslo_middleware:Healthcheck.factory
path = /healthcheck
backends = disable_by_file
disable_by_file_path = /var/run/nova/healthcheck_disable

disable_by_files_ports

DisableByFilesPorts healthcheck middleware plugin

This plugin checks presence of a file that is provided for a application running on a certain port to report if the service is unavailable or not.

Example of middleware configuration:

[filter:healthcheck]
paste.filter_factory = oslo_middleware:Healthcheck.factory
path = /healthcheck
backends = disable_by_files_ports
disable_by_file_paths = 5000:/var/run/keystone/healthcheck_disable,             35357:/var/run/keystone/admin_healthcheck_disable

Table Of Contents

Previous topic

API

Next topic

CORS Middleware

Project Source

This Page