All Projects → perdy → health-check

perdy / health-check

Licence: other
Health Check is an application that provides an API to check the health health_check of some parts and some utilities like ping requests. This application can works as standalone or included in a Django project.

Programming Languages

python
139335 projects - #7 most used programming language
javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to health-check

Servermonitor
💓 Laravel package to periodically monitor the health of your server and application.
Stars: ✭ 148 (+377.42%)
Mutual labels:  status, checker, health
Gatus
⛑ Gatus - Automated service health dashboard
Stars: ✭ 1,203 (+3780.65%)
Mutual labels:  status, health
gatus
⛑ Automated service health dashboard
Stars: ✭ 3,018 (+9635.48%)
Mutual labels:  status, health
Minestat
📈 A Minecraft server status checker
Stars: ✭ 168 (+441.94%)
Mutual labels:  status, checker
down
☑️ A CLI tool to check if a site or a list of sites are down or up
Stars: ✭ 54 (+74.19%)
Mutual labels:  status
my-favorite-resources
A Repository that showcases developers' favorite resources to learn a technology
Stars: ✭ 27 (-12.9%)
Mutual labels:  resources
lgsl
LGSL v6.2.0 for PHP 5.4-8.2.0dev (Live Game Server List): online status for Discord, FiveM, Rust, CS, SA:MP, GMOD, Minecraft, Source Query, etc.
Stars: ✭ 101 (+225.81%)
Mutual labels:  status
healthi-app
Simple app to check your laptop's battery health.
Stars: ✭ 47 (+51.61%)
Mutual labels:  health
coronainfobd
Real-time corona-virus tracker of Bangladesh 🇧🇩 which includes latest updates, data visualization, public awareness from WHO and some advice to aware people. 🥰❤
Stars: ✭ 46 (+48.39%)
Mutual labels:  health
resources
A curated collection of useful tech resources 💻
Stars: ✭ 57 (+83.87%)
Mutual labels:  resources
cht-conf
A command-line interface for configuring Community Health Toolkit applications
Stars: ✭ 20 (-35.48%)
Mutual labels:  health
DiseaseClassifier
Using a Naive Bayes Classifier gets possible diseases from symptoms
Stars: ✭ 23 (-25.81%)
Mutual labels:  health
awesome-calculus
🍹 A list of awesome resources I used to study Calculus.
Stars: ✭ 47 (+51.61%)
Mutual labels:  resources
h-war3
已迁移到 https://github.com/hunzsig-warcraft3
Stars: ✭ 16 (-48.39%)
Mutual labels:  resources
node-w3c-validator
Wrapper for The Nu Html Checker (v.Nu)
Stars: ✭ 28 (-9.68%)
Mutual labels:  checker
awesome-authentication
Resources to learn and implement authentication in your application
Stars: ✭ 116 (+274.19%)
Mutual labels:  resources
awesome-design
A collection of open resources for web designers
Stars: ✭ 87 (+180.65%)
Mutual labels:  resources
Management
Management Endpoints used to allow insight into your applications
Stars: ✭ 31 (+0%)
Mutual labels:  health
Mining-Minds
Mining Minds is a collection of services, tools and techniques working collaboratively to investigate on human’s daily routines to provide a personalized well-being and health-care support
Stars: ✭ 43 (+38.71%)
Mutual labels:  health
CPP-Questions
Competitive Programming Questions
Stars: ✭ 52 (+67.74%)
Mutual labels:  resources

Health Check

Version: 3.4.1
Status: Production/Stable
Author: José Antonio Perdiguero López

Health Check is an application that provides an API to check the health status of some parts and some utilities like ping requests. This application can works as standalone or included in a Django project.

This application defines the following terms:

Provider
Function that does a quick check or stats gathering and returns a json serializable value, such as dict, list or simple types.
Resource
A service or functionality whose status needs to be known.

Said this, providers are grouped by resources. So you can use resource as a simple group, or as a component of your application. E.g: A resource that represents your database with some checks over it, such as simple ping, check if your application tables are created, if it contains data...

Quick start

  1. Install this package using pip:
pip install health-check
  1. (Django) Add PROJECT_PATH to your django settings module.
  2. (Django) Add health_check to your INSTALLED_APPS settings like this:
INSTALLED_APPS = (
    ...
    'health_check',
)
  1. (Django) Add Health Check urls to your project urls:
urlpatterns = [
    ...
    url(r'^health/', include('health_check.urls')),
]

Check Providers

Health Check provides a mechanism to add new custom check functions through check providers. Each check provider will generate a new API method with an URL that uses the name of the provider. These functions must accept *args and **kwargs and will return a JSON-serializable object through json.dumps() method, for example a ping function:

def ping(*args, **kwargs):
    return {'pong': True}

By default Health Check provides the follow checks:

Ping

A ping to application.

URL: /api/health/ping

Databases

Check if databases are running.

URL: /api/health/databases

Caches

Check if caches are running.

URL: /api/health/caches

Celery

Check if celery workers defined in settings are running.

URL: /api/health/celery

Databases stats

Show stats for all databases.

URL: /api/stats/databases

Celery stats

Show celery worker stats.

URL: /api/stats/celery

Code

Source code stats such as current active branch, last commit, if debug is active...

URL: /api/stats/code

Run providers

The main goal of this application is to provide an easy way to run checks over defined resources, so there are different ways to do it.

Command

Health Check provides a command to query current health of a resource. This command can be call as:

health_check {resource} [options]

Call a specific provider from a resource:

health_check {resource} {provider} [options]

To get current status of health checks, and exit with an error if some check is failing:

health_check health -e

Each resource has its own set of options that can be displayed through command help:

health_check -h

Code

To run all providers of a specific resource:

from health_check.providers import Resource

resource = Resource('resource_name')
providers_result = resource()

A single provider can be executed:

from health_check.providers import Provider

provider = Provider('path.to.provider_function')
provider_result = provider()

Django

Health check adds some useful behavior to your Django application.

Health Check website

A website that shows Health Check data is available in this application. It's possible access to follow URLs to get a detailed view of your system health status. Those three pages will show results of providers configured (as explained in settings section):

http://www.website.com/health/
http://www.website.com/health/health/
http://www.website.com/health/stats/

Health Check API

Health Check API can be used as a standalone application including only their urls:

urlpatterns = [
    ...
    url(r'^health/', include('health.api.urls')),
]

This API have a single url for each provider, that are grouped by resources. Each provider can be queried alone, returning his current health status:

http://your_domain/health/api/health/ping

Also there is a resource view that will return the health status of all providers:

http://your_domain/health/api/health

For last, there is a root view that will return the health status of all providers from all resources:

http://your_domain/health/api

Django management commands

Previous command can be used as Django management command:

python manage.py health_check {resource} {provider} [options]

Settings

Health check settings can be added directly to Django settings module or create an specific module for them. If a custom module (or class) is used, you must specify it through HEALTH_CHECK_SETTINGS environment variable.

To use a custom module for settings is necessary to specify the full path: project.package.settings. The same applies to objects: project.package.settings:SettingsObject.

health_check_providers

List of additional check providers. Each provider consists in a tuple of name, function complete path, args and kwargs.

Example:

HEALTH_CHECK_PROVIDERS = {
    'resource': (
        ('test', 'application.module.test_function', [1, 2], {'foo': 'bar'}),
    )
}

Default:

providers = getattr(settings, 'HEALTH_CHECK_PROVIDERS', {
    'health': (
        ('ping', 'health_check.providers.health.ping', None, None),
        ('databases', 'health_check.providers.django.health.databases', None, None),
        ('caches', 'health_check.providers.django.health.caches', None, None),
    ),
    'stats': (
        ('databases', 'health_check.providers.django.stats.databases', None, None),
        ('code', 'health_check.providers.stats.code', None, None),
    )
}

health_check_celery_workers

List of hostname from celery workers to be checked. If any worker is defined, two additional providers listed previously will be added to default set.

Default:

health_check_celery_workers = ()
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].