Package Products :: Package ZenReports :: Module AliasPlugin :: Class AliasPlugin
[hide private]
[frames] | no frames]

Class AliasPlugin

source code

object --+
         |
        AliasPlugin

A base class for performance report plugins that use aliases to choose datapoints

Instance Methods [hide private]
 
_getComponents(self, device, componentPath) source code
 
getColumns(self)
Return the mapping of aliases to column names.
source code
 
getCompositeColumns(self)
Return columns that will be evaluated in order and have access to the previous column values.
source code
 
getComponentPath(self)
If the rows in the report represent components, this is how to get from a device to the appropriate components.
source code
 
_createRecord(self, device, component=None, columnDatapointsMap={}, summary={})
Creates a record for the given row context (that is, the device and/or component)
source code
 
_mapColumnsToDatapoints(self, dmd)
Create a map of columns->alias/datapoint pairs.
source code
 
run(self, dmd, args)
Generate the report using the columns and aliases
source code
Method Details [hide private]

getColumns(self)

source code 

Return the mapping of aliases to column names. This should be one to one. This is unimplemented in the base class.

This is meant to be overridden.

getCompositeColumns(self)

source code 

Return columns that will be evaluated in order and have access to
the previous column values.  TalesColumnHandlers will have the previous
column values for this row in their context.

For example, if one column named 'cpuIdle' evaluates to .36,
a composite column named 'cpuUtilized' can be created with
a TalesColumnHandler with the expression '1 - cpuIdle'.

NOTE: These cannot be RRD columns (or rather, RRD columns will fail
      because no datapoints will be passed to them)

This is meant to be overridden (if needed).

getComponentPath(self)

source code 

If the rows in the report represent components, this is how to get from a device to the appropriate components.

This is meant to be overridden for component reports.

_createRecord(self, device, component=None, columnDatapointsMap={}, summary={})

source code 

Creates a record for the given row context
(that is, the device and/or component)

@param device: the device for this row
@param component: the (optional) component for this row
@param columnDatapointsMap: a dict of Column objects to
                            alias-datapoint pairs.  The first
                            datapoint that gives a value for
                            the context will be used.
@param summary: a dict of report parameters like start date,
                end date, and rrd summary function
@rtype L{Utils.Record}

_mapColumnsToDatapoints(self, dmd)

source code 

Create a map of columns->alias/datapoint pairs. For each column we need both the datapoint/alias-- the datapoint to retrieve the rrd data and the alias to execute the alias formula to transform that data (to get the correct units).

Non-perf columns will be mapped to None

run(self, dmd, args)

source code 

Generate the report using the columns and aliases

@param dmd the dmd context to access the context objects @param args the report args from the ui

@rtype a list of Utils.Records