{"record":{"id":"a170febda6d857d3","repo":"prometheus/node_exporter","slug":"getdevs-failed","errorCode":null,"errorMessage":"getdevs() failed","messagePattern":"getdevs\\(\\) failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/devstat_dragonfly.go","lineNumber":132,"sourceCode":"\t\t),\n\t\ttransfersDesc: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, devstatSubsystem, \"transfers_total\"),\n\t\t\t\"The total number of transactions completed.\",\n\t\t\t[]string{\"device\"}, nil,\n\t\t),\n\t\tblocksDesc: prometheus.NewDesc(\n\t\t\tprometheus.BuildFQName(namespace, devstatSubsystem, \"blocks_total\"),\n\t\t\t\"The total number of bytes given in terms of the devices blocksize.\",\n\t\t\t[]string{\"device\"}, nil,\n\t\t),\n\t\tlogger: logger,\n\t}, nil\n}\n\nfunc (c *devstatCollector) Update(ch chan<- prometheus.Metric) error {\n\tcount := C._get_ndevs()\n\tif count == -1 {\n\t\treturn errors.New(\"getdevs() failed\")\n\t}\n\tif count == -2 {\n\t\treturn errors.New(\"calloc() failed\")\n\t}\n\n\tfor i := C.int(0); i < count; i++ {\n\t\tstats := C._get_stats(i)\n\t\tdevice := fmt.Sprintf(\"%s%d\", C.GoString(&stats.device[0]), stats.unit)\n\n\t\tch <- prometheus.MustNewConstMetric(c.bytesDesc, prometheus.CounterValue, float64(stats.bytes), device)\n\t\tch <- prometheus.MustNewConstMetric(c.transfersDesc, prometheus.CounterValue, float64(stats.transfers), device)\n\t\tch <- prometheus.MustNewConstMetric(c.blocksDesc, prometheus.CounterValue, float64(stats.blocks), device)\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":114,"sourceCodeEnd":149,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/devstat_dragonfly.go#L114-L149","documentation":"In the DragonFly BSD devstat collector (devstat_dragonfly.go), Update calls C._get_ndevs() to count block devices via devstat_getdevs. A return of -1 means the underlying getdevs()/devstat_getdevs call failed, so the collector cannot enumerate disk statistics and returns this error.","triggerScenarios":"C._get_ndevs() == -1 in devstatCollector.Update — the C helper's devstat_getdevs or device-enumeration call returned failure, typically because the devstat device (/dev/devstat) cannot be opened or devstat_checkdevs fails.","commonSituations":"node_exporter run without permission to open /dev/devstat; running in a jail or container without device access; kernel without devstat support compiled/enabled.","solutions":["Ensure the node_exporter user can open /dev/devstat (adjust device permissions or run with adequate privileges)","Verify the kernel has DEVFS/devstat enabled ('devstat' sysctl or kern.devstat available)","Run outside restricted jails/containers, or bind-mount/devfs-rule the devstat device into it","Disable the diskstats/devstat collector on hosts where devstat is unavailable"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// shell pre-flight: exporter user must reach the devstat device\n[ -e /dev/devstat ] && [ -r /dev/devstat ] || echo \"devstat unavailable; devstat collector will fail\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Grant read access to /dev/devstat via devfs.rules before starting the exporter","Verify kernel devstat support (kern.devstat sysctl present) at deploy time","Avoid running inside jails that hide the devstat device, or provide device access","Prefer disabling the collector over letting every scrape fail"],"tags":["cgo","devstat","disk","dragonfly","bsd"],"backgroundTag":"system-call-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"}