The rrdFile Javascript module implements a set of classes that can be used to extract information from RRD archives loaded as binary file objects. |
The main class in this module is RRDFile. It interprets the given the binary file object and provides methods to decode the RRD information.
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:
A binary file object.
Any object implementing an interface providing the following methods can be used:
getByteAt(idx) - Return a 8 bit unsigned integer at offset idx.
getLongAt(idx) - Return a 32 bit unsigned integer at offset idx.
getDoubleAt(idx) - Return a double float at offset idx.
getFastDoubleAt(idx) - Similar to getDoubleAt but with less precision.
getCStringAt(idx,maxsize) - Return a string of at most maxsize characters that was 0-terminated in the source.
The binaryXHR module, provided with this package, provides the class BinaryFile that implements this interface.
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. |
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() |
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. |
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. |
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. |
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.
|