Simple python service to poll a given host and path, record results in a sqlite database, serve an endpoint with flask and process results with plotly
- Docker
- Developed with python poetry, plotly, flask, sqlalchemy, pre-commit and local hooks
- make
- pip
make deps
./src/hostpoller/poller.py --help
usage: poller.py [-h] [--target TARGET] [--monitor-period MONITOR_PERIOD] [--polling-frequency POLLING_FREQUENCY] [--request-timeout REQUEST_TIMEOUT] [--listen-ip LISTEN_IP] [--listen-port LISTEN_PORT] [--sql-engine SQL_ENGINE] [--sql-db-path SQL_DB_PATH]
Monitor host and store results.
options:
-h, --help show this help message and exit
--target TARGET Host or ip to target and path, default: https://127.0.0.1/
--monitor-period MONITOR_PERIOD
Time in seconds to monitor host, 0 will run forever default: 10
--polling-frequency POLLING_FREQUENCY
Time in seconds to poll given host over specified period, default: 1
--request-timeout REQUEST_TIMEOUT
Timeout for requests to target, default: 10
--listen-ip LISTEN_IP
Web listener binding ip, default: 127.0.0.1
--listen-port LISTEN_PORT
Web listener binding port, default: 9000
--sql-engine SQL_ENGINE
SQL Engine, default: sqlite
--sql-db-path SQL_DB_PATH
SQL Engine, default: hostpoller.db
Example: Query https://www.github.com/
./src/hostpoller/poller.py --target https://www.github.com/ --polling-frequency .5 --request-timeout 5
Build and run container all in one
make build run TARGET=https://www.github.com/
Run existing container
make run TARGET=https://www.github.com/