Skip to main content

API offering health metrics for the ``django-server-guardian`` app.

Project description

API offering health metrics for the Django Server Guardian app.

Installation and Usage

To get the latest stable release from PyPi

pip install django-server-guardian-api

To get the latest commit from GitHub

pip install -e git+git://github.com/bitmazk/django-server-guardian-api.git#egg=server_guardian_api

Add server_guardian_api to your INSTALLED_APPS

INSTALLED_APPS = (
    ...,
    'server_guardian_api',
)

Add the server_guardian_api URLs to your urls.py

urlpatterns = [
    url(r'^server-guardian-api/', include('server_guardian_api.urls')),
]

As a simple auth method add the security token as described in the README of the Django Server Guardian to your settings as SERVER_GUARDIAN_SECURITY_TOKEN

SERVER_GUARDIAN_SECURITY_TOKEN = 'asd0hb42t92-example-token-39gh1g3-91hfosj325'

Add the SERVER_GUARDIAN_PROCESSORS setting where you’re endpoint metrics are defined.

SERVER_GUARDIAN_PROCESSORS = (
    'server_guardian_api.endpoints.mailer_mail',
    'myapp.mymodule.myfunction',
)

The functions defined in this setting must return a dictionary in the following format

{
    'status': 'OK', # must be one of: "OK", "WARNING", "DANGER"
    'info': 'additional text describing the status. e.g. type of error',
}

That mean, your API endpoint will, if all is correct, return something like this

[
    {
        'label': 'mail_queue',
        'status': 'OK',
        'info': "No deferred email queued. That's great!",
    },
    {
        'label': 'other_metric',
        ...
    },
]

Contribute

If you want to contribute to this project, please perform the following steps

# Fork this repository
# Clone your fork
mkvirtualenv -p python2.7 django-server-guardian-api
make develop

git co -b feature_branch master
# Implement your feature and tests
git add . && git commit
git push -u origin feature_branch
# Send us a pull request for your feature branch

In order to run the tests, simply execute tox. This will install two new environments (for Django 1.8 and Django 1.9) and run the tests against both environments.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-server-guardian-api-0.1.2.tar.gz (7.8 kB view details)

Uploaded Source

File details

Details for the file django-server-guardian-api-0.1.2.tar.gz.

File metadata

File hashes

Hashes for django-server-guardian-api-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e73ed3d3175d74ea9762d007695a83759c88ba21fcf4d4f354fbff607513fce4
MD5 c1e39a70ac1dce441614a0a27887e193
BLAKE2b-256 c36fb76b02ca7955677edae38c54269a2dfb4a976b2b3caa345eca75708e8ea2

See more details on using hashes here.

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