This program checks the health of a set of HTTP endpoints at regular intervals and calculates the availability percentage for each domain.
- Python 3.x
requests
library (pip install requests
)PyYAML
library (pip install pyyaml
)
-
Create a YAML configuration file with a list of HTTP endpoints to monitor. Each endpoint should include the following information:
name
: A name to describe the HTTP endpoint.url
: The URL of the HTTP endpoint.method
(optional): The HTTP method of the endpoint (default is GET).headers
(optional): The HTTP headers to include in the request.body
(optional): The HTTP body to include in the request. See the provided "sample_config.yaml" file for an example.
-
Run the program by executing the following command: python healthchecker.py
-
The program will start checking the health of the endpoints every 15 seconds. It will log the availability percentage for each domain after each cycle.
-
Press CTRL+C to stop the program.