https://github.com/dingus-technology/infrastructure-simulation
Run simulations for collecting data in Prometheus and Loki to explore in Grafana
https://github.com/dingus-technology/infrastructure-simulation
debugging devops grafana logs loki metrics prometheus
Last synced: about 1 year ago
JSON representation
Run simulations for collecting data in Prometheus and Loki to explore in Grafana
- Host: GitHub
- URL: https://github.com/dingus-technology/infrastructure-simulation
- Owner: dingus-technology
- License: mit
- Created: 2025-02-11T14:55:40.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-27T17:40:48.000Z (about 1 year ago)
- Last Synced: 2025-02-28T01:08:42.499Z (about 1 year ago)
- Topics: debugging, devops, grafana, logs, loki, metrics, prometheus
- Language: Python
- Homepage: https://www.dingusai.dev
- Size: 489 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# 🐕 Monitoring Simulation Data with Loki, Prometheus & Grafana
## 🚀 Overview
This guide explains how to set up **Loki**, **Prometheus**, and **Grafana** using Docker Compose to monitor CPU load data from a Python application locally.
🔹 **Prometheus** - Scrapes metrics from the app
🔹 **Loki** - Collects & indexes logs
🔹 **Grafana** - Visualizes the data
---
## 📌 Prerequisites
Ensure you have the following installed:
- [Docker & Docker Compose](https://docs.docker.com/get-docker/)
- [Colima](https://github.com/abiosoft/colima) (for Mac users)
---
## 🚀 Start the Monitoring Stack
Run the following command to build and start the services:
```bash
docker compose up --build
```
---
## 🔍 Verify Prometheus Scraping Data
1. Open **Prometheus UI** → [http://localhost:9090](http://localhost:9090)
2. Navigate to **"Status" > "Targets"** to check if `sanitised-data` is `UP`
3. Run a query in PromQL:
```promql
cpu_load
```
You should see CPU load data in real-time!
---
## 📊 Connect Grafana to Prometheus
1. Open **Grafana UI** → [http://localhost:3000](http://localhost:3000)
2. **Login** with:
- Username: `admin`
- Password: `admin`
3. Navigate to **"Configuration" > "Data Sources"**
4. Click **"Add Data Source"** and select **Prometheus**
5. Set the **URL**:
```
http://host.docker.internal:9090
```
6. Click **"Save & Test"** 🎯
---
## 📈 Create a Grafana Dashboard
1. Go to **"Create" > "Dashboard"**
2. Click **"Add a new panel"**
3. In the **Metrics** section, enter:
```promql
cpu_load
```
4. Click **"Run query"** to visualize CPU load
5. Customize the graph, then click **"Save"** ✅
---
## 📜 Configure Loki for Log Monitoring
1. Navigate to **"Logs"** in Grafana
2. Select **"Loki"** as the **"Data Source"**
3. Run a log query to filter logs:
```logql
{app="sanitised-data"}
```
---
## 🎉 Done!
Your **sanitised-data service** is now fully monitored with **Prometheus, Loki & Grafana**! 🚀
✅ **Metrics →** Tracked via **Prometheus**
✅ **Logs →** Indexed with **Loki**
✅ **Visualization →** Displayed in **Grafana**
---