mirror of
https://github.com/TerrifiedBug/komodo-stacks.git
synced 2026-11-11 19:09:28 +01:00
Repository: admin/monitoring-stack Timestamp: 2025-04-19_22-18-01 Target directory: projects/monitoring-stack
3.4 KiB
3.4 KiB
Prometheus-Grafana Monitoring Stack
This repository contains a Docker Compose setup for a complete monitoring solution using Prometheus and Grafana, with additional exporters for system and container metrics, and Loki/Promtail for log aggregation and analysis.
Components
- Prometheus: Time series database and monitoring system
- Grafana: Visualization and dashboarding tool
- Loki: Log aggregation system that integrates with Grafana
- Promtail: Log shipper for Loki (collects system and container logs)
- Node Exporter: Collects hardware and OS metrics from the host
- cAdvisor: Collects container metrics
- CPU Temperature Exporter: Custom exporter for CPU temperature metrics
Directory Structure
prometheus-grafana/
├── cpu-temp-prometheus-exporter/ # Custom exporter for CPU temperature
│ └── main.js # Node.js script that exposes CPU temp metrics
├── prometheus/ # Prometheus configuration
│ └── prometheus.yml # Main Prometheus configuration file
├── promtail/ # Promtail configuration
│ └── config.yml # Main Promtail configuration file
├── grafana/ # Promtail configuration
│ └── provisioning # Main Promtail configuration file
│ └── datasources
│ └── loki.yml # Provision Loki datasource on Grafana
└── docker-compose.yml # Docker Compose configuration file
Setup Instructions
- Clone this repository
- (Optional) Modify
prometheus/prometheus.ymlto adjust scrape targets - Update the CPU temperature exporter target IP in
prometheus.ymlif needed - Deploy the stack:
docker-compose up -d
CPU Temperature Exporter
The CPU temperature exporter is a simple Node.js script that exposes the highest CPU core temperature. This script should be run directly on the host machine (not in a container) using:
/usr/bin/js cpu-temp-prometheus-exporter/main.js
It exposes metrics on port 8084, which Prometheus is configured to scrape.
Log Aggregation with Loki & Promtail
Promtail is configured to:
- Collect logs from
/var/log/syslog - Collect container logs from
/var/lib/docker/containers - Send them to the Loki service
Loki is exposed on port 3100 and integrates with Grafana for log visualization.
Recommended Dashboards
Import these dashboards into Grafana for comprehensive monitoring:
- Node Exporter Full
- cAdvisor Exporter
- System & Docker Logs (included logs-dashboard.json JSON file in this repo)
Dashboard Import Instructions
- In Grafana, go to Dashboards > Import
- Enter the dashboard ID (1860 for Node Exporter Full, 14282 for cAdvisor)
- Upload the included JSON dashboard for logs
- Select your Prometheus or Loki data source
- Click Import
Default Ports
- Prometheus: 9090
- Grafana: 3000
- Loki: 3100
- Node Exporter: 9100
- cAdvisor: 8080
- CPU Temperature Exporter: 8084
Notes
- Grafana's default login is admin/admin
- CPU temperature metrics will appear as
server_cpu_tempin Prometheus - Make sure the host running the CPU temperature exporter has the
sensorscommand available