To execute this repository in a Linux environment, follow these steps:
git clone <REPOSITORY_URL>
cd <REPOSITORY_NAME>
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
ln -s temperaturas.service /home/systemd/system/temperaturas.service
sudo systemctl enable temperaturas.service
sudo systemctl start temperaturas.service
To ensure that our temperature service is collected by Prometheus, we need to make some adjustments to the Prometheus configuration file, named "prometheus.yml". Below is how to add the necessary configuration:
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
- job_name: "temperatures"
static_configs:
- targets: ["127.0.0.1:9897"]
Grafana is a data visualization platform that integrates with Prometheus. It provides a graphical interface to explore and visualize the data collected by Prometheus.
In the temperaturas.yml
configuration file, you will find different sections that allow you to customize data collection and visualization:
Temperature:
- City: Madrid
Country: es
- City: Paris
Country: fr
Web:
Period: 20
Host: 127.0.0.1
Port: 9897
WRoute: /metrics
APIKey: aaaaaaaaaaaaaaaa0000000000000000
Logging:
File_name: 'app.log'
Max_size: 11000000
Backup_count: 3
The data collection service retrieves information from the OpenWeather API for the cities specified in the configuration. The data is stored in log files located in the storage/logger/
folder.
OpenWeather is an online service that provides real-time weather data and forecasts globally. Through its API, developers can access a wide range of weather information.
Code: https://github.com/JavierAM01/Getting-Started-with-Prometheus-and-Grafana/
¿Tienes alguna pregunta? Estoy aquí para ayudarte. Envíame un mensaje y nos pondremos en contacto contigo lo antes posible.