{"record":{"id":"ef91c9f0f707398b","repo":"prometheus/node_exporter","slug":"could-not-get-net-class-info-w-ef91c9","errorCode":null,"errorMessage":"could not get net class info: %w","messagePattern":"could not get net class info: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"collector/netclass_rtnl_linux.go","lineNumber":64,"sourceCode":"\t\t}\n\t\tc.logger.Info(\"ETHTOOL netlink interface unavailable, duplex and linkspeed are not scraped.\")\n\t} else {\n\t\tfor _, lm := range lms {\n\t\t\tif c.ignoredDevicesPattern.MatchString(lm.Interface.Name) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif lm.SpeedMegabits >= 0 {\n\t\t\t\tspeedBytes := uint64(lm.SpeedMegabits * 1000 * 1000 / 8)\n\t\t\t\tpushMetric(ch, c.getFieldDesc(\"speed_bytes\"), speedBytes, prometheus.GaugeValue, lm.Interface.Name)\n\t\t\t}\n\t\t\tlinkModes[lm.Interface.Name] = lm\n\t\t}\n\t}\n\n\t// Get most attributes from Netlink\n\tlMsgs, err := c.getNetClassInfoRTNL()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not get net class info: %w\", err)\n\t}\n\n\trelevantLinks := make([]rtnetlink.LinkMessage, 0, len(lMsgs))\n\tfor _, msg := range lMsgs {\n\t\tif !c.ignoredDevicesPattern.MatchString(msg.Attributes.Name) {\n\t\t\trelevantLinks = append(relevantLinks, msg)\n\t\t}\n\t}\n\n\t// Read sysfs for attributes that Netlink doesn't expose\n\tsysfsAttrs, err := getSysfsAttributes(relevantLinks)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not get sysfs device info: %w\", err)\n\t}\n\n\t// Parse all the info and update metrics\n\tfor _, msg := range relevantLinks {\n\t\tupDesc := prometheus.NewDesc(","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/prometheus/node_exporter/blob/17ddd77c59ba27e1508e9f7894b1e55b44d6aed3/collector/netclass_rtnl_linux.go#L46-L82","documentation":"After fetching link modes, the netclass collector calls getNetClassInfoRTNL(), which performs an rtnetlink dump of all interfaces (RTM_GETLINK). Any failure there — socket creation, dump request, or message parsing — is wrapped as 'could not get net class info' and aborts the netclass Update entirely, since most attributes come from this netlink dump.","triggerScenarios":"getNetClassInfoRTNL() errors: rtnetlink socket open fails (no CAP_NET_ADMIN not required for dump, but seccomp can block socket(AF_NETLINK, NETLINK_ROUTE)), the RTM_GETLINK dump send/receive fails, or rtnetlink.LinkMessages parsing fails on malformed kernel responses.","commonSituations":"Containers with restricted netlink permissions; kernel/network namespace oddities in restricted VPS environments; procfs/sysfs not mounted so attribute assembly fails downstream; syscall exhaustion (fd limits) in very long-running processes.","solutions":["Check that /proc and /sys are mounted in the container (node_exporter requires them) and that socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE) is permitted by the sandbox.","Run `ip link show` in the same environment to confirm rtnetlink works at all; if it does, upgrade node_exporter to pick up rtnetlink library fixes.","Check process fd limits (ulimit -n) if the exporter has been running a long time.","Inspect the wrapped inner error (%w) in logs — it names the exact syscall that failed.","If only netclass fails while other collectors work, test with --collector.netclass in a privileged container to isolate permission issues."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// sanity check before scraping: rtnetlink dump must work\nconn, err := rtnetlink.Dial(nil)\nif err != nil { /* netclass will fail */ }\nelse { _, err = conn.Link.List(); if err != nil { /* abort early */ } }","typeGuard":null,"tryCatchPattern":"err := collector.Update(ch)\nif err != nil && strings.Contains(err.Error(), \"could not get net class info\") {\n\tlogger.Warn(\"netclass scrape failed\", \"cause\", err)\n\treturn // drop this scrape, keep exporter alive\n}","preventionTips":["Mount /proc and /sys in containers and allow NETLINK_ROUTE sockets","Monitor scrape_error metric per collector to catch recurring rtnetlink failures","Check fd limits on long-running exporter processes","Test `ip link show` in the same namespace as the exporter"],"tags":["linux","netlink","rtnetlink","network"],"backgroundTag":"network-request-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"}