I want to get a metric of the cpu usage of my docker-containers. Therefor I consume
/api/v2.0/summary/<container-name>?type=docker
The response looks like
{
"/docker/...": {
"timestamp": "2018-03-20T10:07:31.606821474Z",
"latest_usage": {
"cpu": 8,
"memory": 1769402368
}
}
}
My idea was to use the latest_usage.cpu
. But what is the unit of this field? Percent?
Is this field the right choice to monitor the cpu usage?
It's percentage.
From cAdvisor source code:
cpuRate := (latest.Cpu - previous.Cpu) * secondsToMilliSeconds / uint64(elapsed)
LatestUsage.cpu = cpuRate