Member-only story

prometheus

vahid_jani
2 min readJan 28, 2025

First Install Prometheus:

https://www.cherryservers.com/blog/install-prometheus-ubuntu

Second change the config: (if using docker change localhost to the machine Ip)- Prometheus needs to scrape the /metrics endpoint from your Flask app.

scrape_configs:
- job_name: 'flask_app'
static_configs:
- targets: ['localhost:5000'] # Replace with your Flask app's address

third, reload systemd and check status:

sudo systemctl daemon-reload
sudo systemctl enable prometheus
sudo systemctl start prometheus
sudo systemctl status prometheus

restart it if you did changes to config ,later:

sudo systemctl restart prometheus

You can access or check some graphs using only web UI:

http://localhost:9090

Optional: Monitor Redis and PostgreSQL

Monitor Redis with Prometheus

  1. Install Redis Exporter:
docker run -d --name=redis_exporter -p 9121:9121 oliver006/redis_exporter

Configure Prometheus: Add Redis exporter as a scrape target:

scrape_configs:
- job_name: 'redis'
static_configs:
- targets: ['localhost:9121']

--

--

vahid_jani
vahid_jani

No responses yet

Write a response