package xapi-rrd
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=850eb24c732b6300e1a0b587100eb5b54440efbe911724fb339c6b20d9534546
sha512=8f0d7044983ecb30a8a7064b398235150ba50e5a68bdf3da6442762879ed2f97c9c4b2b93856be79e5f1bad605709b2dc557cf2606af0cb68833596a2bfa8f60
doc/xapi-rrd/Rrd/index.html
Module Rrd
Source
This module provides a util that records data in a way that's compatible with rrdtool.
Data source types - see ds datatype
Consolidation function - see RRA datatype
Container so that we can handle different typed inputs
The CDP preparation scratch area. The 'value' field should be accumulated in such a way that it always contains the value that will eventually be the CDP. This means that for averages, we accumulate 1/n * the PDP, and renormalise when we have unknown PDPs. For the other types it's much easier
DS - a data source This defines how we deal with incoming data. Type is one of:
- Absolute: meaning that the incoming data is an absolute rate
- Derive: meaning that the rate must come from the difference between the incoming data and the previous value
- Gauge: meaning that the value isn't a rate at all (e.g. temperature, load avg)
Optionally, there is a maximum time greater than which we mark the PDPs as unknown.
type ds = {
ds_name : string;
(*Name
*)ds_ty : ds_type;
(*Type of rate the input must be processed as, see above
*)ds_min : float;
ds_max : float;
ds_mrhb : float;
(*Maximum time between updates
*)mutable ds_last : ds_value_type;
(*Last raw value that was processed
*)mutable ds_value : float;
(*Current calculated rate of the PDP
*)mutable ds_unknown_sec : float;
(*Number of seconds that are unknown in the current PDP
*)
}
RRA - RRD archive This is an archive that holds consolidated data points (CDPs) belonging to a single consolidation function. They are stored in rings buffers, each one related to a single different data-source. It defines the type of consolidation that happens (average, max, min or last), the number of primary data points (PDPs) that go to make a CDP, and the number of CDPs to store.
To better visualize how the datapoints are stored:
│ Datasources ┃ ┃ ┃ └─────────────────┨ Memory ┃ cputime ┃ Consolidators ┃ ┃ ┃ ━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━┫ Average ┃ Fring of CDPs ┃ Fring of CDPs ┃ ← RRA ━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━┫ Max ┃ Fring of CDPs ┃ Fring of CDPs ┃ ← RRA ━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━┛
type rra = {
rra_cf : cf_type;
(*consolidation function
*)rra_row_cnt : int;
(*number of entries to store
*)rra_pdp_cnt : int;
(*number of pdps per cdp
*)rra_xff : float;
(*proportion of missing pdps at which we mark the cdp as unknown
*)rra_data : Fring.t array;
(*Stored data, one ring per datasource
*)rra_cdps : cdp_prep array;
(*scratch area for consolidated datapoint preparation
*)mutable rra_updatehook : (rrd -> int -> unit) option;
(*Hook that gets called when an update happens
*)
}
The container for the DSs and RRAs. Also specifies the period between pdps
Helper function to get the start time and age of the current/last PDP
Update the CDP value with a number (start_pdp_offset) of PDPs.
Update the RRAs with a number of PDPs.
val ds_update_named :
rrd ->
float ->
new_domid:bool ->
(StringMap.key * (ds_value_type * (float -> float))) list ->
unit
Update the rrd with named values rather than just an ordered array
val ds_create :
string ->
ds_type ->
?min:float ->
?max:float ->
?mrhb:float ->
ds_value_type ->
ds
Add in a new DS into a pre-existing RRD. Preserves data of all the other archives and fills the new one full of NaNs. Note that this doesn't fill in the CDP values correctly at the moment!
Remove the named DS from an RRD. Removes all of the data associated with it, too
Find the RRA with a particular CF that contains a particular start time, and also has a minimum pdp_cnt. If it can't find an appropriate one, either return the RRA with the correct CF that has the most ancient data, or raise No_RRA_Available if there's not archive with the correct CF. Assumes the RRAs are stored in increasing time-length