# vegasbrianc/prometheus architecture

> Architecture diagram of the GitHub repository vegasbrianc/prometheus, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vegasbrianc/prometheus
- Repository: https://github.com/vegasbrianc/prometheus

## Overview

##### Project Type and Purpose
- This is an infrastructure monitoring “stack” built with Docker and Docker Swarm. It assembles Prometheus, Grafana, Alertmanager, and exporters (cAdvisor, node-exporter) into a turnkey, containerized monitoring platform.

##### File Structure Analysis
- Top-level orchestrator files:
- docker-compose.yml, docker-stack.yml, docker-traefik-stack.yml, pwd-stack.yml – define and deploy the stack in standalone Docker or Swarm (with or without Traefik).
- docker-prometheus.dockerapp/docker-compose.yml – Packaged for Play-With-Docker.
- alertmanager/ – Alertmanager configuration (Slack webhook).
- prometheus/ – prometheus.yml and alert.rules.
- grafana/ – provisioning (datasources, dashboards) and environment file (config.monitoring).
- dashboards/ and images/ – JSON dashboard definitions and screenshots.
- .github/, CONTRIBUTING.md, etc. – CI/workflow and community docs.

##### Key README Insights
- Stack components are deployed as Docker Swarm services.
- Prometheus scrapes cAdvisor and node-exporter (Global mode).
- Grafana is pre-provisioned with datasources and dashboards.
- Alertmanager forwards alerts to Slack.
- Optional Traefik reverse-proxy layer for routing/SSL.

##### Detail Level
- Service replica modes: Global for exporters; 1/1 for Prometheus, Grafana, Alertmanager.
- Ports (e.g., 9090 for Prometheus, 3000 for Grafana, 9093 for Alertmanager).
- Config volumes mapping (prometheus.yml, alert.rules, config.monitoring, provisioning directories).
- Slack Webhook URL in Alertmanager config.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Infrastructure"
        Swarm["Docker Swarm Orchestrator"]:::infra
    end

    subgraph "Reverse Proxy (Optional)"
        Traefik["Traefik"]:::proxy
    end

    subgraph "Monitoring Agents (Global Mode)"
        cAdvisor["cAdvisor"]:::collector
        NodeExporter["node-exporter"]:::collector
    end

    subgraph "Core Processing"
        Prometheus["Prometheus\n(port: 9090)"]:::core
    end

    subgraph "Alerting"
        Alertmanager["Alertmanager\n(port: 9093)"]:::alert
    end

    subgraph "Visualization"
        Grafana["Grafana\n(port: 3000)"]:::viz
        subgraph "Grafana Provisioning"
            GF_Config["config.monitoring"]:::config
            GF_DS["datasource.yml"]:::config
            GF_DB["dashboard.yml"]:::config
            GF_JSON["Docker Prometheus Monitoring JSON"]:::config
        end
    end

    subgraph "Prometheus Config"
        PROM_YML["prometheus.yml"]:::config
        PROM_RULES["alert.rules"]:::config
    end

    subgraph "Alertmanager Config"
        AM_Config["config.yml"]:::config
    end

    subgraph "Dashboards Repository"
        Dash1["Grafana_Dashboard.json"]:::config
        Dash2["Grafana_Dashboard_prom_2.json"]:::config
        Dash3["System_Monitoring.json"]:::config
    end

    Slack["Slack Incoming Webhook"]:::external

    %% Connections
    Swarm --> cAdvisor
    Swarm --> NodeExporter
    cAdvisor -->|scrape metrics| Prometheus
    NodeExporter -->|scrape metrics| Prometheus
    Traefik -->|fronts| Grafana
    Traefik -->|fronts| Prometheus
    Traefik -->|fronts| Alertmanager
    Prometheus -->|alerts| Alertmanager
    Prometheus -->|queries| Grafana
    Prometheus -->|scrape metrics| Traefik
    Alertmanager -->|notifications| Slack

    %% Config mounts
    PROM_YML -- mounts --> Prometheus
    PROM_RULES -- mounts --> Prometheus
    AM_Config -- mounts --> Alertmanager
    GF_Config -- mounts --> Grafana
    GF_DS -- mounts --> Grafana
    GF_DB -- mounts --> Grafana
    GF_JSON -- mounts --> Grafana
    Dash1 -- repository --> Grafana
    Dash2 -- repository --> Grafana
    Dash3 -- repository --> Grafana

    %% Click Events
    click Swarm "https://github.com/vegasbrianc/prometheus/blob/master/docker-compose.yml"
    click Swarm "https://github.com/vegasbrianc/prometheus/blob/master/docker-stack.yml"
    click Swarm "https://github.com/vegasbrianc/prometheus/blob/master/docker-traefik-stack.yml"
    click Swarm "https://github.com/vegasbrianc/prometheus/blob/master/pwd-stack.yml"
    click Swarm "https://github.com/vegasbrianc/prometheus/blob/master/docker-prometheus.dockerapp/docker-compose.yml"
    click PROM_YML "https://github.com/vegasbrianc/prometheus/blob/master/prometheus/prometheus.yml"
    click PROM_RULES "https://github.com/vegasbrianc/prometheus/blob/master/prometheus/alert.rules"
    click AM_Config "https://github.com/vegasbrianc/prometheus/blob/master/alertmanager/config.yml"
    click GF_Config "https://github.com/vegasbrianc/prometheus/blob/master/grafana/config.monitoring"
    click GF_DS "https://github.com/vegasbrianc/prometheus/blob/master/grafana/provisioning/datasources/datasource.yml"
    click GF_DB "https://github.com/vegasbrianc/prometheus/blob/master/grafana/provisioning/dashboards/dashboard.yml"
    click GF_JSON "https://github.com/vegasbrianc/prometheus/blob/master/grafana/provisioning/dashboards/Docker Prometheus Monitoring-1571332751387.json"
    click Dash1 "https://github.com/vegasbrianc/prometheus/blob/master/dashboards/Grafana_Dashboard.json"
    click Dash2 "https://github.com/vegasbrianc/prometheus/blob/master/dashboards/Grafana_Dashboard_prom_2.json"
    click Dash3 "https://github.com/vegasbrianc/prometheus/blob/master/dashboards/System_Monitoring.json"

    %% Styles
    classDef collector fill:#9f6,stroke:#333,stroke-width:1px;
    classDef core fill:#6cf,stroke:#333,stroke-width:1px;
    classDef alert fill:#f93,stroke:#333,stroke-width:1px;
    classDef viz fill:#c9f,stroke:#333,stroke-width:1px;
    classDef infra fill:#ccc,stroke:#333,stroke-width:1px;
    classDef proxy fill:#2ab,stroke:#333,stroke-width:1px;
    classDef external fill:#ddd,stroke:#333,stroke-width:1px;
    classDef config fill:none,stroke:#555,stroke-dasharray: 5 5,stroke-width:1px;
```
