Node Exporter
Prometheus exporter for hardware and OS metrics.
Overview
Node Exporter is a Prometheus exporter developed by the Prometheus team that collects hardware and operating system metrics from Unix-like systems. Originally created to bridge the gap between traditional system monitoring and modern containerized environments, Node Exporter transforms system statistics into Prometheus-compatible metrics format. It gathers comprehensive data about CPU usage, memory consumption, disk I/O, network statistics, filesystem utilization, and hundreds of other system-level metrics that are essential for infrastructure monitoring.
This containerized Node Exporter deployment leverages host namespace access and bind mounts to collect complete system metrics while running in an isolated container environment. The configuration uses host PID namespace and mounts the root filesystem as read-only to ensure accurate metric collection without compromising system security. The setup exposes metrics on port 9100 in Prometheus format, making it immediately compatible with existing Prometheus monitoring infrastructure and Grafana dashboards.
System administrators running containerized workloads, DevOps teams building observability stacks, and infrastructure engineers monitoring bare-metal or virtual machines will find this deployment invaluable. The containerized approach ensures consistent Node Exporter versions across environments while maintaining full access to host system metrics, making it particularly useful for hybrid infrastructures where both containerized applications and host systems require monitoring.
Key Features
- Hardware metrics collection including CPU temperature, fan speeds, and power consumption from /proc and /sys filesystems
- Comprehensive network interface statistics with per-interface packet counts, error rates, and bandwidth utilization
- Filesystem metrics covering disk usage, inode consumption, and mount point information for all mounted filesystems
- Process and system load metrics with detailed CPU time breakdown and context switch counters
- Memory subsystem monitoring including buffer/cache utilization, swap usage, and memory pressure indicators
- Boot time and system uptime tracking with kernel version and architecture information
- Systemd service unit monitoring when systemd is detected on the host system
- Textfile collector support for custom metrics ingestion from external monitoring scripts
Common Use Cases
- 1Infrastructure monitoring for Kubernetes clusters where host node health visibility is critical for pod scheduling decisions
- 2Bare-metal server monitoring in hybrid cloud environments where traditional agents cannot be installed
- 3Container orchestration platforms requiring host resource utilization data for auto-scaling and resource allocation
- 4DevOps teams building comprehensive observability stacks with Prometheus, Grafana, and Alertmanager integration
- 5Homelab enthusiasts monitoring server hardware health including temperature sensors and disk SMART data
- 6Cloud migration projects where consistent metrics collection is needed across on-premises and cloud infrastructure
- 7Performance testing environments requiring detailed system resource utilization during load testing scenarios
Prerequisites
- Docker Engine 20.10+ with support for host PID namespace and bind mount propagation
- Minimum 50MB available memory for Node Exporter container and metric collection buffers
- Port 9100 available on host system for Prometheus metrics endpoint exposure
- Read access to host /proc, /sys, and filesystem mount points for comprehensive metric collection
- Understanding of Prometheus metric formats and scraping configuration for integration setup
- Root privileges or appropriate sudo access for Docker daemon communication and host namespace access
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 node-exporter: 3 image: prom/node-exporter:latest4 container_name: node-exporter5 restart: unless-stopped6 command: 7 - --path.rootfs=/host8 pid: host9 volumes: 10 - /:/host:ro,rslave11 ports: 12 - "9100:9100"13 networks: 14 - exporter-network1516networks: 17 exporter-network: 18 driver: bridge.env Template
.env
1# Node Exporter default configurationUsage Notes
- 1Docs: https://prometheus.io/docs/guides/node-exporter/
- 2Metrics endpoint at http://localhost:9100/metrics
- 3Exposes CPU, memory, disk, network, and filesystem metrics
- 4Add to Prometheus scrape_configs: - job_name: node, static_configs: targets: ['node-exporter:9100']
- 5Host PID namespace required for accurate process metrics
- 6Essential for monitoring host system in containerized environments
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 node-exporter:5 image: prom/node-exporter:latest6 container_name: node-exporter7 restart: unless-stopped8 command:9 - --path.rootfs=/host10 pid: host11 volumes:12 - /:/host:ro,rslave13 ports:14 - "9100:9100"15 networks:16 - exporter-network1718networks:19 exporter-network:20 driver: bridge21EOF2223# 2. Create the .env file24cat > .env << 'EOF'25# Node Exporter default configuration26EOF2728# 3. Start the services29docker compose up -d3031# 4. View logs32docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/node-exporter/run | bashTroubleshooting
- Permission denied errors accessing /proc or /sys: Ensure Docker daemon runs with sufficient privileges and host filesystem is mounted with correct permissions
- Missing temperature or hardware sensor metrics: Install lm-sensors package on host system and verify sensor modules are loaded in kernel
- Incomplete filesystem metrics for mounted volumes: Check that bind mount uses rslave propagation to inherit all host mount points
- High memory usage or metric cardinality: Use Node Exporter command-line flags to disable unused collectors like --no-collector.wifi
- Prometheus scraping timeouts on metrics endpoint: Increase Prometheus scrape timeout or disable expensive collectors for large filesystems
- Container restart loops with host PID namespace errors: Verify Docker daemon configuration allows privileged containers and host namespace access
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Components
node-exporter
Tags
#node-exporter#prometheus#metrics#hardware#os
Category
Monitoring & ObservabilityAd Space
Shortcuts: C CopyF FavoriteD Download