get CPU Usage in cores

2,868 views
Skip to first unread message

Darshil Saraiya

unread,
Aug 10, 2017, 12:33:09 AM8/10/17
to Prometheus Users
I want to get CPU usage in cores. I searched the metrics that prometheus provides. Here is the list of cpu metrics:

cluster:cpu_allocation:percent
cluster:node_cpu_use:percent
cluster_namespace_controller_pod_container:cpu_usage:rate
cluster_namespace_controller_pod_container:spec_cpu_shares
container_cpu_cfs_periods_total
container_cpu_cfs_throttled_periods_total
container_cpu_cfs_throttled_seconds_total
container_cpu_system_seconds_total
container_cpu_usage_seconds_total
container_cpu_user_seconds_total
container_spec_cpu_period
container_spec_cpu_quota
container_spec_cpu_shares
go_memstats_gc_cpu_fraction
kube_node_status_allocatable_cpu_cores
kube_node_status_capacity_cpu_cores
kube_pod_container_resource_limits_cpu_cores
kube_pod_container_resource_requests_cpu_cores
machine_cpu_cores
node_cpu
process_cpu_seconds_total

I can not get CPU usage in cores.

Brian Brazil

unread,
Aug 10, 2017, 3:31:43 AM8/10/17
to Darshil Saraiya, Prometheus Users
These two are usage in cores.

Brian
 

I can not get CPU usage in cores.

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/c116492a-1fff-4122-b68a-a0294866efb2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Matthias Rampke

unread,
Aug 10, 2017, 3:35:20 AM8/10/17
to Darshil Saraiya, Prometheus Users

You want something like

rate(container_cpu_usage_seconds_total[5m])

The X_seconds_total metrics "count" the time spent executing since the container was created. A container using 53% of a core is executing 530ms out of every second, so the counter increases at 0.53 seconds per second, and the rate function calculates exactly that.

See this page

https://prometheus.io/docs/querying/examples/

for more examples.

/MR


--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To post to this group, send email to promethe...@googlegroups.com.

piaoy...@gmail.com

unread,
Jul 25, 2018, 5:09:01 AM7/25/18
to Prometheus Users

I find that  promethues that rate(container_cpu_cfs_throttled_seconds_total[1m]) > 1  ,Theoretically it can’t be > 1? is it  container_cpu_cfs_throttled for all cpu ?

在 2017年8月10日星期四 UTC+8下午3:35:20,Matthias Rampke写道:
Reply all
Reply to author
Forward
0 new messages