|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jrobin.core.RrdDef
public class RrdDef
Class to represent definition of new Round Robin Database (RRD).
Object of this class is used to create
new RRD from scratch - pass its reference as a RrdDb
constructor
argument (see documentation for RrdDb
class). RrdDef
object does not actually create new RRD. It just holds all necessary
information which will be used during the actual creation process
RRD definition (RrdDef object) consists of the following elements:
RrdDef provides API to set all these elements. For the complete explanation of all RRD definition parameters, see RRDTool's rrdcreate man page.
Field Summary | |
---|---|
static long |
DEFAULT_INITIAL_SHIFT
if not specified in constructor, starting timestamp will be set to the current timestamp plus DEFAULT_INITIAL_SHIFT seconds (-10) |
static long |
DEFAULT_STEP
default RRD step to be used if not specified in constructor (300 seconds) |
Constructor Summary | |
---|---|
RrdDef(java.lang.String path)
Creates new RRD definition object with the given path. |
|
RrdDef(java.lang.String path,
long step)
Creates new RRD definition object with the given path and step. |
|
RrdDef(java.lang.String path,
long startTime,
long step)
Creates new RRD definition object with the given path, starting timestamp and step. |
Method Summary | |
---|---|
void |
addArchive(ArcDef arcDef)
Adds single archive definition represented with object of class ArcDef . |
void |
addArchive(ArcDef[] arcDefs)
Adds archive definitions to RRD definition in bulk. |
void |
addArchive(java.lang.String rrdToolArcDef)
Adds single archive to RRD definition from a RRDTool-like archive definition string. |
void |
addArchive(java.lang.String consolFun,
double xff,
int steps,
int rows)
Adds single archive definition by specifying its consolidation function, X-files factor, number of steps and rows. |
void |
addDatasource(DsDef dsDef)
Adds single datasource definition represented with object of class DsDef . |
void |
addDatasource(DsDef[] dsDefs)
Adds data source definitions to RRD definition in bulk. |
void |
addDatasource(java.lang.String rrdToolDsDef)
Adds single datasource to RRD definition from a RRDTool-like datasource definition string. |
void |
addDatasource(java.lang.String dsName,
java.lang.String dsType,
long heartbeat,
double minValue,
double maxValue)
Adds single datasource to RRD definition by specifying its data source name, source type, heartbeat, minimal and maximal value. |
java.lang.String |
dump()
Returns string that represents all specified RRD creation parameters. |
boolean |
equals(java.lang.Object obj)
Compares the current RrdDef with another. |
java.lang.String |
exportXmlTemplate()
Exports RrdDef object to string in XML format. |
void |
exportXmlTemplate(java.io.OutputStream out)
Exports RrdDef object to output stream in XML format. |
void |
exportXmlTemplate(java.lang.String filePath)
Exports RrdDef object to a file in XML format. |
int |
getArcCount()
Returns number of defined archives. |
ArcDef[] |
getArcDefs()
Returns all archive definition objects specified so far. |
int |
getDsCount()
Returns number of defined datasources. |
DsDef[] |
getDsDefs()
Returns all data source definition objects specified so far. |
long |
getEstimatedSize()
Returns the number of storage bytes required to create RRD from this RrdDef object. |
java.lang.String |
getPath()
Returns path for the new RRD |
long |
getStartTime()
Returns starting timestamp for the RRD that should be created. |
long |
getStep()
Returns time step for the RRD that will be created. |
void |
setPath(java.lang.String path)
Sets path to RRD. |
void |
setStartTime(java.util.Date date)
Sets RRD's starting timestamp. |
void |
setStartTime(java.util.GregorianCalendar gc)
Sets RRD's starting timestamp. |
void |
setStartTime(long startTime)
Sets RRD's starting timestamp. |
void |
setStep(long step)
Sets RRD's time step. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long DEFAULT_STEP
public static final long DEFAULT_INITIAL_SHIFT
Constructor Detail |
---|
public RrdDef(java.lang.String path) throws RrdException
Creates new RRD definition object with the given path.
When this object is passed to
RrdDb
constructor, new RRD will be created using the
specified path.
path
- Path to new RRD.
RrdException
- Thrown if name is invalid (null or empty).public RrdDef(java.lang.String path, long step) throws RrdException
Creates new RRD definition object with the given path and step.
path
- Path to new RRD.step
- RRD step.
RrdException
- Thrown if supplied parameters are invalid.public RrdDef(java.lang.String path, long startTime, long step) throws RrdException
Creates new RRD definition object with the given path, starting timestamp and step.
path
- Path to new RRD.startTime
- RRD starting timestamp.step
- RRD step.
RrdException
- Thrown if supplied parameters are invalid.Method Detail |
---|
public java.lang.String getPath()
public long getStartTime()
public long getStep()
public void setPath(java.lang.String path)
path
- to new RRD.public void setStartTime(long startTime)
startTime
- starting timestamp.public void setStartTime(java.util.Date date)
date
- starting datepublic void setStartTime(java.util.GregorianCalendar gc)
gc
- starting datepublic void setStep(long step)
step
- RRD time step.public void addDatasource(DsDef dsDef) throws RrdException
DsDef
.
dsDef
- Datasource definition.
RrdException
- Thrown if new datasource definition uses already used data
source name.public void addDatasource(java.lang.String dsName, java.lang.String dsType, long heartbeat, double minValue, double maxValue) throws RrdException
dsName
- Data source name.dsType
- Data source type. Valid types are "COUNTER",
"GAUGE", "DERIVE" and "ABSOLUTE".heartbeat
- Data source heartbeat.minValue
- Minimal acceptable value. Use Double.NaN
if unknown.maxValue
- Maximal acceptable value. Use Double.NaN
if unknown.
RrdException
- Thrown if new datasource definition uses already used data
source name.public void addDatasource(java.lang.String rrdToolDsDef) throws RrdException
DS:name:type:heartbeat:minValue:maxValueFor example:
DS:input:COUNTER:600:0:UFor more information on datasource definition parameters see
rrdcreate
man page.
rrdToolDsDef
- Datasource definition string with the syntax borrowed from RRDTool.
RrdException
- Thrown if invalid string is supplied.public void addDatasource(DsDef[] dsDefs) throws RrdException
dsDefs
- Array of data source definition objects.
RrdException
- Thrown if duplicate data source name is used.public void addArchive(ArcDef arcDef) throws RrdException
ArcDef
.
arcDef
- Archive definition.
RrdException
- Thrown if archive with the same consolidation function
and the same number of steps is already added.public void addArchive(ArcDef[] arcDefs) throws RrdException
arcDefs
- Array of archive definition objects
RrdException
- Thrown if RRD definition already contains archive with
the same consolidation function and the same number of steps.public void addArchive(java.lang.String consolFun, double xff, int steps, int rows) throws RrdException
consolFun
- Consolidation function. Valid values are "AVERAGE",
"MIN", "MAX" and "LAST"xff
- X-files factor. Valid values are between 0 and 1.steps
- Number of archive stepsrows
- Number of archive rows
RrdException
- Thrown if archive with the same consolidation function
and the same number of steps is already added.public void addArchive(java.lang.String rrdToolArcDef) throws RrdException
RRA:consolidationFunction:XFilesFactor:steps:rowsFor example:
RRA:AVERAGE:0.5:10:1000For more information on archive definition parameters see
rrdcreate
man page.
rrdToolArcDef
- Archive definition string with the syntax borrowed from RRDTool.
RrdException
- Thrown if invalid string is supplied.public DsDef[] getDsDefs()
public ArcDef[] getArcDefs()
public int getDsCount()
public int getArcCount()
public java.lang.String dump()
create
command.
RrdDb
object.public void exportXmlTemplate(java.io.OutputStream out)
RrdDefTemplate
class.
out
- Output streampublic java.lang.String exportXmlTemplate()
RrdDefTemplate
class.
public void exportXmlTemplate(java.lang.String filePath) throws java.io.IOException
RrdDefTemplate
class.
filePath
- Path to the file
java.io.IOException
public long getEstimatedSize()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- The second RrdDef object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |