Skip to content

Simple Django app/framework to publish health check for monitoring purposes

License

Notifications You must be signed in to change notification settings

vdboor/django-healthchecks

 
 

Repository files navigation

django-healthchecks

Simple Django app/framework to publish health check for monitoring purposes

Status

https://travis-ci.org/mvantellingen/django-healthchecks.svg?branch=master http://codecov.io/github/mvantellingen/django-healthchecks/coverage.svg?branch=master

Installation

pip install django_healthchecks

Usage

Add the following to your urls.py:

url(r'^healthchecks/', include('django_healthchecks.urls')),

Add a setting with the available healthchecks:

HEALTH_CHECKS = {
    'postgresql': 'django_healthchecks.contrib.check_database',
    'cache_default': 'django_healthchecks.contrib.check_cache_default',
    'solr': 'your_project.lib.healthchecks.check_solr',
}

You can also include healthchecks over http. This is useful when you want to monitor if depending services are up:

HEALTH_CHECKS = {
    ...
    'my_microservice': 'https://my-service.services.internal/healthchecks/',
    ...
}

By default, http health checks will time out after 500ms. You can override this as follows:

HEALTH_CHECKS_HTTP_TIMEOUT = 0.5

By default the status code is always 200, you can change this to something else by using the HEALTH_CHECKS_ERROR_CODE setting:

HEALTH_CHECKS_ERROR_CODE = 503

You can also add some simple protection to your healthchecks via basic auth. This can be specified per check or a wildcard can be used *.

HEALTH_CHECKS_BASIC_AUTH = {
    '*': [('admin', 'pass')],
    'solr': [],
}

About

Simple Django app/framework to publish health check for monitoring purposes

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 98.5%
  • Makefile 1.5%