From 8ba96f686e98dc592d13457cc4aa82e56e75a6f7 Mon Sep 17 00:00:00 2001 From: alisonjm Date: Wed, 8 Jun 2011 21:24:57 +0000 Subject: Added new documentation for rrdFilter.js, and updated all other documentation reflecting new changes in javascriptrrd, with major changes being the addition of RRDFilterShift and RRDRRAFilterAvg methods and extension to rrdflot_defaults options. --- doc/lib/index.html | 6 +- doc/lib/rrdFilter_js.html | 624 +++++++++++++++++++++++++++++++++++----------- doc/lib/rrdFlot_js.html | 36 ++- 3 files changed, 505 insertions(+), 161 deletions(-) diff --git a/doc/lib/index.html b/doc/lib/index.html index 3f8ae8b..3c7195c 100644 --- a/doc/lib/index.html +++ b/doc/lib/index.html @@ -31,19 +31,19 @@

Together they can be used to implement AJAX style applications.

-

The rrdFilter module can be used to filter datasources or apply user-customized filter object such as mathematical operations. +

The rrdFilter module can be used to filter datasources (DSs) and apply user-customized filter objects such as mathematical operations. This module also has methods to Filter RRAs for time shifts (for timezone implementation) and/or Averaging (for creating new, averaged RRAs with different step sizes). See the rrdJFlotFilter.html (DS Filters) example and the rrdJFlotFilterRRA (RRA Filters) example.

The package also provides two classes, based on JFlot, that automate most of the graphing needs:

diff --git a/doc/lib/rrdFilter_js.html b/doc/lib/rrdFilter_js.html index 50bad22..aa15673 100644 --- a/doc/lib/rrdFilter_js.html +++ b/doc/lib/rrdFilter_js.html @@ -38,20 +38,31 @@

Overview

-

The rrdFilter module is allows filters to be applied to DSs (datasources).

+

The rrdFilter module is allows filters to be applied to DSs (datasources) and RRA objects.

(These classes should have almost idential instantiations to their rrdFile module equivilents.)

-

Filters can either be a list of DSs to filter out (*FilterDS), or a user-created and customized filter object (*FilterOp - for example, mathematical functions like summing and averaging DSs). -

Clases included in this module: -

+

For DSs, filters can either be a list of DSs to filter out (*FilterDS), or a user-created and customized filter object (*FilterOp - for example, mathematical functions like summing and averaging DSs). +

THese classes are: +

+ +

For RRAs, two things can be done - An RRA can be shifted by any number of seconds (for timezone selection, for instance) [RRDFilterShift], or any number of new RRAs can be created (based on other RRAs) with their data averaged [RRDRRAFilterAvg]. See individual classes for details. +

These classes are: +

-

Class RRDRRAFilterDS

-

This class filters out a subset of DSs from an RRA identified by index or name.

-

The constructor has two arguments: rrd_rra (the RRA) and ds_list (the list of DSs to filter).

+

Internal classes for Developers, Listed at the End:

+
  • RRDRRAFilterDS +
  • RRDRRAFilterOp +
  • RRDDSFilterOp +
  • RRAFilterAvg +
  • RRAInfoFilterAvg. +
    +

    Main Classes:

    +
    +

    RRD Filter Classes:

    +

    Class RRDFilterDS

    +

    This class filters out a subset of DSs from an RRD identified by index or name.

    This class implements the following methods:

    @@ -67,69 +78,116 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    -

    getIdx()

    -
    -

    Return which RRA it is in the RRD file.

    -
    -

    getNrRows()

    -
    -

    Return the number of rows in the RRA.

    -
    -

    getNrDSs()

    -
    -

    Return the number of DSs in the RRD file.

    -
    -

    getStep()

    -
    -

    Return the number of seconds between rows.

    -
    -

    getCFName()

    -
    -

    Return the Consolidation - Function used by the RRA.

    -
    -

    getEl(r,d)

    -
    -

    Return the value for the d-th DS in the r-th row.

    -
    -

    getElFast(r,d)

    -
    -

    Return the low-precision value for the d-th DS in the r-th row.

    -
    +

    getMinSteps()

    +
    +

    Return the base interval + in seconds that was used to feed the RRD file.

    +
    +

    getLastUpdate()

    +
    +

    Return the timestamp of the last + update.

    +
    +

    getNrDSs()

    +
    +

    Return the number of Data + Sources present in the RRD file. +

    +
    +

    getDSNames()

    +
    +

    Return the names of the Data + Sources present in the RRD file. +

    +
    +

    getDS(id)

    +
    +

    If id is a number, return an object of type RRDDS holding + the information about the id-th Data + Source.

    +

    If id is a string, return an object of type RRDDS holding + the information about the Data + Source with the requested name.

    +
    +

    getNrRRAs()

    +
    +

    Return the number of Round + Robin Archives present in the RRD file.

    +
    +

    getRRAInfo(n)

    +
    +

    Return an object of type RRDRRAInfo + holding the information about the n-th Round + Robin Archive.

    +
    +

    getRRA(n)

    +
    +

    Return an object of type RRDRRA that + can be used to access the values stored in the n-th Round + Robin Archive.

    +
    -

    Class RRDFilterDS

    -

    This class filters out a subset of DSs from an RRD identified by index or name.

    +

    +

    Class RRDFilterOp

    +

    This class filters all of the DSs in an RRD by a list of filter objects. +

    + The filter object must implement the following interface
    +   getName()               - Symbolic name give to this function
    +   getDSName()             - list of DSs used in computing the result (names or indexes)
    +   computeResult(val_list) - val_list contains the values of the requested DSs (in the same order) 
    +
    + Example classes that implement the interface:
    +   function DoNothing(ds_name) { //Leaves the DS alone.
    +     this.getName = function() {return ds_name;}
    +     this.getDSNames = function() {return [ds1_name];}
    +     this.computeResult = function(val_list) {return val_list[0];}
    +   }
    +   function sumDS(ds1_name,ds2_name) { //Sums the two DSs.
    +     this.getName = function() {return ds1_name+"+"+ds2_name;}
    +     this.getDSNames = function() {return [ds1_name,ds2_name];}
    +     this.computeResult = function(val_list) {return val_list[0]+val_list[1];}
    +   }
    +
    + Lets say you have 2 DSs. To add a summed DS of DS1 and DS2: 
    + var ds0_name = rrd_data.getDS(0).getName();
    + var ds1_name = rrd_data.getDS(1).getName();
    + rrd_data = new RRDFilterOp(rrd_data, [new DoNothing(ds0_name), 
    +                     DoNothing(ds1_name), sumDS(ds0_name, ds1_name]);
    +
    +

    Its arguments are: rrd_file and op_obj_list (list of ds filters).

    This class implements the following methods:

    @@ -226,24 +284,17 @@
    -
    + +
    -

    Class RRDDSFilterOp

    -

    This class filters DSs from an RRD by using a user-provided filter object.

    -

    This object must implement the following interface:

    - -

    For example, a summing function:

    - -

    This class has three arguments: rrd_file, op_object (the filter object) and my_idx (index of new DS in case old one was modified by a filter). +

    RRA Filters:

    +

    Class RRAFilterShift

    +

    This class creates new, time-shifted RRAs. Originally developed for timezone shifting. +

    Arguments: +

    +

    This class implements the following methods:

    @@ -262,70 +313,221 @@ - + + + + - +
    -

    getIdx()

    +

    getMinSteps()

    -

    Return which DS it is in the RRD file.

    +

    Return the base interval + in seconds that was used to feed the RRD file.

    -

    getName()

    +

    getLastUpdate()

    -

    Return the name of the data source.

    +

    Return the timestamp of the last + update.

    -

    getType()

    +

    getNrDSs()

    -

    Return the type - of the data source.

    +

    Return the number of Data + Sources present in the RRD file. +

    -

    getMin()

    +

    getDSNames()

    -

    Return the minimum and maximum value the data source can - contain. +

    +

    Return the names of the Data + Sources present in the RRD file.

    -

    If either is not defined, undefined is returned.

    +
    +

    getDS(id)

    +
    +

    If id is a number, return an object of type RRDDS holding + the information about the id-th Data + Source.

    +

    If id is a string, return an object of type RRDDS holding + the information about the Data + Source with the requested name.

    -

    getMax()

    +

    getNrRRAs()

    +
    +

    Return the number of Round + Robin Archives present in the RRD file.

    -

    getRealDSList()

    +

    getRRAInfo(n)

    -

    Returns which DSs is being used in the Filter.

    +

    Return an object of type RRDRRAInfo + holding the information about the n-th Round + Robin Archive.

    -

    ComputeResult()

    +

    getRRA(n)

    -

    Return the computed result of the filter object on the DSs.

    +

    Return an object of type RRDRRA that + can be used to access the values stored in the n-th Round + Robin Archive.

    +
    +
    +

    Class RRDRRAFilterAvg

    +

    This class creates new RRAs (based on original RRAs in the RRD File) that have different time steps. This is useful for creating new RRA graphs with different time steps without actually creating and filling new RRAs. +

    Arguments: +

    +

    Examples of RRA Filter Objects:

    +
    +      //This RRA Filter object leaves the original RRA unchanged.
    +      function RRADoNothing(rra_idx) {
    +         this.getIdx = function() {return rra_idx;}
    +         this.getStep = function() {return null;} 
    +      }
    +      
    +      /* This Filter creates a new RRA with a different step size 
    +      / based on another RRA, whose data the new RRA averages. 
    +      / rra_idx should be index of RRA with largest step size 
    +      / that doesn't exceed new step size. */ 
     
    +      function RRA_Avg(rra_idx,new_step_in_seconds) {
    +         this.getIdx = function() {return rra_idx;}
    +         this.getStep = function() {return new_step_in_seconds;}
    +      }
    +
    +

    For instance, if you have 3 RRAs with 5 second, 60 second and 3600 second intervals, and would like an RRA with 1800 second steps along with them, create: +

     new RRDRRAFilterAvg(rrd_file, object_list);
    +      object_list = [new RRADoNothing(0), new RRADoNothing(1), new RRADoNothing(2), new RRA_Avg(1,1800)].  
    +
    +

    It's best to use the RRA with the next smallest step size as a basis. It's also best to make steps integer multiples of the original RRA step sizes. For instance, using a 45 minute step, a 6 hour (= 45mins x 8) step would be better than 4 hour step (=45 mins x 5.33...). +

    This class implements the following methods:

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    Method

    +
    +

    Description

    +
    +

    getMinSteps()

    +
    +

    Return the base interval + in seconds that was used to feed the RRD file.

    +
    +

    getLastUpdate()

    +
    +

    Return the timestamp of the last + update.

    +
    +

    getNrDSs()

    +
    +

    Return the number of Data + Sources present in the RRD file. +

    +
    +

    getDSNames()

    +
    +

    Return the names of the Data + Sources present in the RRD file. +

    +
    +

    getDS(id)

    +
    +

    If id is a number, return an object of type RRDDS holding + the information about the id-th Data + Source.

    +

    If id is a string, return an object of type RRDDS holding + the information about the Data + Source with the requested name.

    +
    +

    getNrRRAs()

    +
    +

    Return the number of Round + Robin Archives present in the RRD file.

    +
    +

    getRRAInfo(n)

    +
    +

    Return an object of type RRDRRAInfo + holding the information about the n-th Round + Robin Archive.

    +
    +

    getRRA(n)

    +
    +

    Return an object of type RRDRRA that + can be used to access the values stored in the n-th Round + Robin Archive.

    +
    -
    -

    Class RRDRRAFilterDS

    -

    This class filters out a subset of DSs from an RRA using by a filter object.

    -

    The constructor has two arguments: rrd_rra (the RRA) and ds_list (the list of DS filters).

    + + + +
    +

    Internal Methods for Developers

    +

    For RRDFilterDS:

    +

    Class RRDRRAFilterDS

    +

    This class filters out a subset of DSs from an RRA identified by index or name.

    +

    The constructor has two arguments: rrd_rra (the RRA) and ds_list (the list of DSs to filter).

    -

    This class also implements the following methods:

    +

    This class implements the following methods:

    @@ -401,9 +603,10 @@
    -

    Class RRDFilterOp

    -

    This class filters all of the DSs in an RRD by a list of filters. -

    Its arguments are: rrd_file and op_obj_list (list of ds filters). + +

    Class RRDDSFilterOp

    +

    This class filters DSs from an RRD by using a user-provided filter object.

    +

    This class has three arguments: rrd_file, op_object (the filter object) and my_idx (index of new DS in case old one was modified by a filter).

    This class implements the following methods:

    @@ -422,85 +625,210 @@ + + + + + + + - + + + +
    -

    getMinSteps()

    +

    getIdx()

    -

    Return the base interval - in seconds that was used to feed the RRD file.

    +

    Return which DS it is in the RRD file.

    -

    getLastUpdate()

    +

    getName()

    -

    Return the timestamp of the last - update.

    +

    Return the name of the data source.

    -

    getNrDSs()

    +

    getType()

    -

    Return the number of Data - Sources present in the RRD file. +

    Return the type + of the data source.

    +
    +

    getMin()

    +
    +

    Return the minimum and maximum value the data source can + contain.

    +

    If either is not defined, undefined is returned.

    -

    getDSNames()

    +

    getMax()

    +
    +

    getRealDSList()

    -

    Return the names of the Data - Sources present in the RRD file. -

    +

    Returns which DSs is being used in the Filter.

    -

    getDS(id)

    +

    ComputeResult()

    -

    If id is a number, return an object of type RRDDS holding - the information about the id-th Data - Source.

    -

    If id is a string, return an object of type RRDDS holding - the information about the Data - Source with the requested name.

    +

    Return the computed result of the filter object on the DSs.

    +
    +
    +

    For RRDRRAFilterAvg:

    +

    Class RRAFilterAvg

    +

    The constructor has two arguments: the RRA and the Filter object for that RRA.

    +

    The filter changes the NrRows (number of rows) and the way the elements are fetched (getEl and getElFast). +

    All other attributes are copied from the base RRA (the rra given in the arguments). +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +

    Method

    +
    +

    Description

    +
    +

    getIdx()

    +
    +

    Return which RRA it is in the RRD file (real index, not base RRA index).

    +
    +

    getNrRows()

    +
    +

    Return the number of rows in the RRA.

    +
    +

    getNrDSs()

    +
    +

    Return the number of DSs in the RRD file.

    +
    +

    getStep()

    +
    +

    Return the number of seconds between rows.

    +
    +

    getCFName()

    +
    +

    Return the Consolidation + Function used by the RRA.

    +
    +

    getEl(r,d)

    +
    +

    Return the value for the d-th DS in the r-th row, modified by the filter.

    +
    +

    getElFast(r,d)

    +
    +

    Return the low-precision value for the d-th DS in the r-th row, modified by the filter.

    +
    +
    +

    Class RRAInfoFilterAvg

    +

    This class implements the methods needed to access the new RRA. The filter only changes the PdpPerRow.

    +
    + + + + + + + + + + + + + + + + + + + -
    +

    Method

    +
    +

    Description

    +
    -

    getNrRRAs()

    +

    getIdx()

    -

    Return the number of Round - Robin Archives present in the RRD file.

    +

    Return which RRA it is in the RRD file.

    -

    getRRAInfo(n)

    +

    getNrRows()

    -

    Return an object of type RRDRRAInfo - holding the information about the n-th Round - Robin Archive.

    +

    Return the number of rows in the RRA.

    -

    getRRA(n)

    +

    getStep()

    -

    Return an object of type RRDRRA that - can be used to access the values stored in the n-th Round - Robin Archive.

    +

    Return the number of seconds between rows.

    +
    +

    getCFName()

    +
    +

    Return the Consolidation + Function used by the RRA.

    +
    +

    getPdpPerRow()

    +
    +

    Return number of slots used for consolidation.

    +
    + + + +
    diff --git a/doc/lib/rrdFlot_js.html b/doc/lib/rrdFlot_js.html index d3c2660..b517b66 100644 --- a/doc/lib/rrdFlot_js.html +++ b/doc/lib/rrdFlot_js.html @@ -128,20 +128,36 @@ creates an interactive

    rrdflot_defaults (optional)

    -

    Dictionary of rrd_flot options. +

    Dictionary of rrd_flot options. All are optional.

    The recognized elements and the default values are:

        {
    -     legend: "Top"         //Starting location of legend. Options are: 
    -                           //"Top","Bottom","TopRight","BottomRight","None".
    -     num_cb_rows: 12       //How many rows of DS checkboxes per column.
    -     multi_ds: false       //"true" appends the name of the aggregation function to the 
    -                           //name of the DS element. 
    -     multi_rra: false      //"true" appends the name of the RRA consolidation function (CF) 
    -                           //(AVERAGE, MIN, MAX or LAST) to the name of the RRA. Useful for 
    -                           //RRAs over the same interval with different CFs.  
    -   }
    +     legend: "Top"            //Starting location of legend. Options are: 
    +                              //   "Top","Bottom","TopRight","BottomRight","None".
    +     num_cb_rows: 12          //How many rows of DS checkboxes per column.
    +     use_elem_buttons: false  //To be used in conjunction with num_cb_rows: This option
    +                              //    creates a button above every column, which selects
    +                              //    every element in the column. 
    +     multi_ds: false          //"true" appends the name of the aggregation function to the 
    +                              //    name of the DS element. 
    +     multi_rra: false         //"true" appends the name of the RRA consolidation function (CF) 
    +                              //    (AVERAGE, MIN, MAX or LAST) to the name of the RRA. Useful 
    +                              //    for RRAs over the same interval with different CFs.  
    +     use_checked_DSs: false   //Use the list checked_DSs below.
    +     checked_DSs: []          //List of elements to be checked by default when graph is loaded. 
    +                              //    Overwrites graph options. 
    +     use_rra: false           //Whether to use the rra index specified below.
    +     rra: 0                   //RRA (rra index in rrd) to be selected when graph is loaded. 
    +     use_windows: false       //Whether to use the window zoom specifications below.
    +     window_min: 0            //Sets minimum for window zoom. X-axis usually in unix time. 
    +     window_max: 0            //Sets maximum for window zoom.
    +     graph_height: "300px"    //Height of main graph. 
    +     graph_width: "500px"     //Width of main graph.
    +     scale_height: "110px"    //Height of small scaler graph.
    +     scale_width: "250px"     //Width of small scaler graph.
    +  } 
     

    +See the rrdflot_defaults in action.
    -- cgit v1.1-4-g5e80