google / cadvisor

Analyzes resource usage and performance characteristics of running containers.
Other
17.15k stars 2.32k forks source link

Milicores consumed by container from cadvisor. #2633

Open SamratAmate opened 4 years ago

SamratAmate commented 4 years ago

@dashpole How do I get milicores used by containers inside docker stack at particular time from cadvisor? Which metrics query I should be using? My query is exactly the data that we see on cadvisor webUI. Capture

Note: cadvisor is running as a separate container outside of stack.

dashpole commented 4 years ago

I'm not sure what "inside stack" vs "outside stack" means. cAdvisor must be running on the machine with the other containers it is monitoring.

Are you looking for a different way to visualize the metrics other than the UI? I'm not quite sure what you are asking

SamratAmate commented 4 years ago

@dashpole Sorry I wasn't very clear at first. Let me try again.

Yes, cadvisor is running on same machine on which I have other containers whose performance I want to monitor. I am using prometheus to collect the data from cadvisor.

Now, what I want is to draw the charts on grafana/google-charts same as what we see on the docker webUI (as shown in above images). So, which metrics query I should use to get the milicores used by any container at/over specific time?

Do we have anything like below which will give me data I want: containercpumilicores_used?

dashpole commented 4 years ago

I believe the metric you want is container_cpu_usage_seconds_total, which is measured in core-seconds.

SamratAmate commented 4 years ago

So the value we get from container_cpu_usage_seconds_total can also be considered as number of milicores used?

I want to get milicores consumed at particular time.

dashpole commented 4 years ago

It is a cumulative metric, so you have to take a rate over two samples. That would give you cpu usage in cores. You can multiply by 1000 to get millicores if you'd like.