brootware / sitemon

An agent to monitor the uptime of multiple sites and response time without any external libraries.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool



SiteMon πŸ“ˆπŸ“

Twitter Follow

An agent to monitor the uptime of multiple sites and response time without any external libraries like requests or ICMP (pings).



Features

A monitoring daemon that reads in a list of hosts and ports to ping and records the response time in CSV format.

  • Uses socket-level pinging πŸ”Œ
  • Asynchronous, non-blocking pings on the list of defined hosts and ports πŸš€
  • Captures response time in milliseconds(ms) ⚑
  • Written in pure Python without any external libraries. 🐍

Installation

Clone and activate a virtual environment.

git clone https://github.com/brootware/sitemon.git
python -m venv venv
source ./venv/bin/activate

Install dependencies from pyproject.toml

pip install pyproject.toml
poetry install

Usage

Make sure you got a csv file in this format for the agent to read in.

<!-- file.csv -->
host,port
google.com,443
google.com,8000
apple.com,8080
apple.com,443
apple.com,9000

To monitor a list of hosts and ports from a CSV file.

sitemon file.csv

To specify what time you would like to stop monitoring.

sitemon file.csv --time 19:00:00

To specify the time interval between each ping in seconds.

sitemon file --interval 2

Optional help menu

usage: sitemon [-h] [-t TIME] [-i INTERVAL] [-r] [-e EXTENSION] [host ...]

Supply a list of host and ports to monitor in csv format.

positional arguments:
  host                  Supply a list of host and ports to monitor in csv format. (default: <_io.TextIOWrapper
                        name='<stdin>' mode='r' encoding='utf-8'>)

options:
  -h, --help            show this help message and exit
  -t TIME, --time TIME  Time to stop monitoring. Please enter the time in HH:MM:SS format. Default="19:00:00"
                        (default: None)
  -i INTERVAL, --interval INTERVAL
                        Option to put time interval in seconds. Usage: sitemon google.com:443 -i 1 (default: 1.5)
  -r, --recursive       Search through subfolders (default: True)
  -e EXTENSION, --extension EXTENSION
                        File extension to filter by. (default: )

About

An agent to monitor the uptime of multiple sites and response time without any external libraries.

License:MIT License


Languages

Language:Python 100.0%