{"record":{"id":"582e2ba4fd14a3a9","repo":"prometheus/node_exporter","slug":"couldn-t-get-entropy-poolsize","errorCode":null,"errorMessage":"couldn't get entropy poolsize","messagePattern":"couldn't get entropy poolsize","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/entropy_linux.go","lineNumber":74,"sourceCode":"\t\tfs:     fs,\n\t\tlogger: logger,\n\t}, nil\n}\n\nfunc (c *entropyCollector) Update(ch chan<- prometheus.Metric) error {\n\tstats, err := c.fs.KernelRandom()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get kernel random stats: %w\", err)\n\t}\n\n\tif stats.EntropyAvaliable == nil {\n\t\treturn fmt.Errorf(\"couldn't get entropy_avail\")\n\t}\n\tch <- prometheus.MustNewConstMetric(\n\t\tentropyAvail, prometheus.GaugeValue, float64(*stats.EntropyAvaliable))\n\n\tif stats.PoolSize == nil {\n\t\treturn fmt.Errorf(\"couldn't get entropy poolsize\")\n\t}\n\tch <- prometheus.MustNewConstMetric(\n\t\tentropyPoolSize, prometheus.GaugeValue, float64(*stats.PoolSize))\n\n\treturn nil\n}\n","sourceCodeStart":56,"sourceCodeEnd":81,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/entropy_linux.go#L56-L81","documentation":"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.","triggerScenarios":"KernelRandom() parse yields stats.PoolSize == nil — poolsize file missing, empty, or unparseable — during entropyCollector.Update.","commonSituations":"Kernel builds or embedded systems that omit /proc/sys/kernel/random/poolsize while keeping entropy_avail; procfs library parsing mismatch; filtered /proc in containers.","solutions":["Check `cat /proc/sys/kernel/random/poolsize` exists and is numeric.","Upgrade the kernel or the prometheus/procfs dependency if the file layout changed.","Inspect container /proc mounting and security policies that mask the sysctl.","Disable the entropy collector if poolsize cannot be provided by your platform."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const fs = require('fs');\nconst f = '/proc/sys/kernel/random/poolsize';\nif (!fs.existsSync(f) || isNaN(parseInt(fs.readFileSync(f, 'utf8').trim(), 10))) {\n  console.warn('poolsize missing — entropy collector will fail; disable --collector.entropy');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await scrapeNodeExporter();\n} catch (e) {\n  if (String(e).includes('couldn\\'t get entropy poolsize')) {\n    console.warn('poolsize unavailable on this kernel; set --collector.entropy=false');\n  } else throw e;\n}","preventionTips":["Probe /proc/sys/kernel/random/poolsize on target hosts before enabling the collector.","Keep kernel and procfs library versions aligned.","Use per-host collector enablement config for heterogeneous fleets."],"tags":["linux","procfs","entropy","nil-guard"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"17ddd77c59ba27e1508e9f7894b1e55b44d6aed3","analyzedAt":"2026-09-07T17:54:06.211Z","contentChangedAt":"2026-09-07T17:54:06.211Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}