Difference between revisions of "Data set"

From collectd Wiki
Jump to: navigation, search
(Created initial page.)
 
(Add link to "data source".)
Line 5: Line 5:
  
 
* A ''type'' (a name), by which this struct is uniquely identified.
 
* A ''type'' (a name), by which this struct is uniquely identified.
* One of more ''data sources'', 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>DS_TYPE_COUNTER</code>, <code>DS_TYPE_GAUGE</code>, <code>DS_TYPE_DERIVE</code>, and <code>DS_TYPE_ABSOLUTE</code>.

Revision as of 10:39, 28 July 2009

The data_set_t structure describes a value being passed around in collectd. It serves a similar purpose as a schema in relational databases.

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, and DS_TYPE_ABSOLUTE.
    • A minimum and a maximum value, both of which may be NaN (not a number).

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.