Files
deb-python-ceilometerclient/doc/source/api.rst
Hangdong Zhang a5f1795869 Update and optimize documentation links
1. Update URLs according to document migration
2. Update the dead and outdated links
3. Optimize (e.g. http -> https)

Change-Id: Ic847deff2b8344a35a31b76edc63296b01bde64c
2017-07-18 17:44:29 +08: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