Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/itzkvn/python-http-monitoring
HTTP(s) "monitoring" webpage via FastAPI+Jinja2. Inspired by https://github.com/RaymiiOrg/bash-http-monitoring
https://github.com/itzkvn/python-http-monitoring
Last synced: 10 days ago
JSON representation
HTTP(s) "monitoring" webpage via FastAPI+Jinja2. Inspired by https://github.com/RaymiiOrg/bash-http-monitoring
- Host: GitHub
- URL: https://github.com/itzkvn/python-http-monitoring
- Owner: itzkvn
- License: mit
- Created: 2021-01-02T21:50:43.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-08T03:58:18.000Z (almost 4 years ago)
- Last Synced: 2024-08-01T12:25:37.014Z (3 months ago)
- Language: Python
- Size: 351 KB
- Stars: 41
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# python-http-monitoring
![](./docs/dashboard_example.png)
HTTP(s) "monitoring" powered by FastAPI+Jinja2+aiohttp.
Inspired by [bash-http-monitoring](https://github.com/RaymiiOrg/bash-http-monitoring).
Installation can be done with pipenv or Docker.
Targets can be changed on runtime since they are read in each request (if you're running on Docker just mount the file as a volume).
Request customization is also possible (retries per request, time between retries, etc.).Targets will be flagged as "down" if they take longer than the timeout or the expected http status code is different than the one expected.
TODO (No ETA...):
```
Notifications
Historic metrics
Support other HTTP methods
```## Installation
Minimum requirements to run locally:
- \>Python 3.7
- [pipenv](https://pypi.org/project/pipenv/)Otherwise, if you want to run it in a container:
- DockerLocally:
```bash
git clone https://github.com/itzkvn/python-http-monitoring.git
cd python-http-monitoring
pipenv shell
pipenv install
cd app
uvicorn main:app --port 18080
```Docker:
If you want to try it out:
```bash
docker run -it --rm -p 18080:80 kollowz/python-http-monitoring
```If you want to mount a configuration file:
```bash
docker run -it --rm -p 18080:80 -v "/path/to/targets.yml:/app/targets.yml" kollowz/python-http-monitoring
```Either way you access the website at 127.0.0.1:18080/target/status.
## Configuration
Configuration for this proyect consists in two files:
```app/targets.yml``` and ```app/settings.py```
targets.yml: targets to check
Each target consists of:
- display: Display name in the website (Maybe you want to see "My website" instead of "http://yourwebsite.com").
- url: URL to check (ex: "https://www.google.com").
- expected_http_code: Status code that will be validated against response status code (this is, mostly, what makes a check go either green or red).settings.py: "backend" configuration
- TARGETS_FILE: Configuration file for targets.
- REQUEST_RETRIES: # of retries per url (only retries if it fails).
- REQUEST_RETRIES_WAIT: # of seconds between retries.
- REQUEST_TIMEOUT: # of seconds till timeout per request.
- REQUEST_HTTP_CODE: Default expected HTTP status code.## Screenshots
__Error view__
![](./docs/dashboard_with_errors.png)__Big target list__
![](./docs/dashboard_tons_of_targets.png)## ¿Why did I make this?
Saw [bash-http-monitoring](https://github.com/RaymiiOrg/bash-http-monitoring) on [r/selfhosted](https://www.reddit.com/r/selfhosted/comments/klao26/bash_http_monitoring_dashboard/) and had a weekend free to hack on something. Thought this was a fun enough challenge so here it is :)