Skip to main content

a pluggable app that runs a full check on the deployment, using a number of plugins to check e.g. database, queue server, celery processes, etc.

Project description

version ci coverage health license

This project checks the health for a number of backends and sees if they are able to connect and do a simple action.

plugin_dir.register(DjangoDatabaseBackend)

Install

Add this to urls.py

url(r'^ht/$', include('health_check.urls'))

Add required apps:

'health_check',  # required
'health_check.db',
'health_check.cache',
'health_check.storage',
'health_check.contrib.celery',
'health_check.contrib.s3boto_storage',

Set up monitoring

You can use tools like Pingdom or other uptime robots. The /ht/ endpoint will respond a HTTP 200 if all checks passed and a HTTP 500 if any of the tests failed.

Writing a custom health check

Writing a health check:

class MyHealthCheckBackend(BaseHealthCheckBackend):
    def check_status(self):
        # The test code goes here.
        # You can use `self.add_error` or raise a
        # `HealthCheckException`. Similar to Django's form validation.
        pass

    def identifier(self):
        return self.__class__.__name__  # Display name on the endpoint.

Register the backend in your app configuration:

from django.apps import AppConfig

from health_check.plugins import plugin_dir


class MyAppConfig(AppConfig):
    name = 'my_app'

    def ready(self):
        from .backends import MyHealthCheckBackend
        plugin_dir.register(MyHealthCheckBackend)

Project details


Release history Release notifications | RSS feed

This version

2.0.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-health-check-2.0.0.tar.gz (10.0 kB view details)

Uploaded Source

File details

Details for the file django-health-check-2.0.0.tar.gz.

File metadata

File hashes

Hashes for django-health-check-2.0.0.tar.gz
Algorithm Hash digest
SHA256 7b9950fa5001df8b339eb567e6261baf4bda54c09abd7dad745ea9ab53829a4c
MD5 399b71fe55223bb68ddc6fcd25efc7f2
BLAKE2b-256 47f9f17b12f329164f5cec2e080403be7fed930d51ac14518cff67684d1e4ef0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page