{"record":{"id":"6533f9dbfe580891","repo":"prometheus/node_exporter","slug":"failed-to-retrieve-nfsd-stats-w","errorCode":null,"errorMessage":"failed to retrieve nfsd stats: %w","messagePattern":"failed to retrieve nfsd stats: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/nfsd_linux.go","lineNumber":70,"sourceCode":"\t\tfs: fs,\n\t\trequestsDesc: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, nfsdSubsystem, \"requests_total\"),\n\t\t\t\"Total number NFSd Requests by method and protocol.\",\n\t\t\t[]string{\"proto\", \"method\"}, nil,\n\t\t),\n\t\tlogger: logger,\n\t}, nil\n}\n\n// Update implements Collector.\nfunc (c *nfsdCollector) Update(ch chan<- prometheus.Metric) error {\n\tstats, err := c.fs.ServerRPCStats()\n\tif err != nil {\n\t\tif errors.Is(err, os.ErrNotExist) {\n\t\t\tc.logger.Debug(\"Not collecting NFSd metrics\", \"err\", err)\n\t\t\treturn ErrNoData\n\t\t}\n\t\treturn fmt.Errorf(\"failed to retrieve nfsd stats: %w\", err)\n\t}\n\n\tc.updateNFSdReplyCacheStats(ch, &stats.ReplyCache)\n\tc.updateNFSdFileHandlesStats(ch, &stats.FileHandles)\n\tc.updateNFSdInputOutputStats(ch, &stats.InputOutput)\n\tc.updateNFSdThreadsStats(ch, &stats.Threads)\n\tc.updateNFSdReadAheadCacheStats(ch, &stats.ReadAheadCache)\n\tc.updateNFSdNetworkStats(ch, &stats.Network)\n\tc.updateNFSdServerRPCStats(ch, &stats.ServerRPC)\n\tc.updateNFSdRequestsv2Stats(ch, &stats.V2Stats)\n\tc.updateNFSdRequestsv3Stats(ch, &stats.V3Stats)\n\tc.updateNFSdRequestsv4Stats(ch, &stats.V4Ops)\n\tch <- prometheus.MustNewConstMetric(c.requestsDesc, prometheus.CounterValue,\n\t\tfloat64(stats.WdelegGetattr), \"4\", \"WdelegGetattr\")\n\n\treturn nil\n}\n","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/nfsd_linux.go#L52-L88","documentation":"The nfsd collector's Update calls fs.ServerRPCStats() to read /proc/net/rpc/nfsd server statistics through the procfs library. Failures other than os.ErrNotExist (which is treated as 'nfsd not present' and returns ErrNoData) are wrapped in this message. It indicates the nfsd stats file could not be read or parsed even though the procfs mount itself is valid.","triggerScenarios":"c.fs.ServerRPCStats() returns a non-ErrNotExist error: permission denied on /proc/net/rpc/nfsd, truncated or malformed stats content that procfs cannot parse, or an I/O error while reading the file.","commonSituations":"Enabling --collector.nfsd on hosts where the nfsd kernel module is loaded partially or /proc/net/rpc/nfsd is restricted by security policy; containers where only parts of /proc/net/rpc are exposed; kernel version whose nfsd stats format is not supported by the bundled procfs version.","solutions":["Read the wrapped cause (%w) to identify whether it is permission, I/O, or parse related.","Confirm readability as the exporter's user: 'cat /proc/net/rpc/nfsd'.","Adjust container/LSM policy so /proc/net/rpc/nfsd is readable, or mount host /proc with the rpc subtree exposed.","On parse errors with newer kernels, upgrade node_exporter/procfs.","If the host genuinely has no nfsd, expect ErrNoData instead; this error means the file exists but is unreadable."],"exampleFix":"// before: SELinux denies read of /proc/net/rpc/nfsd\n// after: allow the exporter domain to read proc_net_rpc\n//   setsebool -P daemons_dump_core off  # example audit2allow flow:\n//   audit2allow -a -M node_exporter-proc-rpc && semodule -i node_exporter-proc-rpc.pp","handlingStrategy":"try-catch","validationCode":"// Go: precheck nfsd stats readability\nif f, err := os.Open(filepath.Join(*procPath, \"net/rpc/nfsd\")); err != nil {\n    log.Printf(\"nfsd stats not readable: %v\", err)\n} else {\n    f.Close()\n}","typeGuard":null,"tryCatchPattern":"// same pattern as nfs collector: skip not-exist, wrap the rest\nif errors.Is(err, os.ErrNotExist) {\n    return ErrNoData\n}\nreturn fmt.Errorf(\"failed to retrieve nfsd stats: %w\", err)","preventionTips":["Enable --collector.nfsd only on NFS servers that actually run nfsd.","Keep SELinux/AppArmor policies allowing the exporter to read /proc/net/rpc/nfsd.","Upgrade node_exporter/procfs when kernels change the nfsd stats format.","Monitor exporter scrape errors to catch persistent read failures early."],"tags":["linux","procfs","nfsd","collector"],"backgroundTag":"file-read-failed","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"}