Skip to content

About

Run simulations for collecting data in Prometheus and Loki to explore in Grafana

Topics

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

🐕 K8 Monitoring Simulation Data with Loki, Prometheus & Grafana

Grafana UI

🚀 Overview

This guide explains how to set up Loki, Prometheus, and Grafana using Kubernetes 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:

If Mac user run the following script to install the tools:

brew install colima
colima start
brew install kind
brew install kubectl

🚀 Start the Monitoring Stack

With Docker Compose or kind

Run the following command to build and start the services:

For non-K8 deployment:

docker compose up --build

or

For K8 deployment:

bash kind-setup.sh

📊 Connect Grafana to Prometheus

  1. Open Grafana UI → 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://prometheus: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:

    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. Set the URL:

    http://loki:3100
    
  4. Run a log query to filter logs:

    {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


About

Run simulations for collecting data in Prometheus and Loki to explore in Grafana

Topics

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages