Giter Club home page Giter Club logo

healthysnake's Introduction

healthysnake

CircleCI

healthysnake is a flexible levels-based monitoring library for your application's network dependencies. It is intended as a first step towards improved visibility in your applications before committing to a more intensive monitoring solution.

Currently, healthysnake is in development and should be used in production systems at your own risk.

Levels

Applications may have both hard dependencies which are required for the app to continue running and soft which allow the app to continue with degraded service.

All times are in UTC.

Installation

    pip install healthysnake

(when it gets onto pip hopefully)

Example usage

import os

from healthysnake import healthcheck, levels
from healthysnake.alerts.slack.manager import SlackAlertManager
from healthysnake.checkers import redis, storage, system, network

hc = healthcheck.HealthCheck('example_application',
                             alert_managers=[SlackAlertManager(
                                 webhook=os.environ['SLACK_WEBHOOK'],
                             )])


# checkers can be defined as simple functions
def custom_functional_dependency_check():
    # chosen by fair dice roll
    roll = 4
    return (roll == 4, '')


hc.add_dependency('CUSTOM_FUNCTIONAL_CHECK', custom_functional_dependency_check, level=levels.SOFT)


# or they can be defined as a callable object
class CustomClassBasedCheck:
    def __call__(self):
        # chosen by fair dice roll
        roll = 4
        return (roll == 4, '')


hc.add_dependency('CUSTOM_CLASS_BASED_CHECK', CustomClassBasedCheck(), level=levels.SOFT)

# healthysnake also comes with a variety of useful checkers out of the box
hc.add_dependency('REDIS', redis.RedisConnectionPingable('127.0.0.1'))
hc.add_dependency('DISK SPACE', storage.DiskCapacityCheck('/', failure_threshold=90.0),
                  level=levels.SOFT)
hc.add_dependency('RAM', system.MemoryUtilisationCheck(failure_threshold=75.0))
hc.add_dependency('NETWORK_DEPENDENCY', network.HTTPAddressReachable("https://dammitjim.co.uk"))

print(hc.status())

Example Output

    {
        'name':'example_application',
        'healthy':True,
        'dependencies':[
            {
                'healthy':True,
                'next_update':1505987207.0,
                'last_updated':1505987197.0,
                'level':2,
                'name':'success'
            },
            {
                'healthy':False,
                'next_update':1505987207.0,
                'last_updated':1505987197.0,
                'level':1,
                'name':'soft_failure'
            }
        ]
    }

Alerts

healthysnake currently supports the following alerting systems:

  • Slack
    • pip install requests tested at 2.18.4
  • TODO Sentry
  • TODO Email

healthysnake's People

Contributors

dammitjim avatar

Watchers

 avatar  avatar

Forkers

fatboystring

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.