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 of resource to list statistics for.
  • meter_name – Name of meter to list statistics for.
  • period – Period in seconds over which to group samples.
  • aggregate – Available aggregates are: count, cardinality, min, max, sum, stddev, avg. Defaults to avg.
Returns:

Return the latest statistical data, None if no data.

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

List of statistics.