# yussf101/monitoring-stack-with-grafana architecture

> Architecture diagram of the GitHub repository yussf101/monitoring-stack-with-grafana, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yussf101/monitoring-stack-with-grafana
- Repository: https://github.com/yussf101/monitoring-stack-with-grafana

## Overview

##### Project type and purpose
- This is a Docker-based monitoring stack for Linux servers. It’s not a traditional “web app,” but an infrastructure/monitoring platform.
- The stack comprises three main services:
- Node Exporter running on each client VM to expose system metrics.
- Prometheus running in Docker on a central monitoring server to scrape and store those metrics.

##### File structure
- Top level:
- docker-compose.yml – orchestrates Grafana, Prometheus (and optionally a provisioned datasource).
- generate-prometheus-config.sh + vm_list.txt – a script + input file to dynamically produce prometheus.yml from the template.
- prometheus/
- prometheus.template.yml – contains a placeholder for `${VM_LIST}` that the script replaces with the contents of vm_list.txt.
- prometheus.yml – the generated config listing all node_exporter targets.
- grafana/
- grafana.ini – Grafana’s core settings (ports, auth).
- provisioning/datasources – auto-provisions Prometheus as a data source.
- provisioning/dashboards – three JSON dashboards (minimal, main, advanced).
- provisioning/variables – defines dashboard variables (e.g. instance dropdown).

##### README for additional insights
- The README confirms the data flow: Node Exporter → Prometheus → Grafana.
- It describes how to add new VMs: edit vm_list.txt, re-run the script, restart Prometheus.
- It highlights that advanced dashboards require Node Exporter run as a systemd service with extra collectors.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Client VMs"
        direction TB
        NodeExporter["Node Exporter (9100)"]:::vm
    end

    subgraph "Monitoring Server"
        direction TB
        dockerCompose["Docker Compose"]:::script
        vmList["VM List"]:::doc
        script["generate-prometheus-config.sh"]:::script
        template["prometheus.template.yml"]:::doc
        genConfig["prometheus.yml"]:::doc

        subgraph "Docker Containers"
            direction TB
            prometheus["Prometheus (9090)"]:::container
            tsdb["Prometheus TSDB"]:::db
            grafana["Grafana (3000)"]:::container
            grafConfig["grafana.ini"]:::doc

            subgraph "Grafana Provisioning"
                direction TB
                ds["prometheus-datasource.yml"]:::doc
                dashCfg["dashboard.yml"]:::doc
                vars["variables.yml"]:::doc
                minDash["Minimal-Dashboard.json"]:::doc
                mainDash["Main-Dashboard.json"]:::doc
                advDash["Advanced-Dashboard.json"]:::doc
            end
        end
    end

    NodeExporter -->|"scrape metrics"| prometheus
    prometheus -->|"store metrics"| tsdb
    prometheus -->|"HTTP API"| grafana
    vmList --> script
    template --> script
    script --> genConfig
    genConfig -->|"update config"| prometheus
    dockerCompose --> prometheus
    dockerCompose --> grafana
    dockerCompose --> script

    click dockerCompose "https://github.com/yussf101/monitoring-stack-with-grafana/blob/main/docker-compose.yml"
    click script "https://github.com/yussf101/monitoring-stack-with-grafana/blob/main/generate-prometheus-config.sh"
    click vmList "https://github.com/yussf101/monitoring-stack-with-grafana/blob/main/vm_list.txt"
    click template "https://github.com/yussf101/monitoring-stack-with-grafana/blob/main/prometheus/prometheus.template.yml"
    click genConfig "https://github.com/yussf101/monitoring-stack-with-grafana/blob/main/prometheus/prometheus.yml"
    click grafConfig "https://github.com/yussf101/monitoring-stack-with-grafana/blob/main/grafana/grafana.ini"
    click ds "https://github.com/yussf101/monitoring-stack-with-grafana/blob/main/grafana/provisioning/datasources/prometheus-datasource.yml"
    click dashCfg "https://github.com/yussf101/monitoring-stack-with-grafana/blob/main/grafana/provisioning/dashboards/dashboard.yml"
    click minDash "https://github.com/yussf101/monitoring-stack-with-grafana/blob/main/grafana/provisioning/dashboards/Minimal-Dashboard.json"
    click mainDash "https://github.com/yussf101/monitoring-stack-with-grafana/blob/main/grafana/provisioning/dashboards/Main-Dashboard.json"
    click advDash "https://github.com/yussf101/monitoring-stack-with-grafana/blob/main/grafana/provisioning/dashboards/Advanced-Dashboard.json"
    click vars "https://github.com/yussf101/monitoring-stack-with-grafana/blob/main/grafana/provisioning/variables/variables.yml"

    classDef container fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef db fill:#90EE90,stroke:#000,stroke-width:1px
    classDef vm fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef doc fill:#FFFACD,stroke:#000,stroke-width:1px
    classDef script fill:#FFD700,stroke:#000,stroke-width:1px
```
