|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opennms.netmgt.rrd.RrdUtils
public class RrdUtils
Provides static methods for interacting with round robin files. Supports JNI and JRobin based files and provides queuing for managing differences in collection speed and disk write speed. This behaviour is implemented using the Strategy pattern with a different RrdStrategy for JRobin and JNI as well as a Strategy that provides Queueing on top of either one. The following System properties select which strategy is in use.
org.opennms.rrd.usejni: (defaults to true)
true - use the existing RRDTool code via the JNI interface @see JniRrdStrategy
false - use the pure java JRobin interface @see JRobinRrdStrategy
org.opennms.rrd.usequeue: (defaults to true)
use the queueing that allows collection to occur even though the disks are
keeping up. @see QueuingRrdStrategy
| Constructor Summary | |
|---|---|
RrdUtils()
|
|
| Method Summary | |
|---|---|
static java.io.InputStream |
createGraph(java.lang.String command,
java.io.File workDir)
Creates an InputStream representing the bytes of a graph created from round robin data. |
static boolean |
createRRD(java.lang.String creator,
java.lang.String directory,
java.lang.String rrdName,
int step,
java.util.List dataSources,
java.util.List rraList)
|
static boolean |
createRRD(java.lang.String creator,
java.lang.String directory,
java.lang.String dsName,
int step,
java.lang.String dsType,
int dsHeartbeat,
java.lang.String dsMin,
java.lang.String dsMax,
java.util.List rraList)
Create a round robin database file. |
static java.lang.Double |
fetchLastValue(java.lang.String rrdFile,
int interval)
This method issues an round robin fetch command to retrieve the last value of the datasource stored in the specified RRD file. |
static java.lang.Double |
fetchLastValueInRange(java.lang.String rrdFile,
int interval,
int range)
This method issues an round robing fetch command to retrieve the last value of the datasource stored in the specified RRD file within given tolerance (which should be a multiple of the RRD interval). |
static java.lang.String |
getExtension()
|
static RrdStrategy |
getStrategy()
|
static void |
graphicsInitialize()
|
static void |
initialize()
Initializes the underlying round robin system and sets up the appropriate strategy. |
static void |
setStrategy(RrdStrategy strategy)
|
static void |
updateRRD(java.lang.String owner,
java.lang.String repositoryDir,
java.lang.String rrdName,
long timestamp,
java.lang.String val)
Add datapoints to a round robin database. |
static void |
updateRRD(java.lang.String owner,
java.lang.String repositoryDir,
java.lang.String rrdName,
java.lang.String val)
Add datapoints to a round robin database using the current system time as the timestamp for the values |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RrdUtils()
| Method Detail |
|---|
public static RrdStrategy getStrategy()
public static void setStrategy(RrdStrategy strategy)
public static void initialize()
throws RrdException
RrdException
public static void graphicsInitialize()
throws RrdException
RrdException
public static boolean createRRD(java.lang.String creator,
java.lang.String directory,
java.lang.String dsName,
int step,
java.lang.String dsType,
int dsHeartbeat,
java.lang.String dsMin,
java.lang.String dsMax,
java.util.List rraList)
throws RrdException
creator - -
A string representing who is creating this file for use in log
msgsdirectory - -
The directory to create the file indsName - -
The datasource name for use in the round robin databasestep - -
the step for the databasedsType - -
the type for the datasourcedsHeartbeat - -
the heartbeat for the datasoucedsMin - -
the minimum allowable value for the datasourcedsMax - -
the maximum allowable value for the datasoucerraList - -
a List of the round robin archives to create in the database
RrdException
public static boolean createRRD(java.lang.String creator,
java.lang.String directory,
java.lang.String rrdName,
int step,
java.util.List dataSources,
java.util.List rraList)
throws RrdException
RrdException
public static void updateRRD(java.lang.String owner,
java.lang.String repositoryDir,
java.lang.String rrdName,
java.lang.String val)
throws RrdException
owner - the owner of the file. This is used in log messagesrepositoryDir - the directory the file resides inrrdName - the name for the rrd file.val - a colon separated list of values representing the updates for datasources for this rrd
RrdException
public static void updateRRD(java.lang.String owner,
java.lang.String repositoryDir,
java.lang.String rrdName,
long timestamp,
java.lang.String val)
throws RrdException
owner - the owner of the file. This is used in log messagesrepositoryDir - the directory the file resides inrrdName - the name for the rrd file.timestamp - the timestamp in millis to use for the rrd update (this gets rounded to the nearest second)val - a colon separated list of values representing the updates for datasources for this rrd
RrdException
public static java.lang.Double fetchLastValue(java.lang.String rrdFile,
int interval)
throws java.lang.NumberFormatException,
RrdException
rrdFile - RRD file from which to fetch the data.interval - Thresholding interval (should equal RRD step size)
java.lang.NumberFormatException - if the retrieved value fails to convert to a double
RrdException
public static java.lang.Double fetchLastValueInRange(java.lang.String rrdFile,
int interval,
int range)
throws java.lang.NumberFormatException,
RrdException
rrdFile - RRD file from which to fetch the data.interval - Thresholding interval (should equal RRD step size)
java.lang.NumberFormatException - if the retrieved value fails to convert to a double
RrdException
public static java.io.InputStream createGraph(java.lang.String command,
java.io.File workDir)
throws java.io.IOException,
RrdException
command - the command needed to create the graphworkDir - the directory that all referenced files are relative to
java.io.IOException - if an IOError occurs
RrdException - if an RRD error occurspublic static java.lang.String getExtension()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||