prometheus/node_exporter · warning

sysctl has no values

Error message

sysctl %s has no values

What it means

Validation guard in newMetrics for the sysctl collector: the sysctl named by s.name resolved successfully but contained zero values (empty int or string list), so no metrics can be built. Typically the kernel returns an empty multi-value sysctl, or the configured sysctl name points at a node that has no payload on this kernel.

Solutions

  1. Check the sysctl manually: `sysctl <name>` — if it is empty or not applicable, remove it from the collector's sysctl list.
  2. Verify the sysctl exists on this kernel version; use a platform-appropriate name.
  3. Report upstream if a standard sysctl legitimately returns zero values.

Example fix

// before
--collector.sysctl.include='net.ipv4.unused_empty'
// after
--collector.sysctl.include='net.ipv4.ip_forward'
Defensive patterns

Strategy: fallback

Validate before calling

data, _ := os.ReadFile(filepath.Join("/proc/sys", strings.ReplaceAll(name, ".", "/"))); if len(bytes.Fields(data)) == 0 { /* empty: skip */ }

Try / catch

if err != nil && strings.Contains(err.Error(), "has no values") { /* fall back to another metric or ignore */ }

Prevention

When it happens

Trigger: Reading a sysctl file that exists but is empty (e.g. some tunables expose empty content until written), producing len==0 from SysctlInts/SysctlStrings.

Common situations: Namespaced sysctls in containers that report empty values; driver-specific sysctls empty on this hardware.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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

Appendix: source

Thrown at collector/sysctl_linux.go:110

	)

	if s.numeric {
		values, err = c.fs.SysctlInts(s.name)
		if err != nil {
			return nil, fmt.Errorf("error obtaining sysctl info: %w", err)
		}
		length = len(values.([]int))
	} else {
		values, err = c.fs.SysctlStrings(s.name)
		if err != nil {
			return nil, fmt.Errorf("error obtaining sysctl info: %w", err)
		}
		length = len(values.([]string))
	}

	switch length {
	case 0:
		return nil, fmt.Errorf("sysctl %s has no values", s.name)
	case 1:
		if len(s.keys) > 0 {
			return nil, fmt.Errorf("sysctl %s has only one value, but expected %v", s.name, s.keys)
		}
		return []prometheus.Metric{s.newConstMetric(values)}, nil

	default:

		if len(s.keys) == 0 {
			return s.newIndexedMetrics(values), nil
		}

		if length != len(s.keys) {
			return nil, fmt.Errorf("sysctl %s has %d keys but only %d defined in f lag", s.name, length, len(s.keys))
		}

		return s.newMappedMetrics(values)
	}

View on GitHub (pinned to 17ddd77c59)