1 #ifndef NETDATA_HEALTH_H
2 #define NETDATA_HEALTH_H
4 extern int rrdvar_compare(void *a, void *b);
10 * There are 4 scopes: local (chart), context, host and global variables
12 * Standard global variables:
15 * Standard host variables:
18 * Standard context variables:
21 * Standard local variables:
23 * $last_collected_value
28 #define RRDVAR_TYPE_CALCULATED 1
29 #define RRDVAR_TYPE_TIME_T 2
30 #define RRDVAR_TYPE_COLLECTED 3
31 #define RRDVAR_TYPE_TOTAL 4
33 // the variables as stored in the variables indexes
34 typedef struct rrdvar {
46 // variables linked to charts
47 // We link variables to point the values that are already
48 // calculated / processed by the normal data collection process
49 // This means, there will be no speed penalty for using
51 typedef struct rrdsetvar {
52 char *fullid; // chart type.chart id.variable
55 char *fullname; // chart type.chart name.variable
56 uint32_t hash_fullname;
58 char *variable; // variable
59 uint32_t hash_variable;
72 struct rrdset *rrdset;
74 struct rrdsetvar *next;
78 // variables linked to dimensions
79 // We link variables to point the values that are already
80 // calculated / processed by the normal data collection process
81 // This means, there will be no speed penalty for using
83 typedef struct rrddimvar {
87 char *id; // dimension id
90 char *name; // dimension name
93 char *fullidid; // chart type.chart id.dimension id
94 uint32_t hash_fullidid;
96 char *fullidname; // chart type.chart id.dimension name
97 uint32_t hash_fullidname;
99 char *fullnameid; // chart type.chart name.dimension id
100 uint32_t hash_fullnameid;
102 char *fullnamename; // chart type.chart name.dimension name
103 uint32_t hash_fullnamename;
113 RRDVAR *context_fullidid;
114 RRDVAR *context_fullidname;
115 RRDVAR *context_fullnameid;
116 RRDVAR *context_fullnamename;
118 RRDVAR *host_fullidid;
119 RRDVAR *host_fullidname;
120 RRDVAR *host_fullnameid;
121 RRDVAR *host_fullnamename;
123 struct rrddim *rrddim;
125 struct rrddimvar *next;
128 // additional calculated variables
129 // These aggregate time-series data at fixed intervals
130 // (defined in their update_every member below)
131 // These increase the overhead of netdata.
133 // These calculations are allocated and linked (->next)
135 // Then are also linked to RRDSET (of course only when the
136 // chart is found, via ->rrdset_next and ->rrdset_prev).
137 // This double-linked list is maintained sorted at all times
138 // having as RRDSET->calculations the RRDCALC to be processed
140 typedef struct rrdcalc {
144 char *chart; // the chart name
147 char *dimensions; // the chart dimensions
149 int group; // grouping method: average, max, etc.
150 int before; // ending point in time-series
151 int after; // starting point in time-series
152 uint32_t options; // calculation options
153 int update_every; // update frequency for the calculation
158 EVAL_EXPRESSION *expression;
160 calculated_number value;
166 struct rrdset *rrdset;
167 struct rrdcalc *rrdset_next;
168 struct rrdcalc *rrdset_prev;
170 struct rrdcalc *next;
175 // these are to be applied to charts found dynamically
176 // based on their context.
177 typedef struct rrdcalctemplate {
182 uint32_t hash_context;
186 int group; // grouping method: average, max, etc.
187 int before; // ending point in time-series
188 int after; // starting point in time-series
189 uint32_t options; // calculation options
190 int update_every; // update frequency for the calculation
192 struct rrdcalctemplate *next;
197 extern void rrdsetvar_rename_all(RRDSET *st);
198 extern RRDSETVAR *rrdsetvar_create(RRDSET *st, const char *variable, int type, void *value, uint32_t options);
199 extern void rrdsetvar_free(RRDSETVAR *rs);
201 extern void rrddimvar_rename_all(RRDDIM *rd);
202 extern RRDDIMVAR *rrddimvar_create(RRDDIM *rd, int type, const char *prefix, const char *suffix, void *value, uint32_t options);
203 extern void rrddimvar_free(RRDDIMVAR *rs);
205 extern void rrdsetcalc_link_matching(RRDSET *st);
206 extern void rrdsetcalc_unlink(RRDCALC *rc);
208 #endif //NETDATA_HEALTH_H