The watcher.common.ceilometer_helper Module

class watcher.common.ceilometer_helper.CeilometerHelper(osc=None)[source]

Bases: object

build_query(user_id=None, tenant_id=None, resource_id=None, user_ids=None, tenant_ids=None, resource_ids=None, start_time=None, end_time=None)[source]

Returns query built from given parameters.

This query can be then used for querying resources, meters and statistics. :param user_id: user_id, has a priority over list of ids :param tenant_id: tenant_id, has a priority over list of ids :param resource_id: resource_id, has a priority over list of ids :param user_ids: list of user_ids :param tenant_ids: list of tenant_ids :param resource_ids: list of resource_ids :param start_time: datetime from which measurements should be collected :param end_time: datetime until which measurements should be collected

get_last_sample_value(resource_id, meter_name)[source]
get_last_sample_values(resource_id, meter_name, limit=1)[source]
meter_list(query=None)[source]

List the user’s meters.

query_retry(f, *args, **kargs)[source]
query_sample(meter_name, query, limit=1)[source]
statistic_aggregation(resource_id, meter_name, period, aggregate='avg')[source]

Representing a statistic aggregate by operators

Parameters:
  • resource_id – id
  • meter_name – meter names of which we want the statistics
  • periodperiod: In seconds. If no period is given, only one aggregate statistic is returned. If given, a faceted result will be returned, divided into given periods. Periods with no data are ignored.
  • aggregate
Returns:

statistic_list(meter_name, query=None, period=None)[source]

List of statistics.