OpenNMS API 1.2.3

org.opennms.web.performance
Class RRDInfo

java.lang.Object
  extended byorg.opennms.web.performance.RRDInfo

public class RRDInfo
extends java.lang.Object

A data structure encapsulating information about a single round robin database (RRD).

This class holds all the data from the rrdtool info command in a single, object-oriented data structure/JavaBean. To create an instance of this object, call the static createRRDInfomethod with the output from an rrdtool info command.

This data usually looks something like:

 
    filename = "129.1.1.208-localhost.rrd"
    rrd_version = "0001"
    step = 300
    last_update = 982079322
    ds[EXPANSION_COUNTER_1].type = "COUNTER"
    ds[EXPANSION_COUNTER_1].minimal_heartbeat = 600
    ds[EXPANSION_COUNTER_1].min = NaN
    ds[EXPANSION_COUNTER_1].max = NaN
    ds[EXPANSION_COUNTER_1].last_ds = "U"
    ds[EXPANSION_COUNTER_1].value = 0.0000000000e+00
    ds[EXPANSION_COUNTER_1].unknown_sec = 222
  
 
but with many more ds (data source) lines and several rra (round robin archive) lines.

This class stores the general (filename, rrd version, etc) attributes and the data source attributes in an object-oriented way, but the RRA information is stored only in the raw values properties object. This class could very simply be extended, however, to include the RRA information as well.

Author:
Lawrence Karnowski, OpenNMS

Nested Class Summary
static class RRDInfo.DataSource
          Internal class to store information about a single RRD data source, which is similar to a column in a relational database.
 
Field Summary
protected  RRDInfo.DataSource[] dataSources
          The array of data sources (similar to relational database columns).
protected  java.util.Map dataSourcesMap
          A mapping of data source names to DataSource instances.
protected  java.lang.String filename
          The filname of the round robin database (RRD).
protected  java.util.Date lastUpdate
          The last time this RRD file was updated.
protected  java.util.Properties rawValues
          The lines from the RRD info string as name-value pairs.
protected  java.lang.String rrdVersion
          The version of rrdtool that created the round robin database.
protected  int step
          The elapsed time in seconds that the RRD expects a new update.
 
Constructor Summary
RRDInfo()
           
 
Method Summary
static RRDInfo createRRDInfo(int nodeId, java.lang.String infoString)
          Parses the output from a rrdtool info command to create the RRDInfo data structure.
 RRDInfo.DataSource getDataSource(java.lang.String ds)
           
 RRDInfo.DataSource[] getDataSources()
           
 java.lang.String getFilename()
           
 java.util.Date getLastUpdate()
           
 long getLastUpdateLong()
          Deprecated. Use getLastUpdate().getTime() instead.
 java.lang.String getRawValue(java.lang.String property)
           
 java.util.Properties getRawValues()
           
 java.lang.String getRRDVersion()
           
 int getStep()
           
protected static double parseDouble(java.lang.String s)
          Convenience method that parses a double or returns a NaN(not a number) double value if the string cannot be parsed to a double.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filename

protected java.lang.String filename
The filname of the round robin database (RRD).


rrdVersion

protected java.lang.String rrdVersion
The version of rrdtool that created the round robin database.


step

protected int step
The elapsed time in seconds that the RRD expects a new update. For example, if the step is 300, then the RRD is expecting a new update every 5 minutes.


lastUpdate

protected java.util.Date lastUpdate
The last time this RRD file was updated.


rawValues

protected java.util.Properties rawValues
The lines from the RRD info string as name-value pairs. Note this is currently the only way to retrieve the RRA information.


dataSources

protected RRDInfo.DataSource[] dataSources
The array of data sources (similar to relational database columns).


dataSourcesMap

protected java.util.Map dataSourcesMap
A mapping of data source names to DataSource instances.

Constructor Detail

RRDInfo

public RRDInfo()
Method Detail

getFilename

public java.lang.String getFilename()

getRRDVersion

public java.lang.String getRRDVersion()

getStep

public int getStep()

getLastUpdateLong

public long getLastUpdateLong()
Deprecated. Use getLastUpdate().getTime() instead.


getLastUpdate

public java.util.Date getLastUpdate()

getDataSources

public RRDInfo.DataSource[] getDataSources()

getDataSource

public RRDInfo.DataSource getDataSource(java.lang.String ds)

getRawValue

public java.lang.String getRawValue(java.lang.String property)

getRawValues

public java.util.Properties getRawValues()

createRRDInfo

public static RRDInfo createRRDInfo(int nodeId,
                                    java.lang.String infoString)
Parses the output from a rrdtool info command to create the RRDInfo data structure.

Returns:
An RRDInfo object that encapsulates the data given in the infoString parameter. If the infoString parameter does not contain a parseable info string, this method will return null.

parseDouble

protected static double parseDouble(java.lang.String s)
Convenience method that parses a double or returns a NaN(not a number) double value if the string cannot be parsed to a double.


OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.