java.lang.Object | |
↳ | org.rrd4j.core.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 Rrd4j 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 specify only 'known' data source values. However, if you want to specify
'unknown' values too, use Double.NaN
.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Dumps sample content using the syntax of RRDTool's update command.
| |||||||||||
Returns an array of all data source names.
| |||||||||||
Returns sample timestamp (in seconds, without milliseconds).
| |||||||||||
Returns all current data source values in the sample.
| |||||||||||
Sets sample timestamp and data source values in a fashion similar to RRDTool. | |||||||||||
Creates sample with the timestamp and data source values supplied in the argument string and stores sample in the corresponding RRD. | |||||||||||
Sets sample timestamp.
| |||||||||||
Sets single data source value in the sample.
| |||||||||||
Sets single datasource value using data source index.
| |||||||||||
Sets some (possibly all) data source values in bulk.
| |||||||||||
Stores sample in the corresponding RRD.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Dumps sample content using the syntax of RRDTool's update command.
Returns an array of all data source names. If you try to set value for the data source name not in this array, an exception is thrown.
Returns sample timestamp (in seconds, without milliseconds).
Returns all current data source values in the sample.
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. |
---|
Sample
objectIllegalArgumentException | Thrown if too many datasource values are supplied |
---|
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 |
---|
IOException | Thrown in case of I/O error. |
---|
Sets sample timestamp. Timestamp should be defined in seconds (without milliseconds).
time | New sample timestamp. |
---|
Sample
object
Sets single data source value in the sample.
dsName | Data source name. |
---|---|
value | Data source value. |
Sample
objectIllegalArgumentException | Thrown if invalid data source name is supplied. |
---|
Sets single datasource value using data source index. Data sources are indexed by the order specified during RRD creation (zero-based).
i | Data source index |
---|---|
value | Data source values |
Sample
objectIllegalArgumentException | Thrown if data source index is invalid. |
---|
Sets some (possibly all) data source values in bulk. Data source values are assigned in the order of their definition inside the RRD.
values | Data source values. |
---|
Sample
objectIllegalArgumentException | Thrown if the number of supplied values is zero or greater than the number of data sources defined in the RRD. |
---|
Stores sample in the corresponding RRD. If the update operation succeeds, all datasource values in the sample will be set to Double.NaN (unknown) values.
IOException | Thrown in case of I/O error. |
---|