Data set

From collectd Wiki
Revision as of 10:44, 28 July 2009 by Octo (talk | contribs) (Data set t moved to Data set over redirect)

Jump to: navigation, search

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.