Andygmb / django-health-check

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.

Home Page:http://kristianoellegaard.github.com/django-health-check/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

django-health-check

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:

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.

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, 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.

Profit

Screenshot of django-health-check

Our mascot

django-health-check is the most interresting project in the world

Dependencies

Python 2.7+ (Yes, thats right, we have Python 3 support)

Django 1.2+

About

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.

http://kristianoellegaard.github.com/django-health-check/

License:MIT License


Languages

Language:Python 87.3%Language:HTML 12.7%