# ducanhnguyen07/prometheus-dcgm architecture

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

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

## Overview

##### Project Type and Purpose
- This is an infrastructure-as-code repository for deploying a containerized monitoring stack using Docker Compose.
- The goal is to collect metrics from various services (database, GitLab, host), store and evaluate them in Prometheus, and trigger alerts via Alertmanager.

##### File Structure Analysis
- Top level:
- README.md (project overview – currently empty)
- docker/ (Docker Compose orchestration)
- img/ (custom container images, if any)
- node_exporter/ (systemd service files for exporters)
- prometheus/ (Prometheus configuration: scrape targets, rules, alerts)
- docker/docker-compose.yml defines services: Prometheus server, Alertmanager, Node exporters, and any custom images under img/.
- node_exporter/*.service are systemd unit files for running exporters outside of Docker (optional alternative deployment).
- prometheus/*.yml and targets.json configure scrape jobs, alerting rules, and alertmanager integration.

##### Detailed Capture
- Don’t oversimplify: represent each exporter as its own component.
- How prometheus.yml, rules.yml, targets.json feed into the Prometheus container.

## Diagram (Mermaid)

```mermaid
flowchart TD
    classDef core fill:#ADD8E6,stroke:#000,color:#000
    classDef exporter fill:#90EE90,stroke:#000
    classDef external fill:#D3D3D3,stroke:#000
    classDef network fill:#FFF,stroke:#000,stroke-dasharray: 5 5
    classDef note fill:#FFFACD,stroke:#000

    README["README.md"]:::external
    DB["External Database"]:::external
    GITLAB["External GitLab"]:::external
    HOST_EXT["Host OS"]:::external

    subgraph "Docker Host / VM"
        direction TB
        subgraph "Docker Network: monitoring_net"
            direction TB
            HOST_EXP["node_exporter (Host)"]:::exporter
            DB_EXP["database_node_exporter"]:::exporter
            GITLAB_EXP["gitlab_node_exporter"]:::exporter
            IMG["Custom Container Images"]:::exporter
            PROM["Prometheus Server"]:::core
            AM["Alertmanager"]:::core
            COMPOSE["Docker Compose Orchestration"]:::note
        end
    end

    YML["prometheus.yml"]:::note
    RULES["rules.yml"]:::note
    TARGETS["targets.json"]:::note
    AMCONF["alertmanager.yml"]:::note

    HOST_EXT -->|scrape| HOST_EXP
    DB -->|scrape| DB_EXP
    GITLAB -->|scrape| GITLAB_EXP

    HOST_EXP -->|"scrape (30s)"| PROM
    DB_EXP -->|"scrape (30s)"| PROM
    GITLAB_EXP -->|"scrape (30s)"| PROM

    PROM -->|"alerts"| AM

    YML --> PROM
    RULES --> PROM
    TARGETS --> PROM
    AMCONF --> AM

    README --> COMPOSE

    click COMPOSE "https://github.com/ducanhnguyen07/prometheus-dcgm/blob/main/docker/docker-compose.yml"
    click IMG "https://github.com/ducanhnguyen07/prometheus-dcgm/tree/main/img/"
    click HOST_EXP "https://github.com/ducanhnguyen07/prometheus-dcgm/blob/main/node_exporter/node_exporter.service"
    click DB_EXP "https://github.com/ducanhnguyen07/prometheus-dcgm/blob/main/node_exporter/database_node_exporter.service"
    click GITLAB_EXP "https://github.com/ducanhnguyen07/prometheus-dcgm/blob/main/node_exporter/gitlab_node_exporter.service"
    click YML "https://github.com/ducanhnguyen07/prometheus-dcgm/blob/main/prometheus/prometheus.yml"
    click RULES "https://github.com/ducanhnguyen07/prometheus-dcgm/blob/main/prometheus/rules.yml"
    click TARGETS "https://github.com/ducanhnguyen07/prometheus-dcgm/blob/main/prometheus/targets.json"
    click AMCONF "https://github.com/ducanhnguyen07/prometheus-dcgm/blob/main/prometheus/alertmanager.yml"
    click README "https://github.com/ducanhnguyen07/prometheus-dcgm/blob/main/README.md"
```
