Ask Your Question
0

How to update REST API command for Gnocchi Client because of Ceilometer Deprecation?

asked 2018-07-31 11:25:51 -0500

zetret12 gravatar image

updated 2018-07-31 11:27:19 -0500

I was using the following command to get usage "total_vcpu" information from Ceilometer.

curl -s -1 -k -H "X-Auth-Token:$TOKEN" \ -X GET "http://localhost:8777/v2/meters/total_vcpu/statistics?q.field=timestamp&q.op=gt&q.value=$TIMESTAMP&aggregate.func=max&period=86400&q.field=project_id&q.value=$PROJECTID" 1>myOutput

After updating to OpenStack Queens, I get a Ceilometer client deprecated message asking me to use Gnocchi or Panko instead. Can someone help translate this so I can get the same result from Gnocchi? Thanks.

edit retag flag offensive close merge delete

Comments

There is no direct analogy to the Ceilometer statistics API. I suggest you review https://www.slideshare.net/GordonChun... for inspiration (it has a slide about statistics). There are also video presentations like https://www.youtube.com/watch?v=GF6RE....

Bernd Bausch gravatar imageBernd Bausch ( 2018-07-31 18:49:51 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-07-31 21:31:11 -0500

I hope this is indeed an answer. First, I am not sure what total_vcpus is. I don't find it in the list of ceilometer meters. Perhaps it's a derived meter that your cloud defines in pipeline.yaml.

Your query seems to retrieve the max value of total_vcpus for a certain project. It looks at 1 day worth of data, but seems to limit it to the time later than a certain timestamp (do these two limitations overlap?).

I built a similar Gnocchi query, based on the vcpus metric, on a Newton cloud:

$ openstack metric measures aggregation --aggregation max -m vcpus --resource-type instance --query project_id=55a05c4f3908490ca2419591837575ba --needed-overlap 0 --start 2018-07-31T06:19:00
+---------------------------+-------------+-------+
| timestamp                 | granularity | value |
+---------------------------+-------------+-------+
| 2018-07-31T06:00:00+00:00 |      3600.0 |   1.0 |
| 2018-07-31T07:00:00+00:00 |      3600.0 |   1.0 |
| 2018-07-31T08:00:00+00:00 |      3600.0 |   1.0 |
| 2018-07-31T09:00:00+00:00 |      3600.0 |   1.0 |
| 2018-07-31T10:00:00+00:00 |      3600.0 |   1.0 |
| 2018-08-01T02:00:00+00:00 |      3600.0 |   1.0 |
| 2018-07-31T06:19:00+00:00 |        60.0 |   1.0 |
| 2018-07-31T07:00:00+00:00 |        60.0 |   1.0 |
| 2018-07-31T07:14:00+00:00 |        60.0 |   1.0 |
| 2018-07-31T07:15:00+00:00 |        60.0 |   1.0 |
| 2018-07-31T07:36:00+00:00 |        60.0 |   1.0 |
| 2018-07-31T07:42:00+00:00 |        60.0 |   1.0 |
| 2018-07-31T08:00:00+00:00 |        60.0 |   1.0 |
| 2018-07-31T08:57:00+00:00 |        60.0 |   1.0 |
| 2018-07-31T09:00:00+00:00 |        60.0 |   1.0 |
| 2018-07-31T09:05:00+00:00 |        60.0 |   1.0 |
| 2018-07-31T09:12:00+00:00 |        60.0 |   1.0 |
| 2018-07-31T09:13:00+00:00 |        60.0 |   1.0 |
| 2018-07-31T09:23:00+00:00 |        60.0 |   1.0 |
| 2018-07-31T10:00:00+00:00 |        60.0 |   1.0 |
| 2018-08-01T02:04:00+00:00 |        60.0 |   1.0 |
+---------------------------+-------------+-------+

When I add the --timing option to the openstack client, I get

+----------------------------------------------------------------------------------------------------------------+----------+
| URL                                                                                                            |  Seconds |
+----------------------------------------------------------------------------------------------------------------+----------+
| GET http://192.168.1.222:5000/v3                                                                               | 0.011236 |
| POST http://192.168.1.222:5000/v3/auth/tokens                                                                  | 0.239108 |
| POST http://192.168.1.222:5000/v3/auth/tokens                                                                  | 0.253519 |
| POST http://192.168.1.222:8041/v1/aggregation/resource/instance/metric/vcpus?aggregation=max&needed_overlap=0. | 0.610239 |
| 0&refresh=False&start=2018-07-31T06%3A19%3A00                                                                  |          |
| Total                                                                                                          | 1.114102 |
+----------------------------------------------------------------------------------------------------------------+----------+

So, the API is curl -X POST http://$IP_ADDR:8041/v1/aggregation/resource/instance/metric/vcpus?aggregation=max&needed_overlap=0.0&refresh=False&start=2018-07-31T06%3A19%3A00. But where is the project ID?

The project ID, and any other elements of the filtering query, are provided in the HTTP request data like this:

{
  "=": {
    "project_id": "55a05c4f3908490ca2419591837575ba "
  }
}

Now, this is the old Gnocchi aggregation method, marked as deprecated. I have no experience with the newer dynamic aggregation feature of Gnocchi.

edit flag offensive delete link more

Comments

Thanks, Why POST request? Trying to GET the metrics for vcpu usage in a project or it could be memory in the project. Custom 'total_vcpus' metric defined in the Archive Policy, simply a mean of vcpu usage for a particular time period (granularity) - idea to take this and gen. billing report.

zetret12 gravatar imagezetret12 ( 2018-08-01 16:58:41 -0500 )edit

The filter query is submitted as data, not in the URL or a header. I guess this is to avoid limiting its size. Thus, POST is required.

To retrieve the measures for a single metric, you use a GET.

Bernd Bausch gravatar imageBernd Bausch ( 2018-08-01 22:04:12 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2018-07-31 11:25:51 -0500

Seen: 203 times

Last updated: Jul 31 '18