🚥 Fast website monitoring backend service
Features
🍀 Feature-rich
- Each check tracks:
- timestamp
- response time
- HTTP response status code
- optionally, given regex is (safely) tested if it matches the response body or not
- info about possible connection errors, like timeouts and/or unreachable host
- Websites to check & their results are stored in postgres by default 🐘 (the library is ready for other data stores / sockets).
- You can use postgres locally installed, running on docker, or with a DBaaS, e.g. Aiven.
- Monitor stored websites once, at configurable-scheduled intervals (each website check can use an independent interval or use a default), or even with your system's cron.
- The scheduling keeps running even if the computer goes to sleep.
- Nice, configurable logging.
- CLI API & Python's (Python >= 3.11).
- A webserver is planned.
- ...and more!
🚀 Speed
- All operations are asynchronous. This app sits on 3 giants:
- aiohttp
- psycopg (v3)
- APScheduler (v4)
- Written in Python 3.11 for maximum speed 🐍
- Speedy regex checking thanks to google-re2 regex. Note that google-re2 syntax is very similar to python's native
rebut not equal. In particular, backreferences are not supported, to gain on speed and safety. - No ORM libraries. Just good old (safely-escaped) SQL queries.
🧘 Safety
- Binary or too big responses will not be read.
- Safe regex thanks to google-re2 regex.
- Safe escaping of SQL queries with psycopg.
- Security static analysis with bandit, snyk, and GitHub CodeQL.
- Code is fully type-annotated and type-checked with mypy.
- Further type checking with Pydantic (v2).
- Further static analysis with pyflakes.
Install
Via pip
# You need to run this with a Python 3.11 environment -- You can manage different python versions for instance with `pyenv`
pip install -U fastchecks
or via source
You need to have python poetry installed. Then:
# clone this repository
_reponame="fastchecks";
_branch="main";
git clone -b "${_branch}" "https://github.com/juanmirocks/${_reponame}";
cd ${_reponame}
# Install project
poetry install
# Enter into the project's shell environment for simplicity with the running commands
poetry shell
Run
-
Create a postgres DB and take note of its postgres URL conninfo. NOTE: this app was tested with Postgres v15 only; some older versions should work too.
- For instance, if you have a local postgres installation:
_dbname="fastchecks"; createdb "${_dbname}" # Its postgres URL (assuming default user) will be: # postgres://localhost/fastchecks # Then you need to pass the conninfo to the CLI, # * either with the explicit optional parameter `--pg_conninfo`, or # * by setting the envar: `FC_POSTGRES_CONNINFO` # For simplicity, commands below assume you've set `FC_POSTGRES_CONNINFO`, e.g.: export FC_POSTGRES_CONNINFO='postgres://localhost/fastchecks'
-
Add some website URLs to later check for:
fastchecks upsert_check 'https://example.org' # Add a simple URL check fastchecks upsert_check 'https://example.org' --regex 'Example D[a-z]+' # Update the URL check to match the response body with a regex fastchecks upsert_check 'https://python.org' --interval 5 # Add another URL check with a specific interval (in seconds)
-
Run the checks at the scheduled intervals in the foreground until stopped.
fastchecks check_all_loop_fg # checks without interval will run with a default (configurable; see command help)
-
That's it! You might want to explore further options:
- For all possibilities, run:
fastchecks -h - For instance, might you want to run all checks only once (e.g. to schedule with cron), run:
fastchecks check_all_once - Or run a single website check once (without registering it):
fastchecks check_website 'https://www.postgresql.org/'
- For all possibilities, run:
Copyright / License
Copyright 2023 Dr. Juan Miguel Cejuela
SPDX-License-Identifier: Apache-2.0
Metadata
Release files for fastchecks 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fastchecks-0.2.2.tar.gz | 25.3 kB | Without provenance | Details for fastchecks-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fastchecks-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for fastchecks-0.2.2-py3-none-any.whl |
Total release size: 53.6 kB
Release files / fastchecks-0.2.2.tar.gz
| Download URL | fastchecks-0.2.2.tar.gz |
|---|---|
| Size | 25.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6013b25de2557aa60953acff42e53d7de869a8ef0fce02dcb3e4ade6e394fa1a
|
|
BLAKE2b-256 checksum How to use checksums |
3d29c3b6e8c61f1f5505e9346bc240961bf5c6c06fbff7d4849a96d6de2844cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.11 Darwin/22.5.0
|
Release files / fastchecks-0.2.2-py3-none-any.whl
| Download URL | fastchecks-0.2.2-py3-none-any.whl |
|---|---|
| Size | 28.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e917ba56fea81392fdba5fbaa65df44a72286d455e4722416ff142aacd7b0994
|
|
BLAKE2b-256 checksum How to use checksums |
afd5c9a4ec3caf7477f196418a8f0a23bc6e5500ea0793a94737778725c9f34c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.11 Darwin/22.5.0
|
Security for fastchecks 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.