# prometheus/node_exporter architecture

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

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

## Overview

Node exporter is a Go service that gathers host and kernel metrics through pluggable, OS-specific collectors and exposes them over HTTP for Prometheus to scrape. The main workflow is an HTTP scrape, optional collector filtering, collection and registration of metrics, then an HTTP metrics response. Collector implementations cover system, storage, network, hardware, and service-state domains. The handler-to-collector entry point is visible in the excerpt; many individual collector implementations were not sampled, so their wiring is not asserted.

Main entry points: [`collector/collector.go`](https://github.com/prometheus/node_exporter/blob/master/collector/collector.go) (Collector registry), [`node_exporter.go`](https://github.com/prometheus/node_exporter/blob/master/node_exporter.go) (HTTP handler), [`collector/textfile.go`](https://github.com/prometheus/node_exporter/blob/master/collector/textfile.go) (Textfile metrics), [`collector/cpu_linux.go`](https://github.com/prometheus/node_exporter/blob/master/collector/cpu_linux.go) (CPU metrics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_serve["Scrape service"]
  node_http["HTTP handler<br/>[node_exporter.go]"]
  node_registry["Metric registry<br/>[node_exporter.go]"]
end

subgraph group_collect["Collector framework"]
  node_collector_core["Collector registry<br/>[collector.go]"]
  node_textfile["Textfile metrics<br/>[textfile.go]"]
end

subgraph group_system["System metrics"]
  node_cpu["CPU metrics<br/>[cpu_linux.go]"]
  node_memory["Memory metrics<br/>[meminfo_linux.go]"]
  node_load["Load and time<br/>[loadavg_linux.go]"]
  node_process["Process metrics<br/>[processes_linux.go]"]
end

subgraph group_storage["Storage metrics"]
  node_disk["Disk statistics<br/>[diskstats_linux.go]"]
  node_filesystem["Filesystem usage"]
  node_btrfs["Btrfs metrics<br/>[btrfs_linux.go]"]
  node_zfs["ZFS metrics<br/>[zfs_linux.go]"]
end

subgraph group_network["Network metrics"]
  node_network["Network statistics<br/>[netdev_linux.go]"]
  node_netstat["Network protocols"]
  node_wifi["Wi-Fi metrics<br/>[wifi_linux.go]"]
  node_infiniband["InfiniBand metrics"]
end

subgraph group_hardware["Hardware and services"]
  node_hwmon["Sensor metrics<br/>[hwmon_linux.go]"]
  node_pci["PCI device metrics<br/>[pcidevice_linux.go]"]
  node_perf["Performance events<br/>[perf_linux.go]"]
  node_systemd["Systemd units<br/>[systemd_linux.go]"]
end

node_prometheus(("Prometheus scraper"))

node_prometheus -->|"scrapes"| node_http
node_http -->|"creates collector"| node_collector_core
node_http -->|"registers metrics"| node_registry
node_collector_core -.->|"dispatches to"| node_cpu
node_collector_core -.->|"dispatches to"| node_memory
node_collector_core -.->|"dispatches to"| node_load
node_collector_core -.->|"dispatches to"| node_process
node_collector_core -.->|"dispatches to"| node_disk
node_collector_core -.->|"dispatches to"| node_filesystem
node_collector_core -.->|"dispatches to"| node_btrfs
node_collector_core -.->|"dispatches to"| node_zfs
node_collector_core -.->|"dispatches to"| node_network
node_collector_core -.->|"dispatches to"| node_netstat
node_collector_core -.->|"dispatches to"| node_wifi
node_collector_core -.->|"dispatches to"| node_infiniband
node_collector_core -.->|"dispatches to"| node_hwmon
node_collector_core -.->|"dispatches to"| node_pci
node_collector_core -.->|"dispatches to"| node_perf
node_collector_core -.->|"dispatches to"| node_systemd
node_collector_core -.->|"dispatches to"| node_textfile

click node_http "https://github.com/prometheus/node_exporter/blob/master/node_exporter.go"
click node_registry "https://github.com/prometheus/node_exporter/blob/master/node_exporter.go"
click node_collector_core "https://github.com/prometheus/node_exporter/blob/master/collector/collector.go"
click node_cpu "https://github.com/prometheus/node_exporter/blob/master/collector/cpu_linux.go"
click node_memory "https://github.com/prometheus/node_exporter/blob/master/collector/meminfo_linux.go"
click node_load "https://github.com/prometheus/node_exporter/blob/master/collector/loadavg_linux.go"
click node_process "https://github.com/prometheus/node_exporter/blob/master/collector/processes_linux.go"
click node_disk "https://github.com/prometheus/node_exporter/blob/master/collector/diskstats_linux.go"
click node_filesystem "https://github.com/prometheus/node_exporter/blob/master/collector/filesystem_linux.go"
click node_btrfs "https://github.com/prometheus/node_exporter/blob/master/collector/btrfs_linux.go"
click node_zfs "https://github.com/prometheus/node_exporter/blob/master/collector/zfs_linux.go"
click node_network "https://github.com/prometheus/node_exporter/blob/master/collector/netdev_linux.go"
click node_netstat "https://github.com/prometheus/node_exporter/blob/master/collector/netstat_descs_linux.go"
click node_wifi "https://github.com/prometheus/node_exporter/blob/master/collector/wifi_linux.go"
click node_infiniband "https://github.com/prometheus/node_exporter/blob/master/collector/infiniband_linux.go"
click node_hwmon "https://github.com/prometheus/node_exporter/blob/master/collector/hwmon_linux.go"
click node_pci "https://github.com/prometheus/node_exporter/blob/master/collector/pcidevice_linux.go"
click node_perf "https://github.com/prometheus/node_exporter/blob/master/collector/perf_linux.go"
click node_systemd "https://github.com/prometheus/node_exporter/blob/master/collector/systemd_linux.go"
click node_textfile "https://github.com/prometheus/node_exporter/blob/master/collector/textfile.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_registry toneBlue
class node_collector_core,node_textfile toneAmber
class node_cpu,node_memory,node_load,node_process toneMint
class node_disk,node_filesystem,node_btrfs,node_zfs toneRose
class node_network,node_netstat,node_wifi,node_infiniband,node_prometheus toneIndigo
class node_hwmon,node_pci,node_perf,node_systemd toneTeal
```

## Components

### Scrape service

- [HTTP handler](https://github.com/prometheus/node_exporter/blob/master/node_exporter.go): `node_exporter.go`
- [Metric registry](https://github.com/prometheus/node_exporter/blob/master/node_exporter.go): `node_exporter.go`

### Collector framework

- [Collector registry](https://github.com/prometheus/node_exporter/blob/master/collector/collector.go): `collector/collector.go`
- [Textfile metrics](https://github.com/prometheus/node_exporter/blob/master/collector/textfile.go): `collector/textfile.go`

### System metrics

- [CPU metrics](https://github.com/prometheus/node_exporter/blob/master/collector/cpu_linux.go): `collector/cpu_linux.go`
- [Memory metrics](https://github.com/prometheus/node_exporter/blob/master/collector/meminfo_linux.go): `collector/meminfo_linux.go`
- [Load and time](https://github.com/prometheus/node_exporter/blob/master/collector/loadavg_linux.go): `collector/loadavg_linux.go`
- [Process metrics](https://github.com/prometheus/node_exporter/blob/master/collector/processes_linux.go): `collector/processes_linux.go`

### Storage metrics

- [Disk statistics](https://github.com/prometheus/node_exporter/blob/master/collector/diskstats_linux.go): `collector/diskstats_linux.go`
- [Filesystem usage](https://github.com/prometheus/node_exporter/blob/master/collector/filesystem_linux.go): `collector/filesystem_linux.go`
- [Btrfs metrics](https://github.com/prometheus/node_exporter/blob/master/collector/btrfs_linux.go): `collector/btrfs_linux.go`
- [ZFS metrics](https://github.com/prometheus/node_exporter/blob/master/collector/zfs_linux.go): `collector/zfs_linux.go`

### Network metrics

- [Network statistics](https://github.com/prometheus/node_exporter/blob/master/collector/netdev_linux.go): `collector/netdev_linux.go`
- [Network protocols](https://github.com/prometheus/node_exporter/blob/master/collector/netstat_descs_linux.go): `collector/netstat_descs_linux.go`
- [Wi-Fi metrics](https://github.com/prometheus/node_exporter/blob/master/collector/wifi_linux.go): `collector/wifi_linux.go`
- [InfiniBand metrics](https://github.com/prometheus/node_exporter/blob/master/collector/infiniband_linux.go): `collector/infiniband_linux.go`

### Hardware and services

- [Sensor metrics](https://github.com/prometheus/node_exporter/blob/master/collector/hwmon_linux.go): `collector/hwmon_linux.go`
- [PCI device metrics](https://github.com/prometheus/node_exporter/blob/master/collector/pcidevice_linux.go): `collector/pcidevice_linux.go`
- [Performance events](https://github.com/prometheus/node_exporter/blob/master/collector/perf_linux.go): `collector/perf_linux.go`
- [Systemd units](https://github.com/prometheus/node_exporter/blob/master/collector/systemd_linux.go): `collector/systemd_linux.go`

### Other components

- **Prometheus scraper**

## Connections

- Prometheus scraper → HTTP handler: scrapes
- HTTP handler → Collector registry: creates collector (evidence: `node_exporter.go`)
- HTTP handler → Metric registry: registers metrics (evidence: `node_exporter.go`)
- Collector registry → CPU metrics: dispatches to
- Collector registry → Memory metrics: dispatches to
- Collector registry → Load and time: dispatches to
- Collector registry → Process metrics: dispatches to
- Collector registry → Disk statistics: dispatches to
- Collector registry → Filesystem usage: dispatches to
- Collector registry → Btrfs metrics: dispatches to
- Collector registry → ZFS metrics: dispatches to
- Collector registry → Network statistics: dispatches to
- Collector registry → Network protocols: dispatches to
- Collector registry → Wi-Fi metrics: dispatches to
- Collector registry → InfiniBand metrics: dispatches to
- Collector registry → Sensor metrics: dispatches to
- Collector registry → PCI device metrics: dispatches to
- Collector registry → Performance events: dispatches to
- Collector registry → Systemd units: dispatches to
- Collector registry → Textfile metrics: dispatches to
