public abstract class RrdUtils extends Object
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
Modifier and Type | Class and Description |
---|---|
static class |
RrdUtils.StrategyName |
Constructor and Description |
---|
RrdUtils() |
Modifier and Type | Method and Description |
---|---|
static InputStream |
createGraph(String command,
File workDir)
Creates an InputStream representing the bytes of a graph created from
round robin data.
|
static boolean |
createRRD(String creator,
String directory,
String rrdName,
int step,
List<RrdDataSource> dataSources,
List<String> rraList)
createRRD
|
static boolean |
createRRD(String creator,
String directory,
String dsName,
int step,
String dsType,
int dsHeartbeat,
String dsMin,
String dsMax,
List<String> rraList)
Create a round robin database file.
|
static Double |
fetchLastValue(String rrdFile,
String ds,
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 Double |
fetchLastValueInRange(String rrdFile,
String ds,
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 String |
getExtension()
getExtension
|
static <D,F> RrdStrategy<D,F> |
getSpecificStrategy(RrdUtils.StrategyName strategy)
getSpecificStrategy
|
static <D,F> RrdStrategy<D,F> |
getStrategy()
getStrategy
|
static void |
promoteEnqueuedFiles(Collection<String> files)
promoteEnqueuedFiles
|
static void |
setStrategy(RrdStrategy<?,?> strategy)
setStrategy
|
static void |
updateRRD(String owner,
String repositoryDir,
String rrdName,
long timestamp,
String val)
Add datapoints to a round robin database.
|
static void |
updateRRD(String owner,
String repositoryDir,
String rrdName,
String val)
Add datapoints to a round robin database using the current system time as the timestamp for the values
|
public static <D,F> RrdStrategy<D,F> getStrategy()
getStrategy
RrdStrategy
object.public static <D,F> RrdStrategy<D,F> getSpecificStrategy(RrdUtils.StrategyName strategy)
getSpecificStrategy
strategy
- a RrdUtils.StrategyName
object.RrdStrategy
object.public static void setStrategy(RrdStrategy<?,?> strategy)
setStrategy
strategy
- a RrdStrategy
object.public static boolean createRRD(String creator, String directory, String dsName, int step, String dsType, int dsHeartbeat, String dsMin, String dsMax, List<String> 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 databaseRrdException
- if any.public static boolean createRRD(String creator, String directory, String rrdName, int step, List<RrdDataSource> dataSources, List<String> rraList) throws RrdException
createRRD
public static void updateRRD(String owner, String repositoryDir, String rrdName, 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 rrdRrdException
- if any.public static void updateRRD(String owner, String repositoryDir, String rrdName, long timestamp, 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 rrdRrdException
- if any.public static Double fetchLastValue(String rrdFile, String ds, int interval) throws NumberFormatException, RrdException
rrdFile
- RRD file from which to fetch the data.interval
- Thresholding interval (should equal RRD step size)ds
- Name of the Data Source to be usedNumberFormatException
- if the retrieved value fails to convert to a doubleRrdException
- if any.public static Double fetchLastValueInRange(String rrdFile, String ds, int interval, int range) throws NumberFormatException, RrdException
rrdFile
- RRD file from which to fetch the data.interval
- Thresholding interval (should equal RRD step size)ds
- Name of the Data Source to be usedrange
- a int.NumberFormatException
- if the retrieved value fails to convert to a doubleRrdException
- if any.public static InputStream createGraph(String command, File workDir) throws IOException, RrdException
command
- the command needed to create the graphworkDir
- the directory that all referenced files are relative toIOException
- if an IOError occursRrdException
- if an RRD error occurspublic static void promoteEnqueuedFiles(Collection<String> files)
promoteEnqueuedFiles
files
- a Collection
object.Copyright © 2015. All Rights Reserved.