The main objective of this project is to create a simple Python service example that contains Prometheus which is a standalone open source project that monitors and alerts systems and Grafana.
- Docker
- Prometheus
- Grafana
You will need Docker installed to follow the next steps and build an run the image locally you just need to use the following command:
docker-compose up --build
At first, make some reqeust several times using the following link http://localhost:5000
, then you be able to see changes in the metrics http://localhost:5000/metrics
.
After that, you can navigate to grafana's Dashboard via the link http//localhost:3000
and upload the datasource and dashboard configuration using the JSO files. Or you can use Grafana's Dashboard API to create a new dashboard and datasource using the following requests:
- Enable datasource: POST http://localhost:3000/api/dashboards/db Body
{
"name": "prometheus",
"type": "prometheus",
"url": "http://localhost:9090",
"access": "browser",
"isDefault": true
}
- Create Dashboard: POST http://localhost:3000/api/datasources
For more informations you can access the Grafana Dashboard API
After all these actions, you should be able to access the Grafana Dashboard that display some graphs and metrics related to the Flask Web Application that was created.
You can read more on: