rrdFile module


The rrdFile Javascript module implements a set of classes that can be used to extract information from RRD archives loaded as binary file objects.


Overview

The main class in this module is RRDFile. It interprets the given the binary file object and provides methods to decode the RRD information.

Class RRDFile

This is the main class of the package. It is also the only class the user ever needs to explicitly instantiate.

The RRDFile constructor has a single argument:

If the binary file is not a proper RRD file, an InvalidRRD exception will be thrown.

This class also implements the following methods:

Method

Description

getMinStep()

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.

getDS(n)

Return an object of type RRDDS holding the information about the n-th Data Source.

getDSbyName(name)

Return an object of type RRDDS holding the information about the Data Source with the requested name.

If no DS has such name, undefined is returned.

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 RRDDS

This class implements the methods needed to access the information about a RRD Data Source.

Method

Description

getIdx()

Return which DS it is in the RRD file.

getName()

Return the name of the data source.

getType()

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.

getMax()

Class RRDRRAInfo

This class implements the methods needed to access the information about a Round Robin Archive.

Method

Description

getIdx()

Return which RRA it is in the RRD file.

getNrRows()

Return the number of rows in the RRA.

getStep()

Return the number of seconds between rows.

getCFName()

Return the Consolidation Function used by the RRA.

Class RRDRRA

This class implements the methods needed to access the content of a Round Robin Archive.

Method

Description

getIdx()

Return which RRA it is in the RRD file.

getCFName()

Return the Consolidation Function used by the RRA.

The current implementation only supports AVERAGE,MAXIMUM,MINIMUM and LAST.
Access to elements of any other CF is currently undefined.

getNrRows()

Return the number of rows in the RRA.

getNrDSs()

Return the number of Data Sources present in the RRA.

getStep()

Return the number of seconds between rows.

getEl(r,d)

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

getElFast(row,ds)

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

Exception class InvalidRRD

This is a helper exception class that can be thrown while interpreting the binary file object.




This module is part of the javascriptRRD package hosted at http://javascript.sourceforge.net.
It is licensed under the MIT license.