Endpoints Exporter is a tool designed to collect and export endpoint availability and response time metrics. It can be used to monitor the health and performance of various services and APIs.
- Monitor multiple endpoints concurrently
- Record response time and HTTP status codes
- Export metrics in a format compatible with Prometheus
-
Clone the repository:
git clone https://github.com/Abhishek1121-tech/endpoints_exporter.git cd endpoints_exporter
-
Create Configuration: Edit the endpoints.yaml file to define the endpoints you want to monitor: Add your section in the endpoints_exporter_config.ini file. Prefix with Endpoint_ will be considered for health check.
[Global] sleep_time = 300 port = 8000 [Endpoint_Example] url = https://example.com name = Example Website timeout = 10 follow_redirects = false max_redirects = 5 [EndpointTest] url = http://fakeurl.com name = Test Endpoint timeout = 10 follow_redirects = true max_redirects = 5
-
Build the Docker Image: Build the Docker image using the provided Dockerfile:
docker build -t endpoints-monitor:0.0.1 .
-
Run the Docker Container: Run the Docker container based on the image you just built:
docker run -p 8000:8000 endpoints-monitor:0.0.1 python endpoints_monitor.py --config /app/endpoints_exporter_config.ini
-
Access Prometheus Metrics: The Prometheus metrics server is now running inside the Docker container. Access the metrics at http://localhost:8000/metrics in your web browser. These metrics can be scraped by Prometheus for monitoring and analysis.
-
Metric currnetly exposed by exporter
service_live_metric = Gauge('endpoint_service_live_status', 'Response code of the URL endpoint', ['url', 'name']) response_time_metric = Gauge('endpoint_response_time_seconds', 'Response time of the URL endpoint', ['url', 'name']) status_code_metric = Gauge('endpoint_status_code', 'HTTP Status code of the URL endpoint', ['url', 'name'])
Modify endpoints.yaml to add or remove endpoints for monitoring.
Adjust the Dockerfile or application code according to your requirements.
Contributing
Contributions are welcome! If you find a bug or have an enhancement in mind, please open an issue or submit a pull request.
This project is licensed under the MIT License.