Ask Your Question

parse response from ceilometer client

asked 2014-11-25 06:41:41 -0500

chitranshi-shubham gravatar image

updated 2014-11-27 18:57:56 -0500

hello stackers,

I am using the python-ceilometerclient to retrieve statistics and alarm list using the method

ceilometer_client.statistics.list("meter-name", query) and

respectively, I am able to iterate through the list but i am not able to parse it into object or dictionary, is there a way to get it in dict, i have already written the template class for ceilometer alarm, i just need to store the data.

Also I checked the type of object I am getting in the list, its ceilometerclient.v2.alarms.Alarm I tried using method like get_name() or Name() or simply Name but non of them are getting me the value

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-11-27 20:26:09 -0500

chitranshi-shubham gravatar image

updated 2014-11-28 00:24:18 -0500

This question answers itself, but anyhow here is the answer.

when we call any list() method in python- ceilometerclient or any python binding for openstack for that matter, we get a list of object for that type. just iterate through the list and call variable directly upon the object (I am a java guy so I was expecting some getters and setters here), here is a small code snippet to explain.

ceilometer_client = Client(endpoint = self.get_endpoint(), token = self.get_token() )
for alarm in ceilometer_client.alarms.list():

also you may find issues while using ceilometerclient mostly due to the lack of docs, here is one of the issue I encountered.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2014-11-25 06:41:41 -0500

Seen: 239 times

Last updated: Nov 28 '14