# pkutz-armada/idrac_exporter architecture

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

- Interactive diagram: https://gitdiagram.com/pkutz-armada/idrac_exporter
- Repository: https://github.com/pkutz-armada/idrac_exporter

## Overview

iDRAC Exporter is a Prometheus exporter for Redfish-managed hardware. Prometheus scrapes `/metrics?target=…`; the HTTP handler obtains a per-target collector, which discovers Redfish resources, gathers configured metric families, and returns the exposition text. Configuration also supports credential selection, discovery, and reload; documented metric domains include system, sensors, power, processors, events, storage, memory, and networking. The graph follows sampled handler, collector, and Redfish calls; domain coverage also reflects README capabilities, not inspection of every refresh implementation.

Main entry points: [`internal/collector/client.go`](https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/client.go) (Resource collection), [`cmd/idrac_exporter/handler.go`](https://github.com/pkutz-armada/idrac_exporter/blob/master/cmd/idrac_exporter/handler.go) (HTTP endpoints), [`cmd/idrac_exporter/config.go`](https://github.com/pkutz-armada/idrac_exporter/blob/master/cmd/idrac_exporter/config.go) (Config loading), [`internal/collector/collector.go`](https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/collector.go) (Collector orchestration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_serving["HTTP serving"]
  node_http["HTTP endpoints<br/>[handler.go]"]
  node_server["Server startup<br/>[main.go]"]
  node_discovery["Target discovery<br/>[discover.go]"]
end

subgraph group_configuration["Configuration"]
  node_configload["Config loading<br/>[config.go]"]
  node_config["Config and credentials<br/>[config.go]"]
  node_environment["Environment overrides<br/>[env.go]"]
end

subgraph group_collection["Metric collection"]
  node_collector["Collector orchestration<br/>[collector.go]"]
  node_client["Resource collection<br/>[client.go]"]
  node_metricdefs["Metric definitions<br/>[metrics.go]"]
  node_system["System metrics<br/>[client.go]"]
  node_sensors["Sensor metrics<br/>[client.go]"]
  node_power["Power metrics<br/>[client.go]"]
  node_processors["Processor metrics<br/>[client.go]"]
  node_events["Event log metrics<br/>[client.go]"]
  node_storage["Storage metrics<br/>[client.go]"]
  node_memory["Memory metrics<br/>[client.go]"]
  node_network["Network metrics<br/>[client.go]"]
end

subgraph group_redfish["Redfish access"]
  node_models["Redfish data models<br/>[model.go]"]
  node_redfishclient["Redfish transport<br/>[redfish.go]"]
end

node_prometheus(("Prometheus scraper"))
node_redfishservice[("Redfish device")]

node_prometheus -->|"scrapes"| node_http
node_server -->|"registers routes"| node_http
node_http -->|"gets collector"| node_collector
node_http -->|"serves discovery"| node_discovery
node_server -->|"loads config"| node_configload
node_configload -->|"parses and validates"| node_config
node_configload -->|"applies overrides"| node_environment
node_collector -->|"dispatches refreshes"| node_client
node_client -->|"requests resources"| node_redfishclient
node_redfishclient -->|"queries Redfish API"| node_redfishservice
node_client -->|"decodes responses"| node_models
node_collector -.->|"defines metrics"| node_metricdefs
node_client -->|"collects"| node_system
node_client -->|"collects"| node_sensors
node_client -->|"collects"| node_power
node_client -.->|"collects"| node_processors
node_client -->|"collects"| node_events
node_client -->|"collects"| node_storage
node_client -.->|"collects"| node_memory
node_client -->|"collects"| node_network

click node_http "https://github.com/pkutz-armada/idrac_exporter/blob/master/cmd/idrac_exporter/handler.go"
click node_server "https://github.com/pkutz-armada/idrac_exporter/blob/master/cmd/idrac_exporter/main.go"
click node_discovery "https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/config/discover.go"
click node_configload "https://github.com/pkutz-armada/idrac_exporter/blob/master/cmd/idrac_exporter/config.go"
click node_config "https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/config/config.go"
click node_environment "https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/config/env.go"
click node_collector "https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/collector.go"
click node_client "https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/client.go"
click node_metricdefs "https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/metrics.go"
click node_models "https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/model.go"
click node_redfishclient "https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/redfish.go"
click node_system "https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/client.go"
click node_sensors "https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/client.go"
click node_power "https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/client.go"
click node_processors "https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/client.go"
click node_events "https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/client.go"
click node_storage "https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/client.go"
click node_memory "https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/client.go"
click node_network "https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/client.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_http,node_server,node_discovery toneBlue
class node_configload,node_config,node_environment,node_redfishservice toneAmber
class node_collector,node_client,node_metricdefs,node_system,node_sensors,node_power,node_processors,node_events,node_storage,node_memory,node_network toneMint
class node_models,node_redfishclient toneRose
class node_prometheus toneIndigo
```

## Components

### HTTP serving

- [HTTP endpoints](https://github.com/pkutz-armada/idrac_exporter/blob/master/cmd/idrac_exporter/handler.go): `cmd/idrac_exporter/handler.go`
- [Server startup](https://github.com/pkutz-armada/idrac_exporter/blob/master/cmd/idrac_exporter/main.go): `cmd/idrac_exporter/main.go`
- [Target discovery](https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/config/discover.go): `internal/config/discover.go`

### Configuration

- [Config loading](https://github.com/pkutz-armada/idrac_exporter/blob/master/cmd/idrac_exporter/config.go): `cmd/idrac_exporter/config.go`
- [Config and credentials](https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/config/config.go): `internal/config/config.go`
- [Environment overrides](https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/config/env.go): `internal/config/env.go`

### Metric collection

- [Collector orchestration](https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/collector.go): `internal/collector/collector.go`
- [Resource collection](https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/client.go): `internal/collector/client.go`
- [Metric definitions](https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/metrics.go): `internal/collector/metrics.go`
- [System metrics](https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/client.go): `internal/collector/client.go`
- [Sensor metrics](https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/client.go): `internal/collector/client.go`
- [Power metrics](https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/client.go): `internal/collector/client.go`
- [Processor metrics](https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/client.go): `internal/collector/client.go`
- [Event log metrics](https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/client.go): `internal/collector/client.go`
- [Storage metrics](https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/client.go): `internal/collector/client.go`
- [Memory metrics](https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/client.go): `internal/collector/client.go`
- [Network metrics](https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/client.go): `internal/collector/client.go`

### Redfish access

- [Redfish data models](https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/model.go): `internal/collector/model.go`
- [Redfish transport](https://github.com/pkutz-armada/idrac_exporter/blob/master/internal/collector/redfish.go): `internal/collector/redfish.go`

### Other components

- **Prometheus scraper**
- **Redfish device**

## Connections

- Prometheus scraper → HTTP endpoints: scrapes (evidence: `README.md`)
- Server startup → HTTP endpoints: registers routes (evidence: `cmd/idrac_exporter/main.go`)
- HTTP endpoints → Collector orchestration: gets collector (evidence: `cmd/idrac_exporter/handler.go`)
- HTTP endpoints → Target discovery: serves discovery (evidence: `cmd/idrac_exporter/handler.go`)
- Server startup → Config loading: loads config (evidence: `cmd/idrac_exporter/main.go`)
- Config loading → Config and credentials: parses and validates (evidence: `cmd/idrac_exporter/config.go`)
- Config loading → Environment overrides: applies overrides (evidence: `cmd/idrac_exporter/config.go`)
- Collector orchestration → Resource collection: dispatches refreshes (evidence: `internal/collector/collector.go`)
- Resource collection → Redfish transport: requests resources (evidence: `internal/collector/client.go`)
- Redfish transport → Redfish device: queries Redfish API (evidence: `internal/collector/redfish.go`)
- Resource collection → Redfish data models: decodes responses (evidence: `internal/collector/client.go`)
- Collector orchestration → Metric definitions: defines metrics
- Resource collection → System metrics: collects (evidence: `internal/collector/client.go`)
- Resource collection → Sensor metrics: collects (evidence: `internal/collector/client.go`)
- Resource collection → Power metrics: collects (evidence: `internal/collector/client.go`)
- Resource collection → Processor metrics: collects (evidence: `internal/collector/client.go`)
- Resource collection → Event log metrics: collects (evidence: `internal/collector/client.go`)
- Resource collection → Storage metrics: collects (evidence: `internal/collector/client.go`)
- Resource collection → Memory metrics: collects (evidence: `internal/collector/client.go`)
- Resource collection → Network metrics: collects (evidence: `internal/collector/client.go`)
