django-health-check
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+
Metadata
Release files for django-health-check 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-health-check-1.2.1.tar.gz | 9.3 kB | Details |
Release files / django-health-check-1.2.1.tar.gz
| Download URL | django-health-check-1.2.1.tar.gz |
|---|---|
| Size | 9.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3d1045c1e02e250f146a667b37627f9df2f6970e67b38d6906ea9368213186f9
|
|
BLAKE2b-256 checksum How to use checksums |
5978c32119d591ec00a3718099e28ba557539e79624133eafab672acb2f515e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |