|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jrobin.core.Sample
public class Sample
Class to represent data source values for the given timestamp. Objects of this class are never created directly (no public constructor is provided). To learn more how to update RRDs, see RRDTool's rrdupdate man page.
To update a RRD with JRobin use the following procedure:
createSample()
on respective RrdDb
object.
setTime()
method).
setValue()
).
update()
method.
Newly created Sample object contains all data source values set to 'unknown'.
You should specifify only 'known' data source values. However, if you want to specify
'unknown' values too, use Double.NaN
.
Method Summary | |
---|---|
java.lang.String |
dump()
Dumps sample content using the syntax of RRDTool's update command. |
java.lang.String[] |
getDsNames()
Returns an array of all data source names. |
long |
getTime()
Returns sample timestamp (in seconds, without milliseconds). |
double[] |
getValues()
Returns all current data source values in the sample. |
void |
set(java.lang.String timeAndValues)
Sets sample timestamp and data source values in a fashion similar to RRDTool. |
void |
setAndUpdate(java.lang.String timeAndValues)
Creates sample with the timestamp and data source values supplied in the argument string and stores sample in the corresponding RRD. |
void |
setTime(long time)
Sets sample timestamp. |
void |
setValue(int i,
double value)
Sets single datasource value using data source index. |
void |
setValue(java.lang.String dsName,
double value)
Sets single data source value in the sample. |
void |
setValues(double[] values)
Sets some (possibly all) data source values in bulk. |
void |
update()
Stores sample in the corresponding RRD. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public void setValue(java.lang.String dsName, double value) throws RrdException
dsName
- Data source name.value
- Data source value.
RrdException
- Thrown if invalid data source name is supplied.public void setValue(int i, double value) throws RrdException
i
- Data source indexvalue
- Data source values
RrdException
- Thrown if data source index is invalid.public void setValues(double[] values) throws RrdException
values
- Data source values.
RrdException
- Thrown if the number of supplied values is zero or greater
than the number of data sources defined in the RRD.public double[] getValues()
public long getTime()
public void setTime(long time)
time
- New sample timestamp.public java.lang.String[] getDsNames()
public void set(java.lang.String timeAndValues) throws RrdException
Sets sample timestamp and data source values in a fashion similar to RRDTool.
Argument string should be composed in the following way:
timestamp:value1:value2:...:valueN
.
You don't have to supply all datasource values. Unspecified values will be treated as unknowns. To specify unknown value in the argument string, use letter 'U'
timeAndValues
- String made by concatenating sample timestamp with corresponding
data source values delmited with colons. For example:
1005234132:12.2:35.6:U:24.5 NOW:12.2:35.6:U:24.5'N' stands for the current timestamp (can be replaced with 'NOW')
Method will throw an exception if timestamp is invalid (cannot be parsed as Long, and is not 'N' or 'NOW'). Datasource value which cannot be parsed as 'double' will be silently set to NaN.
RrdException
- Thrown if too many datasource values are suppliedpublic void update() throws java.io.IOException, RrdException
java.io.IOException
- Thrown in case of I/O error.
RrdException
- Thrown in case of JRobin related error.public void setAndUpdate(java.lang.String timeAndValues) throws java.io.IOException, RrdException
Creates sample with the timestamp and data source values supplied in the argument string and stores sample in the corresponding RRD. This method is just a shortcut for:
set(timeAndValues); update();
timeAndValues
- String made by concatenating sample timestamp with corresponding
data source values delmited with colons. For example:1005234132:12.2:35.6:U:24.5
NOW:12.2:35.6:U:24.5
java.io.IOException
- Thrown in case of I/O error.
RrdException
- Thrown in case of JRobin related error.public java.lang.String dump()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |