Ask Your Question
1

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
ceilometer_client.alarms.list()

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
1

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():
    print(alarm.name)
    print(alarm.id)

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

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: 2014-11-25 06:41:41 -0500

Seen: 191 times

Last updated: Nov 28 '14