prometheus/node_exporter · error

couldn't get entropy poolsize

Error message

couldn't get entropy poolsize

What it means

Companion guard to entropy_avail: after emitting the entropy gauge, the collector checks stats.PoolSize (from /proc/sys/kernel/random/poolsize) is non-nil. If missing, Update returns 'couldn't get entropy poolsize' and the scrape fails. The poolsize file may be absent on kernels that do not expose it.

Solutions

  1. Check `cat /proc/sys/kernel/random/poolsize` exists and is numeric.
  2. Upgrade the kernel or the prometheus/procfs dependency if the file layout changed.
  3. Inspect container /proc mounting and security policies that mask the sysctl.
  4. Disable the entropy collector if poolsize cannot be provided by your platform.
Defensive patterns

Strategy: try-catch

Validate before calling

const fs = require('fs');
const f = '/proc/sys/kernel/random/poolsize';
if (!fs.existsSync(f) || isNaN(parseInt(fs.readFileSync(f, 'utf8').trim(), 10))) {
  console.warn('poolsize missing — entropy collector will fail; disable --collector.entropy');
}

Try / catch

try {
  await scrapeNodeExporter();
} catch (e) {
  if (String(e).includes('couldn\'t get entropy poolsize')) {
    console.warn('poolsize unavailable on this kernel; set --collector.entropy=false');
  } else throw e;
}

Prevention

When it happens

Trigger: KernelRandom() parse yields stats.PoolSize == nil — poolsize file missing, empty, or unparseable — during entropyCollector.Update.

Common situations: Kernel builds or embedded systems that omit /proc/sys/kernel/random/poolsize while keeping entropy_avail; procfs library parsing mismatch; filtered /proc in containers.

Understand the failure class

Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at collector/entropy_linux.go:74

		fs:     fs,
		logger: logger,
	}, nil
}

func (c *entropyCollector) Update(ch chan<- prometheus.Metric) error {
	stats, err := c.fs.KernelRandom()
	if err != nil {
		return fmt.Errorf("failed to get kernel random stats: %w", err)
	}

	if stats.EntropyAvaliable == nil {
		return fmt.Errorf("couldn't get entropy_avail")
	}
	ch <- prometheus.MustNewConstMetric(
		entropyAvail, prometheus.GaugeValue, float64(*stats.EntropyAvaliable))

	if stats.PoolSize == nil {
		return fmt.Errorf("couldn't get entropy poolsize")
	}
	ch <- prometheus.MustNewConstMetric(
		entropyPoolSize, prometheus.GaugeValue, float64(*stats.PoolSize))

	return nil
}

View on GitHub (pinned to 17ddd77c59)