How prometheus/node_exporter works
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.go Collector registry · node_exporter.go HTTP handler · textfile.go Textfile metrics · cpu_linux.go CPU metrics
Components 21
Scrape service
- HTTP handler
node_exporter.go - Metric registry
node_exporter.go
Collector framework
- Collector registry
collector/collector.go - Textfile metrics
collector/textfile.go
System metrics
- CPU metrics
collector/cpu_linux.go - Memory metrics
collector/meminfo_linux.go - Load and time
collector/loadavg_linux.go - Process metrics
collector/processes_linux.go
Storage metrics
- Disk statistics
collector/diskstats_linux.go - Filesystem usage
collector/filesystem_linux.go - Btrfs metrics
collector/btrfs_linux.go - ZFS metrics
collector/zfs_linux.go
Network metrics
- Network statistics
collector/netdev_linux.go - Network protocols
collector/netstat_descs_linux.go - Wi-Fi metrics
collector/wifi_linux.go - InfiniBand metrics
collector/infiniband_linux.go
Hardware and services
- Sensor metrics
collector/hwmon_linux.go - PCI device metrics
collector/pcidevice_linux.go - Performance events
collector/perf_linux.go - Systemd units
collector/systemd_linux.go
Other components
- Prometheus scraper
Connections 20
- Prometheus scraper → HTTP handler: scrapes
- HTTP handler → Collector registry: creates collector
node_exporter.go - HTTP handler → Metric registry: registers metrics
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