Files
deb-python-ceilometerclient/doc/source/api.rst
gordon chung cba4f4b7d3 drop v1 client
we dropped v1 back in Juno. as icehouse is EOL and the client
follows stable/branches, v1 is completely inaccessible and can be
removed

Change-Id: If4c6c07e65a6c47f47c59de6c99e8c40ef4e63cb
Co-Authored-By: ZhiQiang Fan <aji.zqfan@gmail.com>
Closes-Bug: #1389331
2015-10-21 07:55:06 -04:00

1.2 KiB

The ceilometerclient Python API

ceilometerclient

ceilometerclient

Usage

First create a client instance with your credentials:

>>> import ceilometerclient.client
>>> cclient = ceilometerclient.client.get_client(VERSION, os_username=USERNAME, os_password=PASSWORD, os_tenant_name=PROJECT_NAME, os_auth_url=AUTH_URL)

Here VERSION should be: 2.

Then call methods on its managers:

>>> cclient.meters.list()
[<Meter ...>, ...]

>>> cclient.new_samples.list()
[<Sample ...>, ...]

V2 client tips

Use queries to narrow your search (more info at Ceilometer V2 API reference):

>>> query = [dict(field='resource_id', op='eq', value='5a301761-f78b-46e2-8900-8b4f6fe6675a'), dict(field='meter',op='eq',value='cpu_util')]
>>> cclient.new_samples.list(q=query, limit=10)
[<Sample ...>, ...]

Reference

For more information, see the reference:

ref/index ref/v2/index