Coder Social home page Coder Social logo

avmon's Introduction

AvMon - HTTP endpoint availability monitor

A microservice-based HTTP endpoint monitor using Python for the actual code, Apache Kafka for combining multi-writer events into a single queue and PostgreSQL for long-term data storage.

Architecture diagram

The project is dockerized using a single container, which is switched to perform different functions with the AVMON_ROLE environment variable. Collector components are configured using a mounted config file.

Running

A minimal local system (one of each component) can be started with:

make create-dotenv docker-up

or even smaller system without dockerizing the application itself, running all Python services in a single process (requires Python >= 3.8):

make create-dotenv install-deps docker-dbs run-all

In either case, navigate to https://localhost:8080/ for the visualization. Then proceed to tweak the configuration file to include sites you would like to monitor.

Using external databases

If you are going to use external non-dockerized database, such as a cloud-hosted one, then the authentication must be configured using either a .env file or actual environment variables:

POSTGRES_HOST=host.example.org
POSTGRES_PORT=5432
POSTGRES_USER=avmon
POSTGRES_PASSWORD=PASSWORD_HERE
POSTGRES_DB=avmon

AVMON_KAFKA=host.example.org:9092
AVMON_KAFKA_SSL=1

Moreover, with AVMON_KAFKA_SSL=1 you must pass the actual SSL keys and certificates. They should be placed in a folder named keys and the filenames should be access-key, access-cert, ca-cert.

Remote databases must also be set up properly. Usually that means at least that PostgreSQL user and database must be created. Kafka should require no special setup, but make sure that it is configured to automatically create topics (kafka.auto_create_topics_enable=1) or manually create a topic called messages.

Project structure

Most important project files are:

Development

Requireds Python (>= 3.8), and Docker + Docker-compose. Most of the commands are rather *nix-specific, so Linux or macOS is recommended.

Setup

make dev-setup

Installs the dev dependencies locally. It also creates git hooks that make sure you will not commit unformatted code or push untested code.

Formatter

The project uses Black for code formatting to ensure uniform style. To automatically format code, run make format.

Type checking

Mypy is used for type checking. To make sure you have not introduced type errors, run make type-check.

Tests

make test runs the whole test suite, which takes quite some time. Use python -m pytest -k testname to run one test at a time. python -m pytest -s can be used to see test output while the test is still running. Please note that the E2E tests use docker-compose to manage environment and cannot be ran if the system is already running.

License

MIT

avmon's People

Contributors

dentosal avatar

Watchers

 avatar  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.