Giter Club home page Giter Club logo

kafka-web-monitor's Introduction

kafka-web-monitor

Author: Martin 'BruXy' Bruchanov

HTTP(S) monitoring tool

This is a website monitoring tool using Apache Kafka messaging framework.

  • producer.py collects metrics and sends them via Kafka to
  • consumer.py which stores the received message to the PostgreSQL database.

To run producer/consumer use (exit with Ctrl-c):

./producer.py monitor.conf
./consumer.py monitor.conf

A configuration example can be found in: example_monitor.conf.

Overview:

Producer is using src/https_status.py to check website metrics in defined period. It collects:

  • timestamp,
  • GET status/errors,
  • website response time and
  • optionally tests if the page HTML contains text defined by regex.

If there is a TCP connection error when requesting some URL, the status metric and response time is set to 0. Timeouts for TCP and HTTP can be set in the configuration file.

Each website monitor runs in a separate thread and sends collected metric to Apache Kafka.

Consumer receives messages from Apache Kafka and stores them in a PostgreSQL database. Each monitoring stream is saved to a separate database table. All methods for database queries are defined in src/database.py.

Both scripts are using src/read_config.py to parse text configuration file.

Installation

  1. Clone repository: git clone https://github.com/BruXy/kafka-web-monitor.git.
  2. If necessary for executing a new Python virtual environment, there is make venv to setup a local environment in PYTHON_VENV_DIR as defined in the Makefile.
  3. Install required packages: make pip-install

Development

Check Makefile for additional support tools. To use a PostreSQL database you need to have postgres (psql) client and libpq-devel installed, use make dev-install to add these packages on RPM based GNU/Linux distributions.

Code syntax check and unit tests can be executed by invoking make without any parameters, recipes for these tests are defined in target "syntax" and "test".

kafka-web-monitor's People

Contributors

bruxy avatar

Watchers

 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.