# psyinfra/prometheus-raritan-pdu-exporter architecture

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

- Interactive diagram: https://gitdiagram.com/psyinfra/prometheus-raritan-pdu-exporter
- Repository: https://github.com/psyinfra/prometheus-raritan-pdu-exporter

## Overview

This retired exporter serves Prometheus metrics collected live from configured Raritan PDUs. Its workflow loads PDU credentials, exposes an HTTP scrape endpoint, discovers connectors and sensors, reads their values through the Raritan bulk JSON-RPC API, and converts readings into Prometheus metric families. The graph separates serving, collection/modeling, and protocol concerns. Source excerpts show the main calls; README statements support scrape and health-check behavior. Some interface implementation is excerpted only partially, so omitted details are not inferred.

Main entry points: [`prometheus_raritan_pdu_exporter/main.py`](https://github.com/psyinfra/prometheus-raritan-pdu-exporter/blob/master/prometheus_raritan_pdu_exporter/main.py) (CLI and server), [`prometheus_raritan_pdu_exporter/interfaces.py`](https://github.com/psyinfra/prometheus-raritan-pdu-exporter/blob/master/prometheus_raritan_pdu_exporter/interfaces.py) (PDU inventory and readings), [`prometheus_raritan_pdu_exporter/exporter.py`](https://github.com/psyinfra/prometheus-raritan-pdu-exporter/blob/master/prometheus_raritan_pdu_exporter/exporter.py) (Metric collection), [`prometheus_raritan_pdu_exporter/jsonrpc.py`](https://github.com/psyinfra/prometheus-raritan-pdu-exporter/blob/master/prometheus_raritan_pdu_exporter/jsonrpc.py) (Bulk JSON-RPC client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_serving["HTTP serving"]
  node_main["CLI and server<br/>[main.py]"]
  node_http["Metrics and health endpoints<br/>[main.py]"]
end

subgraph group_collection["PDU collection"]
  node_exporter["Metric collection<br/>[exporter.py]"]
  node_inventory["PDU inventory and readings<br/>[interfaces.py]"]
end

subgraph group_protocol["Protocol and modeling"]
  node_metricmodel["Sensor metric model<br/>[interfaces.py]"]
  node_jsonrpc["Bulk JSON-RPC client<br/>[jsonrpc.py]"]
  node_debug["Response diagnostics<br/>[debug.py]"]
end

node_operator(("Exporter operator"))
node_scraper(("Prometheus scraper"))
node_pdu[("Raritan PDU")]

node_operator -->|"configures"| node_main
node_main -->|"creates auth"| node_jsonrpc
node_main -->|"registers"| node_exporter
node_main -->|"serves"| node_http
node_scraper -->|"requests metrics"| node_http
node_http -->|"triggers collection"| node_exporter
node_exporter -->|"sets up and reads"| node_inventory
node_exporter -->|"groups readings"| node_metricmodel
node_inventory -->|"sends requests"| node_jsonrpc
node_jsonrpc -->|"posts bulk calls"| node_pdu
node_inventory -->|"builds sensor metrics"| node_metricmodel
node_inventory -->|"reports missing responses"| node_debug

click node_main "https://github.com/psyinfra/prometheus-raritan-pdu-exporter/blob/master/prometheus_raritan_pdu_exporter/main.py"
click node_http "https://github.com/psyinfra/prometheus-raritan-pdu-exporter/blob/master/prometheus_raritan_pdu_exporter/main.py"
click node_exporter "https://github.com/psyinfra/prometheus-raritan-pdu-exporter/blob/master/prometheus_raritan_pdu_exporter/exporter.py"
click node_inventory "https://github.com/psyinfra/prometheus-raritan-pdu-exporter/blob/master/prometheus_raritan_pdu_exporter/interfaces.py"
click node_metricmodel "https://github.com/psyinfra/prometheus-raritan-pdu-exporter/blob/master/prometheus_raritan_pdu_exporter/interfaces.py"
click node_jsonrpc "https://github.com/psyinfra/prometheus-raritan-pdu-exporter/blob/master/prometheus_raritan_pdu_exporter/jsonrpc.py"
click node_debug "https://github.com/psyinfra/prometheus-raritan-pdu-exporter/blob/master/prometheus_raritan_pdu_exporter/debug.py"

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_http toneBlue
class node_exporter,node_inventory,node_pdu toneAmber
class node_metricmodel,node_jsonrpc,node_debug toneMint
class node_operator,node_scraper toneIndigo
```

## Components

### HTTP serving

- [CLI and server](https://github.com/psyinfra/prometheus-raritan-pdu-exporter/blob/master/prometheus_raritan_pdu_exporter/main.py): `prometheus_raritan_pdu_exporter/main.py`
- [Metrics and health endpoints](https://github.com/psyinfra/prometheus-raritan-pdu-exporter/blob/master/prometheus_raritan_pdu_exporter/main.py): `prometheus_raritan_pdu_exporter/main.py`

### PDU collection

- [Metric collection](https://github.com/psyinfra/prometheus-raritan-pdu-exporter/blob/master/prometheus_raritan_pdu_exporter/exporter.py): `prometheus_raritan_pdu_exporter/exporter.py`
- [PDU inventory and readings](https://github.com/psyinfra/prometheus-raritan-pdu-exporter/blob/master/prometheus_raritan_pdu_exporter/interfaces.py): `prometheus_raritan_pdu_exporter/interfaces.py`

### Protocol and modeling

- [Sensor metric model](https://github.com/psyinfra/prometheus-raritan-pdu-exporter/blob/master/prometheus_raritan_pdu_exporter/interfaces.py): `prometheus_raritan_pdu_exporter/interfaces.py`
- [Bulk JSON-RPC client](https://github.com/psyinfra/prometheus-raritan-pdu-exporter/blob/master/prometheus_raritan_pdu_exporter/jsonrpc.py): `prometheus_raritan_pdu_exporter/jsonrpc.py`
- [Response diagnostics](https://github.com/psyinfra/prometheus-raritan-pdu-exporter/blob/master/prometheus_raritan_pdu_exporter/debug.py): `prometheus_raritan_pdu_exporter/debug.py`

### Other components

- **Exporter operator**
- **Prometheus scraper**
- **Raritan PDU**

## Connections

- Exporter operator → CLI and server: configures (evidence: `prometheus_raritan_pdu_exporter/main.py`)
- CLI and server → Bulk JSON-RPC client: creates auth (evidence: `prometheus_raritan_pdu_exporter/main.py`)
- CLI and server → Metric collection: registers (evidence: `prometheus_raritan_pdu_exporter/main.py`)
- CLI and server → Metrics and health endpoints: serves (evidence: `prometheus_raritan_pdu_exporter/main.py`)
- Prometheus scraper → Metrics and health endpoints: requests metrics (evidence: `README.md`)
- Metrics and health endpoints → Metric collection: triggers collection (evidence: `README.md`)
- Metric collection → PDU inventory and readings: sets up and reads (evidence: `prometheus_raritan_pdu_exporter/exporter.py`)
- Metric collection → Sensor metric model: groups readings (evidence: `prometheus_raritan_pdu_exporter/exporter.py`)
- PDU inventory and readings → Bulk JSON-RPC client: sends requests (evidence: `prometheus_raritan_pdu_exporter/interfaces.py`)
- Bulk JSON-RPC client → Raritan PDU: posts bulk calls (evidence: `prometheus_raritan_pdu_exporter/jsonrpc.py`)
- PDU inventory and readings → Sensor metric model: builds sensor metrics (evidence: `prometheus_raritan_pdu_exporter/interfaces.py`)
- PDU inventory and readings → Response diagnostics: reports missing responses (evidence: `prometheus_raritan_pdu_exporter/interfaces.py`)
