-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Data set
Florian Forster edited this page Nov 21, 2023
·
1 revision
The data_set_t structure describes a value being passed around in collectd. It serves a similar purpose as a schema in relational databases and describes the data contained in a value-list-t structure. The type field in the value list is used to refer to one specific data set. The two terms, “data set” and “type”, are often used interchangeably in the documentation.
The following information is stored in this structure:
- A type (a name), by which this struct is uniquely identified.
- One of more data-sources, where each data source contains:
- The name of the data source. If there is only one data source, this name is usually “value”.
- The type of the data source, i. e. one of
DS_TYPE_COUNTER
,DS_TYPE_GAUGE
,DS_TYPE_DERIVE
, andDS_TYPE_ABSOLUTE
. - A minimum and a maximum value, both of which may be NaN (not a number).
The structure is defined in src/plugin.h as follows:
struct data_source_s
{
char name[DATA_MAX_NAME_LEN];
int type;
double min;
double max;
};
typedef struct data_source_s data_source_t;
struct data_set_s
{
char type[DATA_MAX_NAME_LEN];
int ds_num;
data_source_t *ds;
};
typedef struct data_set_s data_set_t;
Types are defined in a configuration file called types.db. See the types.db(5) manual page for details.
The data set can be queried from the daemon using the plugin_get_ds
function declared in src/plugin.h. The type member of a value-list-t can be used for this.