[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

How to calculate Percentage CPU Usage



Hello
How are you?
I am running curl command with your help successfully.

Now I am going to calculate percentage CPU Usage. I have read this doc.
[https://github.com/openshift/origin-metrics/blob/master/docs/hawkular_metrics.adoc#calcuating-percentage-cpu-usage]

In this guide, How can I get 'cpu/usage' and 'uptime'.
I am running this command to get 'cpu/usage'.

curl -k -H "Authorization: Bearer iCm-Mglj1TvBPd_VoJesqoqIAbVM2psZcXrykyshBU"
        -H "Hawkular-tenant: sample" -X GET https://hawkular-metrics.example.com/hawkular/metrics/counters/data?tags=descriptor_name:cpu/usage,pod_namespace:openshift-infra\&buckets=1\&start=`date -d -10minutes +%s%3N`  | python -m json.tool

Result is [{'min': 555115703.0, 'samples': 120, 'end': 1458837494033, 'median': 1391865412.971584, 'avg': 26785974599.89168, 'max': 144149182129.0, 'start': 1458836895027, 'empty': False}].

so I think 'cpu/usage' is 'avg' value from this result. it this right?
After this, I calculated the percentage of a CPU core used with the following function.
%core = 'cpu/usage' / ('uptime' * 1000000)
I am getting 0.0005564113359207296 as core result. Is this right value?

Please give me a word of advice. I need your help.
Best Regards

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]