# raphaelthomas/meinberg_ltos_exporter architecture

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

- Interactive diagram: https://gitdiagram.com/raphaelthomas/meinberg_ltos_exporter
- Repository: https://github.com/raphaelthomas/meinberg_ltos_exporter

## Overview

Meinberg LTOS Exporter fetches device status from the LTOS REST API and exposes Prometheus metrics for scraping. Its main runtime path configures the API client and collector, serves the metrics handler, and on collection fetches one status response before dispatching enabled system, notification, network, storage, clock, receiver, and NTP metric conversions. The graph retains these documented metric domains; sampled source supports the main dispatch and several conversions, while unsampled collector details are represented by their exact paths without inferred internal links.

Main entry points: [`pkg/collector/collector.go`](https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/collector/collector.go) (Scrape coordinator), [`pkg/ltosapi/models`](https://github.com/raphaelthomas/meinberg_ltos_exporter/tree/main/pkg/ltosapi/models) (Status models), [`main.go`](https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/main.go) (HTTP exporter), [`pkg/ltosapi/client.go`](https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/ltosapi/client.go) (LTOS API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Exporter runtime"]
  node_main["HTTP exporter<br/>[main.go]"]
  node_buildinfo["Build information<br/>[buildinfo.go]"]
end

subgraph group_api["LTOS API"]
  node_client["LTOS API client<br/>[client.go]"]
  node_models["Status models"]
end

subgraph group_collection["Metric collection"]
  node_collector["Scrape coordinator<br/>[collector.go]"]
  node_helpers["Collector helpers<br/>[helpers.go]"]
end

subgraph group_domain["Device metric domains"]
  node_system["System metrics<br/>[system.go]"]
  node_notification["Notification metrics<br/>[notification.go]"]
  node_network["Network metrics<br/>[network.go]"]
  node_storage["Storage metrics<br/>[storage.go]"]
  node_clock["Clock metrics<br/>[clock.go]"]
  node_gnss["GNSS receiver metrics<br/>[receiver_gnss.go]"]
  node_dcf77["DCF77 metrics<br/>[receiver_dcf77.go]"]
  node_ntp["NTP metrics<br/>[ntp.go]"]
end

node_scraper(("Prometheus scraper"))
node_ltos(("Meinberg LTOS device"))

node_scraper -->|"scrapes"| node_main
node_main -->|"registers"| node_collector
node_main -->|"creates"| node_client
node_main -->|"reads version"| node_buildinfo
node_main -->|"serves metrics"| node_scraper
node_collector -->|"fetches status"| node_client
node_client -->|"requests status"| node_ltos
node_client -->|"decodes response"| node_models
node_collector -->|"collects"| node_system
node_collector -->|"collects"| node_notification
node_collector -->|"collects"| node_network
node_collector -->|"collects"| node_storage
node_collector -->|"collects"| node_ntp
node_collector -->|"collects"| node_clock
node_collector -->|"collects"| node_gnss
node_collector -->|"collects"| node_dcf77
node_collector -.->|"uses"| node_helpers
node_system -->|"reads"| node_models
node_notification -->|"reads"| node_models
node_network -->|"reads"| node_models
node_storage -->|"reads"| node_models
node_ntp -->|"reads"| node_models
node_clock -->|"uses slots"| node_helpers
node_system -->|"uses CPU slots"| node_helpers
node_clock -->|"reads"| node_models
node_gnss -->|"reads"| node_models
node_dcf77 -->|"reads"| node_models

click node_main "https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/main.go"
click node_collector "https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/collector/collector.go"
click node_buildinfo "https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/buildinfo/buildinfo.go"
click node_client "https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/ltosapi/client.go"
click node_models "https://github.com/raphaelthomas/meinberg_ltos_exporter/tree/main/pkg/ltosapi/models"
click node_helpers "https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/collector/helpers.go"
click node_system "https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/collector/system.go"
click node_notification "https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/collector/notification.go"
click node_network "https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/collector/network.go"
click node_storage "https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/collector/storage.go"
click node_clock "https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/collector/clock.go"
click node_gnss "https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/collector/receiver_gnss.go"
click node_dcf77 "https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/collector/receiver_dcf77.go"
click node_ntp "https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/collector/ntp.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_buildinfo toneBlue
class node_client,node_models toneAmber
class node_collector,node_helpers toneMint
class node_system,node_notification,node_network,node_storage,node_clock,node_gnss,node_dcf77,node_ntp toneRose
class node_scraper,node_ltos toneIndigo
```

## Components

### Exporter runtime

- [HTTP exporter](https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/main.go): `main.go`
- [Build information](https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/buildinfo/buildinfo.go): `pkg/buildinfo/buildinfo.go`

### LTOS API

- [LTOS API client](https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/ltosapi/client.go): `pkg/ltosapi/client.go`
- [Status models](https://github.com/raphaelthomas/meinberg_ltos_exporter/tree/main/pkg/ltosapi/models): `pkg/ltosapi/models`

### Metric collection

- [Scrape coordinator](https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/collector/collector.go): `pkg/collector/collector.go`
- [Collector helpers](https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/collector/helpers.go): `pkg/collector/helpers.go`

### Device metric domains

- [System metrics](https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/collector/system.go): `pkg/collector/system.go`
- [Notification metrics](https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/collector/notification.go): `pkg/collector/notification.go`
- [Network metrics](https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/collector/network.go): `pkg/collector/network.go`
- [Storage metrics](https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/collector/storage.go): `pkg/collector/storage.go`
- [Clock metrics](https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/collector/clock.go): `pkg/collector/clock.go`
- [GNSS receiver metrics](https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/collector/receiver_gnss.go): `pkg/collector/receiver_gnss.go`
- [DCF77 metrics](https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/collector/receiver_dcf77.go): `pkg/collector/receiver_dcf77.go`
- [NTP metrics](https://github.com/raphaelthomas/meinberg_ltos_exporter/blob/main/pkg/collector/ntp.go): `pkg/collector/ntp.go`

### Other components

- **Prometheus scraper**
- **Meinberg LTOS device**

## Connections

- Prometheus scraper → HTTP exporter: scrapes (evidence: `README.md`)
- HTTP exporter → Scrape coordinator: registers (evidence: `main.go`)
- HTTP exporter → LTOS API client: creates (evidence: `main.go`)
- HTTP exporter → Build information: reads version (evidence: `main.go`)
- HTTP exporter → Prometheus scraper: serves metrics (evidence: `main.go`)
- Scrape coordinator → LTOS API client: fetches status (evidence: `pkg/collector/collector.go`)
- LTOS API client → Meinberg LTOS device: requests status (evidence: `pkg/ltosapi/client.go`)
- LTOS API client → Status models: decodes response (evidence: `pkg/ltosapi/client.go`)
- Scrape coordinator → System metrics: collects (evidence: `pkg/collector/collector.go`)
- Scrape coordinator → Notification metrics: collects (evidence: `pkg/collector/collector.go`)
- Scrape coordinator → Network metrics: collects (evidence: `pkg/collector/collector.go`)
- Scrape coordinator → Storage metrics: collects (evidence: `pkg/collector/collector.go`)
- Scrape coordinator → NTP metrics: collects (evidence: `pkg/collector/collector.go`)
- Scrape coordinator → Clock metrics: collects (evidence: `pkg/collector/collector.go`)
- Scrape coordinator → GNSS receiver metrics: collects (evidence: `pkg/collector/collector.go`)
- Scrape coordinator → DCF77 metrics: collects (evidence: `pkg/collector/collector.go`)
- Scrape coordinator → Collector helpers: uses
- System metrics → Status models: reads (evidence: `pkg/collector/system.go`)
- Notification metrics → Status models: reads (evidence: `pkg/collector/notification.go`)
- Network metrics → Status models: reads (evidence: `pkg/collector/network.go`)
- Storage metrics → Status models: reads (evidence: `pkg/collector/storage.go`)
- NTP metrics → Status models: reads (evidence: `pkg/collector/ntp.go`)
- Clock metrics → Collector helpers: uses slots (evidence: `pkg/collector/clock.go`)
- System metrics → Collector helpers: uses CPU slots (evidence: `pkg/collector/system.go`)
- Clock metrics → Status models: reads (evidence: `pkg/collector/clock.go`)
- GNSS receiver metrics → Status models: reads (evidence: `pkg/collector/receiver_gnss.go`)
- DCF77 metrics → Status models: reads (evidence: `pkg/collector/receiver_dcf77.go`)
