package xapi-rrd

  1. Overview
  2. Docs
RRD library for use with xapi

Install

Dune Dependency

Authors

Maintainers

Sources

xapi-rrd-1.12.0.tbz
sha256=850eb24c732b6300e1a0b587100eb5b54440efbe911724fb339c6b20d9534546
sha512=8f0d7044983ecb30a8a7064b398235150ba50e5a68bdf3da6442762879ed2f97c9c4b2b93856be79e5f1bad605709b2dc557cf2606af0cb68833596a2bfa8f60

doc/xapi-rrd/Rrd/index.html

Module RrdSource

This module provides a util that records data in a way that's compatible with rrdtool.

Sourcemodule Fring = Rrd_fring
Sourcemodule Utils = Rrd_utils
Sourcemodule StringMap : sig ... end
Sourceexception No_RRA_Available
Sourceexception Invalid_data_source of string
Sourcetype ds_owner =
  1. | VM of string
  2. | Host
  3. | SR of string
Sourcetype ds_type =
  1. | Absolute
  2. | Gauge
  3. | Derive

Data source types - see ds datatype

Sourceval rpc_of_ds_type : ds_type -> Rpc.t
Sourceval ds_type_of_rpc : Rpc.t -> ds_type
Sourcetype cf_type =
  1. | CF_Average
  2. | CF_Min
  3. | CF_Max
  4. | CF_Last

Consolidation function - see RRA datatype

Sourcetype ds_value_type =
  1. | VT_Float of float
  2. | VT_Int64 of int64
  3. | VT_Unknown

Container so that we can handle different typed inputs

Sourceval rpc_of_ds_value_type : ds_value_type -> Rpc.t
Sourceval ds_value_type_of_rpc : Rpc.t -> ds_value_type
Sourcetype sampling_frequency =
  1. | Five_Seconds
Sourceval rpc_of_sampling_frequency : sampling_frequency -> Rpc.t
Sourceval sampling_frequency_of_rpc : Rpc.t -> sampling_frequency
Sourceval (+++) : int64 -> int64 -> int64
Sourceval (---) : int64 -> int64 -> int64
Sourceval (***) : int64 -> int64 -> int64
Sourceval (///) : int64 -> int64 -> int64
Sourceval ds_type_to_string : ds_type -> string
Sourceval cf_type_of_string : string -> cf_type
Sourceval cf_type_to_string : cf_type -> string
Sourceval ds_value_to_string : ds_value_type -> string

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

Sourcetype cdp_prep = {
  1. mutable cdp_value : float;
  2. mutable cdp_unknown_pdps : int;
    (*

    How may PDPs have been unknown so far

    *)
}

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.

Sourcetype ds = {
  1. ds_name : string;
    (*

    Name

    *)
  2. ds_ty : ds_type;
    (*

    Type of rate the input must be processed as, see above

    *)
  3. ds_min : float;
  4. ds_max : float;
  5. ds_mrhb : float;
    (*

    Maximum time between updates

    *)
  6. mutable ds_last : ds_value_type;
    (*

    Last raw value that was processed

    *)
  7. mutable ds_value : float;
    (*

    Current calculated rate of the PDP

    *)
  8. mutable ds_unknown_sec : float;
    (*

    Number of seconds that are unknown in the current PDP

    *)
}
Sourceval rpc_of_ds : ds -> Rpc.t
Sourceval ds_of_rpc : Rpc.t -> ds

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 ━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━┛

Sourcetype rra = {
  1. rra_cf : cf_type;
    (*

    consolidation function

    *)
  2. rra_row_cnt : int;
    (*

    number of entries to store

    *)
  3. rra_pdp_cnt : int;
    (*

    number of pdps per cdp

    *)
  4. rra_xff : float;
    (*

    proportion of missing pdps at which we mark the cdp as unknown

    *)
  5. rra_data : Fring.t array;
    (*

    Stored data, one ring per datasource

    *)
  6. rra_cdps : cdp_prep array;
    (*

    scratch area for consolidated datapoint preparation

    *)
  7. 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

Sourceand rrd = {
  1. mutable last_updated : float;
    (*

    Last updated time in seconds

    *)
  2. timestep : int64;
    (*

    Period between PDPs

    *)
  3. rrd_dss : ds array;
  4. rrd_rras : rra array;
}
Sourceval copy_cdp_prep : cdp_prep -> cdp_prep
Sourceval copy_rra : rra -> rra
Sourceval copy_ds : ds -> ds
Sourceval copy_rrd : rrd -> rrd
Sourceval cf_init_value : cf_type -> ds -> float
Sourceval get_times : float -> int64 -> int64 * float

Helper function to get the start time and age of the current/last PDP

Sourceval do_cfs : rra -> int -> float array -> unit

Update the CDP value with a number (start_pdp_offset) of PDPs.

Sourceval rra_update : rrd -> int64 -> int -> float array -> unit

Update the RRAs with a number of PDPs.

Sourceval process_ds_value : ds -> ds_value_type -> float -> bool -> float
Sourceval ds_update : rrd -> float -> ds_value_type array -> (float -> float) array -> bool -> unit
Sourceval 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

Sourceval ds_names : rrd -> string list

Get registered DS names

Sourceval rra_create : cf_type -> int -> int -> float -> rra

create an rra structure

Sourceval ds_create : string -> ds_type -> ?min:float -> ?max:float -> ?mrhb:float -> ds_value_type -> ds
Sourceval rrd_create : ds array -> rra array -> int64 -> float -> rrd

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!

  • parameter now

    = Unix.gettimeofday ()

Sourceval rrd_add_ds : rrd -> float -> ds -> rrd
Sourceval rrd_remove_ds : rrd -> string -> rrd

Remove the named DS from an RRD. Removes all of the data associated with it, too

Sourceval find_best_rras : rrd -> int -> cf_type option -> int64 -> rra list

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

Sourceval query_named_ds : rrd -> float -> string -> cf_type -> float
Sourceval from_xml : Xmlm.input -> rrd
Sourceval xml_to_output : rrd -> Xmlm.output -> unit
Sourcemodule Json : sig ... end
Sourceval json_to_string : rrd -> string
Sourcemodule Statefile_latency : sig ... end
OCaml

Innovation. Community. Security.