GithubHelp home page GithubHelp logo

simple-monitor's Introduction

simple-monitor

Usage: python monitor.py

monitor.py read every .conf file in the same directory where monitor.py locate.

Each .conf file is a json config about the service you want to monitor. There are sample config files available.

Configuration:

All configuration files are put in checks folder, each file contain json that include information about a service needs to be checked and can be loaded to a dictionary using json library in Python.

This dictionary contains several keys, the value of each key has a default value defined in monitor.py:

  • description: Description of the service that needs to be checked.
  • url: The URL of this service.
  • method: The method with which this tool sending requests.
  • timeout: The number of seconds after which sending requests timeout.
  • text: The content returned from sending request to this service needs a match with this text.
  • body: POST data, if method is POST.
  • code: HTTP status code returned should match this code.
  • slack_notify: The URL that this tool tries to notify to if any thing wrong about the check, alerting people to focus.
  • headers: After decoded using json, the value of headers is supposed to be a directory, each key/value pair is a HTTP header key/value. refer to http://docs.python-requests.org/en/latest/user/quickstart/#custom-headers

Sample config:

{ "description": "The Wiredcraft website", "url": "http://wiredcraft.com", "method": "GET", "timeout": 4, "text": "wiredcraft", "code": 200, "slack_notify": "https://wiredcraft.slack.com/services/hooks/slackbot?token=4qNSl8UdnaipTg2f36ZnoEU1&channel=song_for_testing", "headers": { "user-agent": "Mozilla" } }

How to install it:

  • Install required packages using command: pip install -r requirements.txt

  • Deploy code to right place.

  • Edit crontab, adding a line like crontab file in this repo.

simple-monitor's People

Contributors

sunsongxp avatar zbal avatar

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.