Skip to content

Commit

Permalink
Backport of cli: for systems with cgroups v2, fix alloation resource …
Browse files Browse the repository at this point in the history
…utilization showing 0 memory used into release/1.3.x (#14266)

This pull request was automerged via backport-assistant
  • Loading branch information
hc-github-team-nomad-core committed Aug 23, 2022
1 parent 21d5267 commit 32ad0d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .changelog/14069.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
cli: Fixed a bug where the memory usage reported by Allocation Resource Utilization is zero on systems using cgroups v2
```
6 changes: 5 additions & 1 deletion command/node_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,11 @@ func getActualResources(client *api.Client, runningAllocs []*api.Allocation, nod
}

cpu += stats.ResourceUsage.CpuStats.TotalTicks
mem += stats.ResourceUsage.MemoryStats.RSS
if stats.ResourceUsage.MemoryStats.Usage > 0 {
mem += stats.ResourceUsage.MemoryStats.Usage
} else {
mem += stats.ResourceUsage.MemoryStats.RSS
}
}

resources := make([]string, 2)
Expand Down

0 comments on commit 32ad0d9

Please sign in to comment.