How to create a meter using Ceilometer API

asked 2014-08-20 21:14:09 -0500

fukuda-yuko gravatar image

updated 2014-08-22 16:26:52 -0500

smaffulli gravatar image

I want to create a meter using ceilometer API, and have read through the API documentation, but I'm not clear on how to write my curl statement.

What I want to do is to make a meter for cpu_util of an instance(VM) This is my try, and it does not work. I couldn't figure out how to write the json request from the information supplied in the API docs. I'm not sure if I'm supposed to specify it as a "meter" or a "sample".

 curl -i http://.../v2/meters/myMeter -X GET -H "X-Auth-Project-Id: admin" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: $TOKEN" -d '{"sample":{"user_id": null, "name": "cpu_util", "resource_id": (Server ID), "source": "openstack", "project_id": (my project ID), "type": "gauge", "unit": "instance"}}'

Help/advice is greatly appreciated, thanks in advance.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-09-11 11:03:57 -0500

gagarinq9 gravatar image

Hi, to create custom metric you must make a POSt request like that:

curl -X POST -H 'X-Auth-Token: TOKEN' -H 'Content-Type: application/json'   -d '[{"counter_name": "test","user_id": "admin_user_id","resource_id": "Virtual_machine_ID","resource_metadata": {"display_name": "my_test","my_custom_metadata_1": "value1","my_custom_metadata_2": "value2"},"counter_unit": "%","counter_volume": 10.57762938230384,"project_id": "VM_tenant_ID","counter_type": "gauge"}]'  http://controller:8777/v2/meters/test
edit flag offensive delete link more



thanks for the answer, this resolved my issue as well.

9lives gravatar image9lives ( 2014-09-16 22:54:28 -0500 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2014-08-20 21:14:09 -0500

Seen: 612 times

Last updated: Aug 22 '14