hashicorp/nomad · warning

actual resource usage not present

Error message

actual resource usage not present

What it means

getHostResources builds the actual-usage portion of `nomad node status` output from api.HostStats, which is only populated when querying a live agent's local client stats endpoint. If hostStats is nil (stats unavailable, e.g. the node is down or the data came from a non-agent endpoint), it errors with "actual resource usage not present" instead of printing fabricated numbers.

Source

Thrown at command/node_status.go:1026

			mem += stats.ResourceUsage.MemoryStats.RSS
		}
	}

	resources := make([]string, 2)
	resources[0] = "CPU|Memory"
	resources[1] = fmt.Sprintf("%v/%d MHz|%v/%v",
		math.Floor(cpu),
		*total.CPU,
		humanize.IBytes(mem),
		humanize.IBytes(uint64(*total.MemoryMB*bytesPerMegabyte)))

	return resources, nil
}

// getHostResources returns the actual resource usage of the node.
func getHostResources(hostStats *api.HostStats, node *api.Node) ([]string, error) {
	if hostStats == nil {
		return nil, fmt.Errorf("actual resource usage not present")
	}
	var resources []string

	// calculate disk usage
	storageDevice := node.Attributes["unique.storage.volume"]
	var diskUsed, diskSize uint64
	var physical bool
	for _, disk := range hostStats.DiskStats {
		if disk.Device == storageDevice {
			diskUsed = disk.Used
			diskSize = disk.Size
			physical = true
		}
	}

	resources = make([]string, 2)
	resources[0] = "CPU|Memory|Disk"
	if physical {

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Check whether the node's Nomad agent is up and reachable (the error is informational about missing live stats).
  2. Run `nomad node status` from a network location that can reach the client HTTP API.
  3. Verify client config doesn't disable the stats endpoint and that `client.options`/telemetry settings are sane.
  4. Use `nomad node status -verbose`/allocation-level output for what is still available.

Example fix

// before (shell)
nomad node status dead-node-1   # agent down, no live stats
// after
systemctl status nomad          # restart client agent
nomad node status dead-node-1
Defensive patterns

Strategy: fallback

Validate before calling

// shell: only expect live stats if the client is reachable
agent_up=$(curl -fsS "http://$CLIENT:4646/v1/agent/health" >/dev/null 2>&1 && echo yes || echo no)
echo "live stats available: $agent_up"

Try / catch

// bash: degrade gracefully when stats are missing
if ! out=$(nomad node status "$ID" 2>&1); then
  case "$out" in
    *"actual resource usage not present"*) nomad node status -verbose "$ID" || true ;;
  esac
fi

Prevention

When it happens

Trigger: `nomad node status <id>` calls formatNode → getHostResources; if the Nodes().Stats call fails or was skipped (node down, unreachable client, stats endpoint disabled) the nil HostStats reaches getHostResources.

Common situations: Statusing a down or draining client whose agent cannot be reached; remote region query where only the server-side node record is available; client telemetry/stats collection disabled; firewall blocking the client's HTTP port.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/668bc2d78d035152. Report an issue: GitHub.