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](https://img.shields.io/pypi/v/django-health-check.svg)](https://pypi-hypernode.com/pypi/django-health-check/)
[![ci](https://api.travis-ci.org/KristianOellegaard/django-health-check.svg?branch=master)](https://travis-ci.org/KristianOellegaard/django-health-check)
[![coverage](https://coveralls.io/repos/KristianOellegaard/django-health-check/badge.svg?branch=master)](https://coveralls.io/r/KristianOellegaard/django-health-check)
[![code-health](https://landscape.io/github/KristianOellegaard/django-health-check/master/landscape.svg?style=flat)](https://landscape.io/github/KristianOellegaard/django-health-check/master)
[![BSD License](https://img.shields.io/badge/license-BSD-blue.svg)](LICENSE)

This project checks a number of backends, if they are able to connect and do a simple action, e.g. check out the django ORM backend:


```python

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 codes, that the django admin site uses - so when you have sucessfully written a new plugin, you register it to the pool, e.g.

```python
plugin_dir.register(DjangoDatabaseBackend)
```


Install
=======

Add this to urls.py

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

Add required apps:

```python
'health_check',
'health_check_celery',
'health_check_db',
'health_check_cache',
'health_check_storage',
```
(remember to add dependencies, e.g. djcelery - however you should have that already, if you have celery running).
You'll also have to make sure that you have a
`result backend <http://celery.readthedocs.org/en/latest/configuration.html?highlight=result_backend#std:setting-CELERY_RESULT_BACKEND>`_
configured.
If you are using celery 3, use ``health_check_celery3`` 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.1.2

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

Uploaded Source

File details

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

File metadata

File hashes

Hashes for django-health-check-1.1.2.tar.gz
Algorithm Hash digest
SHA256 adb518b9d25b1681c50382b55e9ec74227e26ccc808f5cea961469766293a80f
MD5 2b1dcac85c42e9df0b47f02565b1eb8b
BLAKE2b-256 f6696bb40ae96ee68ea2efecd33940ccda8b4f3db81b02b3644e6e3c94c6c2f3

See more details on using hashes here.

Provenance

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