The openstack_dashboard.api.ceilometer ModuleΒΆ

class openstack_dashboard.api.ceilometer.Alarm(apiresource, ceilometer_usage=None)[source]

Bases: openstack_dashboard.api.base.APIResourceWrapper

Represents one Ceilometer alarm.

id[source]
tenant[source]
user[source]
class openstack_dashboard.api.ceilometer.CeilometerUsage(request)[source]

Bases: object

Represents wrapper of any Ceilometer queries.

One instance of this class should be shared between resources as this class provides a place where users and tenants are cached. So there are no duplicate queries to API.

This class also wraps Ceilometer API calls and provides parallel HTTP calls to API.

This class should also serve as reasonable abstraction, that will cover huge amount of optimization due to optimization of Ceilometer service, without changing of the interface.

get_tenant(tenant_id)[source]

Returns tenant fetched from API.

Caching the result, so it doesn’t contact API twice with the same query.

get_user(user_id)[source]

Returns user fetched from API.

Caching the result, so it doesn’t contact API twice with the same query.

global_data_get(used_cls=None, query=None, with_statistics=False, additional_query=None, with_users_and_tenants=True)[source]

Obtaining a resources for table view.

It obtains resources with statistics data according to declaration in used_cls class.

Parameters:
  • user_cls: Class wrapper for usage data. It acts as wrapper for
    settings needed. See the call of this method for details.
  • query: Explicit query definition for fetching the resources. If
    no query is provided, it takes a default_query from used_cls. If no default query is provided, it fetches all the resources and filters them by meters defined in used_cls.
  • with_statistic: Define whether statistics data from the meters
    defined in used_cls should be fetched. Can be used to first obtain only the pure resources, then with the statistics data by AJAX.
  • additional_query: Additional query for the statistics.
    E.g. timespan, etc.
  • with_users_and_tenants: If true a user and a tenant object will
    be added to each resource object.
preload_all_tenants()[source]

Preloads all tenants into dictionary.

It’s more effective to preload all tenants, rather than fetching each tenant by separate API get calls.

preload_all_users()[source]

Preloads all users into dictionary.

It’s more effective to preload all users, rather than fetching many users by separate API get calls.

query_from_object_id(object_id)[source]

Obtaining a query from resource id.

Query can be then used to identify a resource in resources or meters API calls. ID is being built in the Resource initializer, or returned by Datatable into UpdateRow functionality.

resource_aggregates(queries=None)[source]

Obtaining resource aggregates with queries.

Representing a resource aggregate by query is a most general way how to obtain a resource aggregates.

Parameters:
  • queries: Dictionary of named queries that defines a bulk of
    resource aggregates.
resource_aggregates_with_statistics(queries=None, meter_names=None, period=None, filter_func=None, stats_attr=None, additional_query=None)[source]

Obtaining resource aggregates with statistics data inside.

Parameters:
  • queries: Dictionary of named queries that defines a bulk of
    resource aggregates.
  • meter_names: List of meter names of which we want the
    statistics.
  • period: 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.
  • stats_attr: String representing the specific name of the stats.
    E.g. (avg, max, min...) If defined, meter attribute will contain just the one value. If None is given, meter attribute will contain the whole Statistic object.
  • additional_query: Additional query for the statistics.
    E.g. timespan, etc.
resources(query=None, filter_func=None, with_users_and_tenants=False)[source]

Obtaining resources with the query or filter_func.

Obtains resources and also fetch tenants and users associated with those resources if with_users_and_tenants flag is true.

Parameters:
  • query: Query for fetching the Ceilometer Resources.
  • filter_func: Callable for filtering of the obtained
    resources.
  • with_users_and_tenants: If true a user and a tenant object will
    be added to each resource object.
resources_with_statistics(query=None, meter_names=None, period=None, filter_func=None, stats_attr=None, additional_query=None, with_users_and_tenants=False)[source]

Obtaining resources with statistics data inside.

Parameters:
  • query: Query for fetching the Ceilometer Resources.
  • filter_func: Callable for filtering of the obtained
    resources.
  • meter_names: List of meter names of which we want the
    statistics.
  • period: 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.
  • stats_attr: String representing the specific name of the stats.
    E.g. (avg, max, min...) If defined, meter attribute will contain just the one value. If None is given, meter attribute will contain the whole Statistic object.
  • additional_query: Additional query for the statistics.
    E.g. timespan, etc.
  • with_users_and_tenants: If true a user and a tenant object will
    be added to each resource object.
update_with_statistics(resource, meter_names=None, period=None, stats_attr=None, additional_query=None)[source]

Adding statistical data into one Resource or ResourceAggregate.

It adds each statistic of each meter_names into the resource attributes. Attribute name is the meter name with replaced ‘.’ to ‘_’.

Parameters:
  • resource: Resource or ResourceAggregate object, that will
    be filled by statistic data.
  • meter_names: List of meter names of which we want the
    statistics.
  • period: In seconds. If no period is given, only one aggregate
    statistic is returned. If given a faceted result will be returned, dividend into given periods. Periods with no data are ignored.
  • stats_attr: String representing the specific name of the stats.
    E.g. (avg, max, min...) If defined, meter attribute will contain just the one value. If None is given, meter attribute will contain the whole Statistic object.
  • additional_query: Additional query for the statistics.
    E.g. timespan, etc.
class openstack_dashboard.api.ceilometer.Meter(apiresource)[source]

Bases: openstack_dashboard.api.base.APIResourceWrapper

Represents one Ceilometer meter.

augment(label=None, description=None)[source]
description[source]
label[source]
class openstack_dashboard.api.ceilometer.Meters(request=None, ceilometer_meter_list=None)[source]

Bases: object

Class for listing of available meters.

It is listing meters defined in this class that are available in Ceilometer meter_list.

It is storing information that is not available in Ceilometer, i.e. label, description.

list_all(only_meters=None, except_meters=None)[source]

Returns a list of meters based on the meters names.

Parameters:
  • only_meters: The list of meter names we want to show.
  • except_meters: The list of meter names we don’t want to show.
list_cinder(except_meters=None)[source]

Returns a list of meters tied to cinder.

Parameters:
  • except_meters: The list of meter names we don’t want to show.
list_glance(except_meters=None)[source]

Returns a list of meters tied to glance.

Parameters:
  • except_meters: The list of meter names we don’t want to show.
list_ipmi(except_meters=None)[source]

Returns a list of meters tied to ipmi

Parameters:
  • except_meters: The list of meter names we don’t want to show
list_kwapi(except_meters=None)[source]

Returns a list of meters tied to kwapi.

Parameters:
  • except_meters: The list of meter names we don’t want to show.
list_neutron(except_meters=None)[source]

Returns a list of meters tied to neutron.

Parameters:
  • except_meters: The list of meter names we don’t want to show.
list_nova(except_meters=None)[source]

Returns a list of meters tied to nova.

Parameters:
  • except_meters: The list of meter names we don’t want to show.
list_swift(except_meters=None)[source]

Returns a list of meters tied to swift.

Parameters:
  • except_meters: The list of meter names we don’t want to show.
class openstack_dashboard.api.ceilometer.Resource(apiresource, ceilometer_usage=None)[source]

Bases: openstack_dashboard.api.base.APIResourceWrapper

Represents one Ceilometer resource.

get_meter(meter_name)[source]
id[source]
meters[source]
name[source]
query[source]
resource[source]
set_meter(meter_name, value)[source]
tenant[source]
user[source]
class openstack_dashboard.api.ceilometer.ResourceAggregate(tenant_id=None, user_id=None, resource_id=None, tenant_ids=None, user_ids=None, resource_ids=None, ceilometer_usage=None, query=None, identifier=None)[source]

Bases: openstack_dashboard.api.ceilometer.Resource

Represents aggregate of more resources together.

Aggregate of resources can be obtained by specifying multiple ids in one parameter or by not specifying one parameter. It can also be specified by query directly.

Example:
We can obtain an aggregate of resources by specifying multiple resource_ids in resource_id parameter in init. Or we can specify only tenant_id, which will return all resources of that tenant.
id[source]
class openstack_dashboard.api.ceilometer.Sample(apiresource)[source]

Bases: openstack_dashboard.api.base.APIResourceWrapper

Represents one Ceilometer sample.

instance[source]
name[source]
class openstack_dashboard.api.ceilometer.Statistic(apiresource)[source]

Bases: openstack_dashboard.api.base.APIResourceWrapper

Represents one Ceilometer statistic.

class openstack_dashboard.api.ceilometer.ThreadedUpdateResourceWithStatistics(resource_usage, resource, meter_names=None, period=None, filter_func=None, stats_attr=None, additional_query=None)[source]

Bases: threading.Thread

Multithread wrapper for update_with_statistics method of resource_usage.

A join logic is placed in process_list class method. All resources will have its statistics attribute filled in separate threads.

The resource_usage object is shared between threads. Each thread is updating one Resource.

Parameters:
  • resource: Resource or ResourceAggregate object, that will
    be filled by statistic data.
  • resources: List of Resource or ResourceAggregate object,
    that will be filled by statistic data.
  • resource_usage: Wrapping resource usage object, that holds
    all statistics data.
  • meter_names: List of meter names of the statistics we want.
  • period: 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.
  • stats_attr: String representing the attribute name of the stats.
    E.g. (avg, max, min...) If None is given, whole statistic object is returned,
  • additional_query: Additional query for the statistics.
    E.g. timespan, etc.
classmethod process_list(resource_usage, resources, meter_names=None, period=None, filter_func=None, stats_attr=None, additional_query=None)[source]
run()[source]
openstack_dashboard.api.ceilometer.alarm_create(request, ceilometer_usage=None, **kwargs)[source]

Create an alarm.

openstack_dashboard.api.ceilometer.alarm_delete(request, alarm_id)[source]

Delete an alarm.

openstack_dashboard.api.ceilometer.alarm_get(request, alarm_id, ceilometer_usage=None)[source]

Get an alarm.

openstack_dashboard.api.ceilometer.alarm_list(request, query=None, ceilometer_usage=None)[source]

List alarms.

openstack_dashboard.api.ceilometer.alarm_update(request, alarm_id, ceilometer_usage=None, **kwargs)[source]

Update an alarm.

openstack_dashboard.api.ceilometer.ceilometerclient(*args, **kwargs)[source]

Initialization of Ceilometer client.

openstack_dashboard.api.ceilometer.diff_lists(a, b)[source]
openstack_dashboard.api.ceilometer.is_iterable(var)[source]

Return True if the given is list or tuple.

openstack_dashboard.api.ceilometer.make_query(user_id=None, tenant_id=None, resource_id=None, user_ids=None, tenant_ids=None, resource_ids=None)[source]

Returns query built from given parameters.

This query can be then used for querying resources, meters and statistics.

Parameters:
  • user_id: user_id, has a priority over list of ids
  • tenant_id: tenant_id, has a priority over list of ids
  • resource_id: resource_id, has a priority over list of ids
  • user_ids: list of user_ids
  • tenant_ids: list of tenant_ids
  • resource_ids: list of resource_ids
openstack_dashboard.api.ceilometer.meter_list(request, query=None)[source]

List the user’s meters.

openstack_dashboard.api.ceilometer.resource_list(request, query=None, ceilometer_usage_object=None)[source]

List the resources.

openstack_dashboard.api.ceilometer.sample_list(request, meter_name, query=None, limit=None)[source]

List the samples for this meters.

openstack_dashboard.api.ceilometer.statistic_list(request, meter_name, query=None, period=None)[source]

List of statistics.

Previous topic

The openstack_dashboard.api.lbaas Module

Next topic

The openstack_dashboard.api.network Module

Project Source

This Page