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

django-health-check

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. For example, check out the Django ORM backend:

class DjangoDatabaseBackend(BaseHealthCheckBackend):
    def check_status(self):
        try:
            obj = TestModel.objects.create(title="test")
            obj.title = "newtest"
            obj.save()
            obj.delete()
            return True
        except IntegrityError:
            raise ServiceReturnedUnexpectedResult("Integrity Error")
        except DatabaseError:
            raise ServiceUnavailable("Database error")

The project is made using some of the same plugin code that the Django admin site uses - so when you have successfully written a new plugin, you register it to the pool, e.g.

plugin_dir.register(DjangoDatabaseBackend)

Install

Add this to urls.py

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

Add required apps:

'health_check',
'health_check_celery',
'health_check_db',
'health_check_cache',
'health_check_storage',

Remember to add dependencies, for example djcelery for Celery. You should have that already, if you have Celery running. You’ll also have to make sure that you have a result backend configured.

If you are using Celery 3, use the health_check_celery3 application instead of health_check_celery.

Set up monitoring

E.g. add to pingdom - django-health-check will return HTTP 200 if everything is OK and HTTP 500 if anything is not working.

Dependencies

Django 1.4+

Project details


Release history Release notifications | RSS feed

This version

1.3

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-1.3.tar.gz (9.6 kB view details)

Uploaded Source

File details

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

File metadata

File hashes

Hashes for django-health-check-1.3.tar.gz
Algorithm Hash digest
SHA256 e64468b8facaf35b3bf818017a5ac459b47a4f314f916a59f01e2393c485a3f6
MD5 f4fb953cdfdc2e3d65c94d7d4b1f458d
BLAKE2b-256 e8c03354276bcc59d916065f51dce96bcfb9161ee3b50b280417aaa7f1809e18

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