Difference between revisions of "Data set"

From collectd Wiki
Jump to: navigation, search
(Definition of new types: Use the Manpage template.)
(Added wikilinks.)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
{{DISPLAYTITLE:data_set_t}}
 
{{DISPLAYTITLE:data_set_t}}
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 '''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:
 
The following information is stored in this structure:
Line 7: Line 7:
 
* One of more [[data source]]s, where each data source contains:
 
* One of more [[data source]]s, where each data source contains:
 
** The name of the data source. If there is only one data source, this name is usually “value”.
 
** 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.&nbsp;e. one of <code>DS_TYPE_COUNTER</code>, <code>DS_TYPE_GAUGE</code>, <code>DS_TYPE_DERIVE</code>, and <code>DS_TYPE_ABSOLUTE</code>.
+
** The type of the data source, i.&nbsp;e. one of <code>[[Counter|DS_TYPE_COUNTER]]</code>, <code>[[Gauge|DS_TYPE_GAUGE]]</code>, <code>[[Derive|DS_TYPE_DERIVE]]</code>, and <code>[[Absolute|DS_TYPE_ABSOLUTE]]</code>.
 
** A minimum and a maximum value, both of which may be ''NaN'' (not a number).
 
** A minimum and a maximum value, both of which may be ''NaN'' (not a number).
  

Latest revision as of 10:32, 12 June 2010

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:

Definition of the struct

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;

Definition of new types

Types are defined in a configuration file called types.db. See the types.db(5) manual page for details.

Look-up

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.