prometheus/node_exporter · error

failed to open procfs

Error message

failed to open procfs: %w

What it means

NewARPCollector initializes a procfs filesystem handle rooted at --path.procfs; if procfs.NewFS fails (the mount point is missing or unreadable) construction fails with 'failed to open procfs: %w' wrapping the underlying error.

Solutions

  1. Ensure /proc is mounted in the container/namespace running node_exporter.
  2. Verify the --path.procfs flag points at a mounted proc filesystem.
  3. Check mount permissions for the exporter user.

Example fix

// before
node_exporter --path.procfs=/host/proc  # directory lacks procfs
// after
mount -t proc proc /host/proc && node_exporter --path.procfs=/host/proc
Defensive patterns

Strategy: validation

Validate before calling

if fi, err := os.Stat(*procPath); err != nil || !fi.IsDir() {
    return fmt.Errorf("procfs path %q is not a mounted directory", *procPath)
}

Try / catch

c, err := NewARPCollector(logger)
if err != nil {
    logger.Error("collector init failed", "err", err)
    os.Exit(1)
}

Prevention

When it happens

Trigger: Creating an ARPCollector when /proc (or the path passed via --path.procfs) is not a valid procfs mount — e.g., wrong path flag or procfs not mounted.

Common situations: Containers where /proc is not mounted or a custom --path.procfs points elsewhere in test setups; typos in the procfs path flag.

Understand the failure class

Background: "open() failed", "failed to open file", "cannot create file" — what a file open error means and how to fix it — this error's family across 42 libraries.

Related errors


AI-assisted analysis of prometheus/node_exporter@17ddd77c59 (2026-09-07). Data as JSON: /api/errors/1293bbcdbdd6cc5c. Report an issue: GitHub.

Appendix: source

Thrown at collector/arp_linux.go:57

}

func init() {
	registerCollector("arp", defaultEnabled, NewARPCollector)
}

var (
	arpEntries = prometheus.NewDesc(
		prometheus.BuildFQName(namespace, "arp", "entries"),
		"ARP entries by device",
		[]string{"device"}, nil,
	)
)

// NewARPCollector returns a new Collector exposing ARP stats.
func NewARPCollector(logger *slog.Logger) (Collector, error) {
	fs, err := procfs.NewFS(*procPath)
	if err != nil {
		return nil, fmt.Errorf("failed to open procfs: %w", err)
	}

	return &arpCollector{
		fs:           fs,
		deviceFilter: newDeviceFilter(*arpDeviceExclude, *arpDeviceInclude),
		logger:       logger,
	}, nil
}

func getTotalArpEntries(deviceEntries []procfs.ARPEntry) map[string]uint32 {
	entries := make(map[string]uint32)

	for _, device := range deviceEntries {
		entries[device.Device]++
	}

	return entries
}

View on GitHub (pinned to 17ddd77c59)