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
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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-health-check-2.1.0.tar.gz
.
File metadata
- Download URL: django-health-check-2.1.0.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82c43fa8e8988db0175bbb2eda14c37b5cb78cb5e197da6b1eafd325c58d98f9 |
|
MD5 | 81ada93b64354ce96521d0d54cc47a95 |
|
BLAKE2b-256 | 254ad9d2307c5681abab59568d5ca88c3a1cfb62818545f2333c26d14e64428d |