How to get CPU time used from Gnocchi data

asked 2020-06-10 04:13:53 -0500

ansen gravatar image

Hi All,

I'm new to OpenStack. Currently I'm exploring Ceilometer and Gnocchi to get some insights on how to develop billing system using those components. I'm exercising with a use case how to get data of hour rate an instance is active or running. After retrying some aggregation on Gnocchi data using cpu metric, I still don't know any idea on how to get running time of an instance. Could you please help me to shed some lights on this particular case?

I have used the following aggregation command to get the data from Gnocchi:

gnocchi aggregates '(/ (aggregate mean (metric cpu mean)) 60000000000.0)' id=resource_id

Below is sample of the resulted data:

+------------+---------------------------+-------------+---------------------+

| name | timestamp | granularity | value |

+------------+---------------------------+-------------+---------------------+

| aggregated | 2020-06-10T06:00:00+00:00 | 3600.0 | 0.4942387881648148 |

| aggregated | 2020-06-10T07:00:00+00:00 | 3600.0 | 0.6727368586180555 |

| aggregated | 2020-06-10T08:00:00+00:00 | 3600.0 | 0.7877714476719444 |

| aggregated | 2020-06-10T09:00:00+00:00 | 3600.0 | 0.8566431876348485 |

| aggregated | 2020-06-10T06:51:00+00:00 | 60.0 | 0.0012611098 |

| aggregated | 2020-06-10T06:52:00+00:00 | 60.0 | 0.2904633233166667 |

| aggregated | 2020-06-10T06:53:00+00:00 | 60.0 | 0.49465555418333335 |

Thanks in advance.

Ansen

edit retag flag offensive close merge delete