@cryptotaxi247 / netdata-1 / commits / 8a036f0b2

/api/v2/X part 7 (#14797)

* /api/v2/weights, points key renamed to result * /api/v2/weights, add node ids in response * /api/v2/data remove NONZERO flag when all dimensions are zero and fix MIN/MAX grouping and statistics * /api/v2/data expose view.dimensions.sts{} * /api/v2 endpoints expose agents and additional info per node, that is needed to unify cloud responses * /api/v2 nodes output now includes the duration of time spent per node * jsonwrap view object renames and cleanup * rework of the statistics returned by the query engine * swagger work * swagger work * more swagger work * updated swagger json * added the remaining of the /api/v2 endpoints to swagger * point.ar has been renamed point.arp * updated weights endpoint * fix compilation warnings

Costa Tsaousis committed Mar 28, 2023 at 15:23 UTC 8a036f0b244a15252a009524fef4702e7e000c50
18 files changed +4688 -4616
database/contexts/api_v2.c
+34 -12
@@ -97,6 +97,7 @@ struct rrdcontext_to_json_v2_data {
97 struct {
98 SIMPLE_PATTERN *scope_pattern;
99 SIMPLE_PATTERN *pattern;
100 + size_t ni;
101 } nodes;
102
103 struct {
@@ -222,6 +223,21 @@ static ssize_t rrdcontext_to_json_v2_add_context(void *data, RRDCONTEXT_ACQUIRED
223 return 1;
224 }
225
226 +void buffer_json_node_add_v2(BUFFER *wb, RRDHOST *host, size_t ni, usec_t duration_ut) {
227 + buffer_json_member_add_string(wb, "mg", host->machine_guid);
228 + if(host->node_id)
229 + buffer_json_member_add_uuid(wb, "nd", host->node_id);
230 + buffer_json_member_add_string(wb, "nm", rrdhost_hostname(host));
231 + buffer_json_member_add_uint64(wb, "ni", ni);
232 + buffer_json_member_add_object(wb, "st");
233 + buffer_json_member_add_uint64(wb, "ai", 0);
234 + buffer_json_member_add_uint64(wb, "code", 200);
235 + buffer_json_member_add_string(wb, "msg", "");
236 + if(duration_ut)
237 + buffer_json_member_add_double(wb, "ms", (NETDATA_DOUBLE)duration_ut / 1000.0);
238 + buffer_json_object_close(wb);
239 +}
240 +
241 static ssize_t rrdcontext_to_json_v2_add_host(void *data, RRDHOST *host, bool queryable_host) {
242 if(!queryable_host || !host->rrdctx.contexts)
243 // the host matches the 'scope_host' but does not match the 'host' patterns
@@ -279,9 +295,7 @@ static ssize_t rrdcontext_to_json_v2_add_host(void *data, RRDHOST *host, bool qu
295
296 if(host_matched && (ctl->options & (CONTEXTS_V2_NODES | CONTEXTS_V2_NODES_DETAILED | CONTEXTS_V2_DEBUG))) {
297 buffer_json_add_array_item_object(wb);
282 - buffer_json_member_add_string(wb, "mg", host->machine_guid);
283 - buffer_json_member_add_uuid(wb, "nd", host->node_id);
284 - buffer_json_member_add_string(wb, "nm", rrdhost_hostname(host));
298 + buffer_json_node_add_v2(wb, host, ctl->nodes.ni++, 0);
299
300 if(ctl->options & CONTEXTS_V2_NODES_DETAILED) {
301 buffer_json_member_add_string(wb, "version", rrdhost_program_version(host));
@@ -372,6 +386,21 @@ static void buffer_json_contexts_v2_options_to_array(BUFFER *wb, CONTEXTS_V2_OPT
386 buffer_json_add_array_item_string(wb, "search");
387 }
388
389 +void buffer_json_agents_array_v2(BUFFER *wb, time_t now_s) {
390 + if(!now_s)
391 + now_s = now_realtime_sec();
392 +
393 + buffer_json_member_add_array(wb, "agents");
394 + buffer_json_add_array_item_object(wb);
395 + buffer_json_member_add_string(wb, "mg", localhost->machine_guid);
396 + buffer_json_member_add_uuid(wb, "nd", localhost->node_id);
397 + buffer_json_member_add_string(wb, "nm", rrdhost_hostname(localhost));
398 + buffer_json_member_add_time_t(wb, "now", now_s);
399 + buffer_json_member_add_uint64(wb, "ai", 0);
400 + buffer_json_object_close(wb);
401 + buffer_json_array_close(wb);
402 +}
403 +
404 int rrdcontext_to_json_v2(BUFFER *wb, struct api_v2_contexts_request *req, CONTEXTS_V2_OPTIONS options) {
405 int resp = HTTP_RESP_OK;
406
@@ -398,17 +427,10 @@ int rrdcontext_to_json_v2(BUFFER *wb, struct api_v2_contexts_request *req, CONTE
427
428 time_t now_s = now_realtime_sec();
429 buffer_json_initialize(wb, "\"", "\"", 0, true, false);
430 + buffer_json_member_add_uint64(wb, "api", 2);
431 + buffer_json_agents_array_v2(wb, now_s);
432
433 if(options & CONTEXTS_V2_DEBUG) {
403 - buffer_json_member_add_object(wb, "agent");
404 - buffer_json_member_add_string(wb, "mg", localhost->machine_guid);
405 - buffer_json_member_add_uuid(wb, "nd", localhost->node_id);
406 - buffer_json_member_add_string(wb, "nm", rrdhost_hostname(localhost));
407 - if (req->q)
408 - buffer_json_member_add_string(wb, "q", req->q);
409 - buffer_json_member_add_time_t(wb, "now", now_s);
410 - buffer_json_object_close(wb);
411 -
434 buffer_json_member_add_object(wb, "request");
435
436 buffer_json_member_add_object(wb, "scope");
database/contexts/query_target.c
+2 -1
@@ -977,7 +977,7 @@ QUERY_TARGET *query_target_create(QUERY_TARGET_REQUEST *qtr) {
977 qtr->scope_contexts = qtr->contexts;
978
979 memset(&qt->db, 0, sizeof(qt->db));
980 - memset(&qt->query_stats, 0, sizeof(qt->query_stats));
980 + qt->query_points = STORAGE_POINT_UNSET;
981
982 // copy the request into query_thread_target
983 qt->request = *qtr;
@@ -985,6 +985,7 @@ QUERY_TARGET *query_target_create(QUERY_TARGET_REQUEST *qtr) {
985 query_target_generate_name(qt);
986 qt->window.after = qt->request.after;
987 qt->window.before = qt->request.before;
988 + qt->window.options = qt->request.options;
989 rrdr_relative_window_to_absolute(&qt->window.after, &qt->window.before, &qt->window.now);
990
991 // prepare our local variables - we need these across all these functions
database/contexts/rrdcontext.h
+42 -46
@@ -144,55 +144,47 @@ typedef struct query_plan_entry {
144
145 #define QUERY_PLANS_MAX (RRD_STORAGE_TIERS)
146
147 -struct query_metrics_counts {
148 - size_t selected;
149 - size_t excluded;
150 - size_t queried;
151 - size_t failed;
152 -};
153 -
154 -struct query_instances_counts {
155 - size_t selected;
156 - size_t excluded;
157 - size_t queried;
158 - size_t failed;
159 -};
160 -
161 -struct query_alerts_counts {
162 - size_t clear;
163 - size_t warning;
164 - size_t critical;
165 - size_t other;
166 -};
167 -
168 -struct query_data_statistics { // time-aggregated (group points) statistics
169 - size_t group_points; // the number of group points the query generated
170 - NETDATA_DOUBLE min; // the min value of the group points
171 - NETDATA_DOUBLE max; // the max value of the group points
172 - NETDATA_DOUBLE sum; // the sum of the group points
173 - NETDATA_DOUBLE volume; // the volume of the group points
174 - NETDATA_DOUBLE anomaly_sum; // the anomaly sum of the group points
175 -};
147 +typedef struct query_metrics_counts { // counts the number of metrics related to an object
148 + size_t selected; // selected to be queried
149 + size_t excluded; // not selected to be queried
150 + size_t queried; // successfully queried
151 + size_t failed; // failed to be queried
152 +} QUERY_METRICS_COUNTS;
153 +
154 +typedef struct query_instances_counts { // counts the number of instances related to an object
155 + size_t selected; // selected to be queried
156 + size_t excluded; // not selected to be queried
157 + size_t queried; // successfully queried
158 + size_t failed; // failed to be queried
159 +} QUERY_INSTANCES_COUNTS;
160 +
161 +typedef struct query_alerts_counts { // counts the number of alerts related to an object
162 + size_t clear; // number of alerts in clear state
163 + size_t warning; // number of alerts in warning state
164 + size_t critical; // number of alerts in critical state
165 + size_t other; // number of alerts in any other state
166 +} QUERY_ALERTS_COUNTS;
167
168 typedef struct query_node {
169 uint32_t slot;
170 RRDHOST *rrdhost;
171 char node_id[UUID_STR_LEN];
172 + usec_t duration_ut;
173
182 - struct query_data_statistics query_stats;
183 - struct query_instances_counts instances;
184 - struct query_metrics_counts metrics;
185 - struct query_alerts_counts alerts;
174 + STORAGE_POINT query_points;
175 + QUERY_INSTANCES_COUNTS instances;
176 + QUERY_METRICS_COUNTS metrics;
177 + QUERY_ALERTS_COUNTS alerts;
178 } QUERY_NODE;
179
180 typedef struct query_context {
181 uint32_t slot;
182 RRDCONTEXT_ACQUIRED *rca;
183
192 - struct query_data_statistics query_stats;
193 - struct query_instances_counts instances;
194 - struct query_metrics_counts metrics;
195 - struct query_alerts_counts alerts;
184 + STORAGE_POINT query_points;
185 + QUERY_INSTANCES_COUNTS instances;
186 + QUERY_METRICS_COUNTS metrics;
187 + QUERY_ALERTS_COUNTS alerts;
188 } QUERY_CONTEXT;
189
190 typedef struct query_instance {
@@ -202,9 +194,9 @@ typedef struct query_instance {
194 STRING *id_fqdn; // never access this directly - it is created on demand via query_instance_id_fqdn()
195 STRING *name_fqdn; // never access this directly - it is created on demand via query_instance_name_fqdn()
196
205 - struct query_data_statistics query_stats;
206 - struct query_metrics_counts metrics;
207 - struct query_alerts_counts alerts;
197 + STORAGE_POINT query_points;
198 + QUERY_METRICS_COUNTS metrics;
199 + QUERY_ALERTS_COUNTS alerts;
200 } QUERY_INSTANCE;
201
202 typedef struct query_dimension {
@@ -236,7 +228,7 @@ typedef struct query_metric {
228 uint32_t query_dimension_id;
229 } link;
230
239 - struct query_data_statistics query_stats;
231 + STORAGE_POINT query_points;
232
233 struct {
234 size_t slot;
@@ -245,6 +237,7 @@ typedef struct query_metric {
237 STRING *units;
238 } grouped_as;
239
240 + usec_t duration_ut;
241 } QUERY_METRIC;
242
243 #define MAX_QUERY_TARGET_ID_LENGTH 255
@@ -320,6 +313,8 @@ struct query_versions {
313 uint64_t alerts_soft_hash;
314 };
315
316 +#define query_view_update_every(qt) ((qt)->window.group * (qt)->window.query_granularity)
317 +
318 typedef struct query_target {
319 char id[MAX_QUERY_TARGET_ID_LENGTH + 1]; // query identifier (for logging)
320 QUERY_TARGET_REQUEST request;
@@ -334,10 +329,10 @@ typedef struct query_target {
329 time_t after; // the absolute timestamp this query is about
330 time_t before; // the absolute timestamp this query is about
331 time_t query_granularity;
337 - size_t points; // the number of points the query will return (maybe different from the request)
332 + size_t points; // the number of points the query will return (maybe different from the request)
333 size_t group;
339 - RRDR_TIME_GROUPING group_method;
340 - const char *group_options;
334 + RRDR_TIME_GROUPING time_group_method;
335 + const char *time_group_options;
336 size_t resampling_group;
337 NETDATA_DOUBLE resampling_divisor;
338 RRDR_OPTIONS options;
@@ -396,7 +391,7 @@ typedef struct query_target {
391 char *label_keys[GROUP_BY_MAX_LABEL_KEYS];
392 } group_by;
393
399 - struct query_data_statistics query_stats;
394 + STORAGE_POINT query_points;
395
396 struct query_versions versions;
397
@@ -404,7 +399,6 @@ typedef struct query_target {
399 usec_t received_ut;
400 usec_t preprocessed_ut;
401 usec_t executed_ut;
407 - usec_t group_by_ut;
402 usec_t finished_ut;
403 } timings;
404 } QUERY_TARGET;
@@ -485,6 +479,8 @@ typedef enum __attribute__ ((__packed__)) {
479 int rrdcontext_to_json_v2(BUFFER *wb, struct api_v2_contexts_request *req, CONTEXTS_V2_OPTIONS options);
480
481 RRDCONTEXT_TO_JSON_OPTIONS rrdcontext_to_json_parse_options(char *o);
482 +void buffer_json_agents_array_v2(BUFFER *wb, time_t now_s);
483 +void buffer_json_node_add_v2(BUFFER *wb, RRDHOST *host, size_t ni, usec_t duration_ut);
484
485 // ----------------------------------------------------------------------------
486 // scope
libnetdata/libnetdata.h
+5 -2
@@ -377,8 +377,8 @@ typedef struct storage_point {
377 time_t start_time_s; // the time the point starts
378 time_t end_time_s; // the time the point ends
379
380 - size_t count; // the number of original points aggregated
381 - size_t anomaly_count; // the number of original points found anomalous
380 + uint32_t count; // the number of original points aggregated
381 + uint32_t anomaly_count; // the number of original points found anomalous
382
383 SN_FLAGS flags; // flags stored with the point
384 } STORAGE_POINT;
@@ -482,6 +482,9 @@ typedef struct storage_point {
482 #define storage_point_anomaly_rate(sp) \
483 (NETDATA_DOUBLE)(storage_point_is_unset(sp) ? 0.0 : (NETDATA_DOUBLE)((sp).anomaly_count) * 100.0 / (NETDATA_DOUBLE)((sp).count))
484
485 +#define storage_point_average_value(sp) \
486 + ((sp).count ? (sp).sum / (NETDATA_DOUBLE)((sp).count) : 0.0)
487 +
488 // ---------------------------------------------------------------------------------------------
489
490 void netdata_fix_chart_id(char *s);
web/api/formatters/json/json.c
+2 -2
@@ -247,7 +247,7 @@ void rrdr2json(RRDR *r, BUFFER *wb, RRDR_OPTIONS options, int datatable) {
247
248 void rrdr2json_v2(RRDR *r, BUFFER *wb) {
249 QUERY_TARGET *qt = r->internal.qt;
250 - RRDR_OPTIONS options = qt->request.options;
250 + RRDR_OPTIONS options = qt->window.options;
251
252 bool expose_gbc = query_target_aggregatable(qt);
253
@@ -268,7 +268,7 @@ void rrdr2json_v2(RRDR *r, BUFFER *wb) {
268
269 buffer_json_member_add_object(wb, "point");
270 buffer_json_member_add_uint64(wb, "value", 0);
271 - buffer_json_member_add_uint64(wb, "ar", 1);
271 + buffer_json_member_add_uint64(wb, "arp", 1);
272 buffer_json_member_add_uint64(wb, "pa", 2);
273 if(expose_gbc)
274 buffer_json_member_add_uint64(wb, "count", 3);
web/api/formatters/json_wrapper.c
+155 -116
@@ -101,7 +101,7 @@ struct summary_total_counts {
101 size_t failed;
102 };
103
104 -static inline void aggregate_into_summary_totals(struct summary_total_counts *totals, struct query_metrics_counts *metrics) {
104 +static inline void aggregate_into_summary_totals(struct summary_total_counts *totals, QUERY_METRICS_COUNTS *metrics) {
105 if(unlikely(!totals || !metrics))
106 return;
107
@@ -139,7 +139,7 @@ static inline void query_target_total_counts(BUFFER *wb, const char *key, struct
139 buffer_json_object_close(wb);
140 }
141
142 -static inline void query_target_metric_counts(BUFFER *wb, struct query_metrics_counts *metrics) {
142 +static inline void query_target_metric_counts(BUFFER *wb, QUERY_METRICS_COUNTS *metrics) {
143 if(!metrics->selected && !metrics->queried && !metrics->failed && !metrics->excluded)
144 return;
145
@@ -160,7 +160,7 @@ static inline void query_target_metric_counts(BUFFER *wb, struct query_metrics_c
160 buffer_json_object_close(wb);
161 }
162
163 -static inline void query_target_instance_counts(BUFFER *wb, struct query_instances_counts *instances) {
163 +static inline void query_target_instance_counts(BUFFER *wb, QUERY_INSTANCES_COUNTS *instances) {
164 if(!instances->selected && !instances->queried && !instances->failed && !instances->excluded)
165 return;
166
@@ -181,7 +181,7 @@ static inline void query_target_instance_counts(BUFFER *wb, struct query_instanc
181 buffer_json_object_close(wb);
182 }
183
184 -static inline void query_target_alerts_counts(BUFFER *wb, struct query_alerts_counts *alerts, const char *name, bool array) {
184 +static inline void query_target_alerts_counts(BUFFER *wb, QUERY_ALERTS_COUNTS *alerts, const char *name, bool array) {
185 if(!alerts->clear && !alerts->other && !alerts->critical && !alerts->warning)
186 return;
187
@@ -208,40 +208,36 @@ static inline void query_target_alerts_counts(BUFFER *wb, struct query_alerts_co
208 buffer_json_object_close(wb);
209 }
210
211 -static inline void query_target_data_statistics(BUFFER *wb, QUERY_TARGET *qt, struct query_data_statistics *d) {
212 - if(!d->group_points)
211 +static inline void query_target_points_statistics(BUFFER *wb, QUERY_TARGET *qt, STORAGE_POINT *sp) {
212 + if(!sp->count)
213 return;
214
215 buffer_json_member_add_object(wb, "sts");
216
217 - buffer_json_member_add_double(wb, "min", d->min);
218 - buffer_json_member_add_double(wb, "max", d->max);
217 + buffer_json_member_add_double(wb, "min", sp->min);
218 + buffer_json_member_add_double(wb, "max", sp->max);
219
220 if(query_target_aggregatable(qt)) {
221 - buffer_json_member_add_uint64(wb, "cnt", d->group_points);
221 + buffer_json_member_add_uint64(wb, "cnt", sp->count);
222
223 - if(d->sum != 0.0)
224 - buffer_json_member_add_double(wb, "sum", d->sum);
225 -
226 - if(d->volume != 0.0)
227 - buffer_json_member_add_double(wb, "vol", d->volume);
223 + if(sp->sum != 0.0) {
224 + buffer_json_member_add_double(wb, "sum", sp->sum);
225 + buffer_json_member_add_double(wb, "vol", sp->sum * (NETDATA_DOUBLE) query_view_update_every(qt));
226 + }
227
229 - if(d->anomaly_sum != 0.0)
230 - buffer_json_member_add_double(wb, "ars", d->anomaly_sum);
228 + if(sp->anomaly_count != 0)
229 + buffer_json_member_add_double(wb, "ars", storage_point_anomaly_rate(*sp));
230 }
231 else {
233 -// buffer_json_member_add_double(wb, "min", d->min);
234 -// buffer_json_member_add_double(wb, "max", d->max);
235 -
236 - NETDATA_DOUBLE avg = (d->group_points) ? d->sum / (NETDATA_DOUBLE)d->group_points : 0.0;
232 + NETDATA_DOUBLE avg = (sp->count) ? sp->sum / (NETDATA_DOUBLE)sp->count : 0.0;
233 if(avg != 0.0)
234 buffer_json_member_add_double(wb, "avg", avg);
235
240 - NETDATA_DOUBLE arp = (d->group_points) ? d->anomaly_sum / (NETDATA_DOUBLE)d->group_points : 0.0;
236 + NETDATA_DOUBLE arp = storage_point_anomaly_rate(*sp);
237 if(arp != 0.0)
238 buffer_json_member_add_double(wb, "arp", arp);
239
244 - NETDATA_DOUBLE con = (qt->query_stats.volume > 0) ? d->volume * 100.0 / qt->query_stats.volume : 0.0;
240 + NETDATA_DOUBLE con = (qt->query_points.sum > 0.0) ? sp->sum * 100.0 / qt->query_points.sum : 0.0;
241 if(con != 0.0)
242 buffer_json_member_add_double(wb, "con", con);
243 }
@@ -254,15 +250,11 @@ static void query_target_summary_nodes_v2(BUFFER *wb, QUERY_TARGET *qt, const ch
250 QUERY_NODE *qn = query_node(qt, c);
251 RRDHOST *host = qn->rrdhost;
252 buffer_json_add_array_item_object(wb);
257 - buffer_json_member_add_uint64(wb, "ni", qn->slot);
258 - buffer_json_member_add_string(wb, "mg", host->machine_guid);
259 - if(qn->node_id[0])
260 - buffer_json_member_add_string(wb, "nd", qn->node_id);
261 - buffer_json_member_add_string(wb, "nm", rrdhost_hostname(host));
253 + buffer_json_node_add_v2(wb, host, qn->slot, qn->duration_ut);
254 query_target_instance_counts(wb, &qn->instances);
255 query_target_metric_counts(wb, &qn->metrics);
256 query_target_alerts_counts(wb, &qn->alerts, NULL, false);
265 - query_target_data_statistics(wb, qt, &qn->query_stats);
257 + query_target_points_statistics(wb, qt, &qn->query_points);
258 buffer_json_object_close(wb);
259
260 aggregate_into_summary_totals(totals, &qn->metrics);
@@ -275,16 +267,16 @@ static size_t query_target_summary_contexts_v2(BUFFER *wb, QUERY_TARGET *qt, con
267 DICTIONARY *dict = dictionary_create(DICT_OPTION_SINGLE_THREADED | DICT_OPTION_DONT_OVERWRITE_VALUE);
268
269 struct {
278 - struct query_data_statistics query_stats;
279 - struct query_instances_counts instances;
280 - struct query_metrics_counts metrics;
281 - struct query_alerts_counts alerts;
282 - } x = { 0 }, *z;
270 + STORAGE_POINT query_points;
271 + QUERY_INSTANCES_COUNTS instances;
272 + QUERY_METRICS_COUNTS metrics;
273 + QUERY_ALERTS_COUNTS alerts;
274 + } *z;
275
276 for (long c = 0; c < (long) qt->contexts.used; c++) {
277 QUERY_CONTEXT *qc = query_context(qt, c);
278
287 - z = dictionary_set(dict, rrdcontext_acquired_id(qc->rca), &x, sizeof(x));
279 + z = dictionary_set(dict, rrdcontext_acquired_id(qc->rca), NULL, sizeof(*z));
280
281 z->instances.selected += qc->instances.selected;
282 z->instances.excluded += qc->instances.selected;
@@ -300,7 +292,7 @@ static size_t query_target_summary_contexts_v2(BUFFER *wb, QUERY_TARGET *qt, con
292 z->alerts.warning += qc->alerts.warning;
293 z->alerts.critical += qc->alerts.critical;
294
303 - query_target_merge_data_statistics(&z->query_stats, &qc->query_stats);
295 + storage_point_merge_to(z->query_points, qc->query_points);
296 }
297
298 size_t unique_contexts = dictionary_entries(dict);
@@ -310,7 +302,7 @@ static size_t query_target_summary_contexts_v2(BUFFER *wb, QUERY_TARGET *qt, con
302 query_target_instance_counts(wb, &z->instances);
303 query_target_metric_counts(wb, &z->metrics);
304 query_target_alerts_counts(wb, &z->alerts, NULL, false);
313 - query_target_data_statistics(wb, qt, &z->query_stats);
305 + query_target_points_statistics(wb, qt, &z->query_points);
306 buffer_json_object_close(wb);
307
308 aggregate_into_summary_totals(totals, &z->metrics);
@@ -334,8 +326,7 @@ static void query_target_summary_instances_v1(BUFFER *wb, QUERY_TARGET *qt, cons
326 rrdinstance_acquired_id(qi->ria),
327 rrdinstance_acquired_name(qi->ria));
328
337 - bool existing = 0;
338 - bool *set = dictionary_set(dict, name, &existing, sizeof(bool));
329 + bool *set = dictionary_set(dict, name, NULL, sizeof(*set));
330 if (!*set) {
331 *set = true;
332 buffer_json_add_array_item_array(wb);
@@ -369,7 +360,7 @@ static void query_target_summary_instances_v2(BUFFER *wb, QUERY_TARGET *qt, cons
360 // buffer_json_member_add_string(wb, "nd", qh->node_id);
361 query_target_metric_counts(wb, &qi->metrics);
362 query_target_alerts_counts(wb, &qi->alerts, NULL, false);
372 - query_target_data_statistics(wb, qt, &qi->query_stats);
363 + query_target_points_statistics(wb, qt, &qi->query_points);
364 buffer_json_object_close(wb);
365
366 aggregate_into_summary_totals(totals, &qi->metrics);
@@ -385,8 +376,8 @@ static void query_target_summary_dimensions_v12(BUFFER *wb, QUERY_TARGET *qt, co
376 struct {
377 const char *id;
378 const char *name;
388 - struct query_data_statistics query_stats;
389 - struct query_metrics_counts metrics;
379 + STORAGE_POINT query_points;
380 + QUERY_METRICS_COUNTS metrics;
381 } *z;
382 size_t q = 0;
383 for (long c = 0; c < (long) qt->dimensions.used; c++) {
@@ -426,7 +417,7 @@ static void query_target_summary_dimensions_v12(BUFFER *wb, QUERY_TARGET *qt, co
417
418 if(qm->status & RRDR_DIMENSION_QUERIED) {
419 z->metrics.queried++;
429 - query_target_merge_data_statistics(&z->query_stats, &qm->query_stats);
420 + storage_point_merge_to(z->query_points, qm->query_points);
421 }
422 }
423 else
@@ -440,7 +431,7 @@ static void query_target_summary_dimensions_v12(BUFFER *wb, QUERY_TARGET *qt, co
431 buffer_json_member_add_string(wb, "nm", z->name);
432
433 query_target_metric_counts(wb, &z->metrics);
443 - query_target_data_statistics(wb, qt, &z->query_stats);
434 + query_target_points_statistics(wb, qt, &z->query_points);
435 buffer_json_object_close(wb);
436
437 aggregate_into_summary_totals(totals, &z->metrics);
@@ -466,38 +457,34 @@ struct rrdlabels_formatting_v2 {
457 struct rrdlabels_keys_dict_entry {
458 const char *name;
459 DICTIONARY *values;
469 - struct query_data_statistics query_stats;
470 - struct query_metrics_counts metrics;
460 + STORAGE_POINT query_points;
461 + QUERY_METRICS_COUNTS metrics;
462 };
463
464 struct rrdlabels_key_value_dict_entry {
465 const char *key;
466 const char *value;
476 - struct query_data_statistics query_stats;
477 - struct query_metrics_counts metrics;
467 + STORAGE_POINT query_points;
468 + QUERY_METRICS_COUNTS metrics;
469 };
470
471 static int rrdlabels_formatting_v2(const char *name, const char *value, RRDLABEL_SRC ls __maybe_unused, void *data) {
472 struct rrdlabels_formatting_v2 *t = data;
473
483 - struct rrdlabels_keys_dict_entry k = {
484 - .name = name,
485 - .values = NULL,
486 - .metrics = (struct query_metrics_counts){ 0 },
487 - }, *d = dictionary_set(t->keys, name, &k, sizeof(k));
488 -
489 - if(!d->values)
474 + struct rrdlabels_keys_dict_entry *d = dictionary_set(t->keys, name, NULL, sizeof(*d));
475 + if(!d->values) {
476 + d->name = name;
477 d->values = dictionary_create(DICT_OPTION_SINGLE_THREADED | DICT_OPTION_DONT_OVERWRITE_VALUE);
478 + }
479
480 char n[RRD_ID_LENGTH_MAX * 2 + 2];
481 snprintfz(n, RRD_ID_LENGTH_MAX * 2, "%s:%s", name, value);
482
495 - struct rrdlabels_key_value_dict_entry x = {
496 - .key = name,
497 - .value = value,
498 - .query_stats = (struct query_data_statistics) { 0 },
499 - .metrics = (struct query_metrics_counts){ 0 },
500 - }, *z = dictionary_set(d->values, n, &x, sizeof(x));
483 + struct rrdlabels_key_value_dict_entry *z = dictionary_set(d->values, n, NULL, sizeof(*z));
484 + if(!z->key) {
485 + z->key = name;
486 + z->value = value;
487 + }
488
489 if(t->v2) {
490 QUERY_INSTANCE *qi = t->qi;
@@ -512,8 +499,8 @@ static int rrdlabels_formatting_v2(const char *name, const char *value, RRDLABEL
499 d->metrics.queried += qi->metrics.queried;
500 d->metrics.failed += qi->metrics.failed;
501
515 - query_target_merge_data_statistics(&z->query_stats, &qi->query_stats);
516 - query_target_merge_data_statistics(&d->query_stats, &qi->query_stats);
502 + storage_point_merge_to(z->query_points, qi->query_points);
503 + storage_point_merge_to(d->query_points, qi->query_points);
504 }
505
506 return 1;
@@ -537,7 +524,7 @@ static void query_target_summary_labels_v12(BUFFER *wb, QUERY_TARGET *qt, const
524 buffer_json_add_array_item_object(wb);
525 buffer_json_member_add_string(wb, "id", d_dfe.name);
526 query_target_metric_counts(wb, &d->metrics);
540 - query_target_data_statistics(wb, qt, &d->query_stats);
527 + query_target_points_statistics(wb, qt, &d->query_points);
528 aggregate_into_summary_totals(key_totals, &d->metrics);
529 buffer_json_member_add_array(wb, "vl");
530 }
@@ -547,7 +534,7 @@ static void query_target_summary_labels_v12(BUFFER *wb, QUERY_TARGET *qt, const
534 buffer_json_add_array_item_object(wb);
535 buffer_json_member_add_string(wb, "id", z->value);
536 query_target_metric_counts(wb, &z->metrics);
550 - query_target_data_statistics(wb, qt, &z->query_stats);
537 + query_target_points_statistics(wb, qt, &z->query_points);
538 buffer_json_object_close(wb);
539 aggregate_into_summary_totals(value_totals, &z->metrics);
540 } else {
@@ -571,7 +558,7 @@ static void query_target_summary_labels_v12(BUFFER *wb, QUERY_TARGET *qt, const
558
559 static void query_target_summary_alerts_v2(BUFFER *wb, QUERY_TARGET *qt, const char *key) {
560 buffer_json_member_add_array(wb, key);
574 - struct query_alerts_counts x = { 0 }, *z;
561 + QUERY_ALERTS_COUNTS *z;
562
563 DICTIONARY *dict = dictionary_create(DICT_OPTION_SINGLE_THREADED | DICT_OPTION_DONT_OVERWRITE_VALUE);
564 for (long c = 0; c < (long) qt->instances.used; c++) {
@@ -581,7 +568,7 @@ static void query_target_summary_alerts_v2(BUFFER *wb, QUERY_TARGET *qt, const c
568 netdata_rwlock_rdlock(&st->alerts.rwlock);
569 if (st->alerts.base) {
570 for (RRDCALC *rc = st->alerts.base; rc; rc = rc->next) {
584 - z = dictionary_set(dict, string2str(rc->name), &x, sizeof(x));
571 + z = dictionary_set(dict, string2str(rc->name), NULL, sizeof(*z));
572
573 switch(rc->status) {
574 case RRDCALC_STATUS_CLEAR:
@@ -720,52 +707,102 @@ static inline size_t rrdr_dimension_view_latest_values(BUFFER *wb, const char *k
707 return i;
708 }
709
723 -static inline void rrdr_dimension_view_average_values(BUFFER *wb, const char *key, RRDR *r, RRDR_OPTIONS options) {
724 - if(!r->dv)
710 +static inline void rrdr_dimension_query_points_statistics(BUFFER *wb, const char *key, RRDR *r, RRDR_OPTIONS options, bool dview) {
711 + STORAGE_POINT *sp = (dview) ? r->dview : r->dqp;
712 + NETDATA_DOUBLE anomaly_rate_multiplier = (dview) ? RRDR_DVIEW_ANOMALY_COUNT_MULTIPLIER : 1.0;
713 +
714 + if(unlikely(!sp))
715 return;
716
727 - buffer_json_member_add_array(wb, key);
717 + if(key)
718 + buffer_json_member_add_object(wb, key);
719
720 + buffer_json_member_add_array(wb, "min");
721 for(size_t c = 0; c < r->d ; c++) {
730 - if(!rrdr_dimension_should_be_exposed(r->od[c], options))
722 + if (!rrdr_dimension_should_be_exposed(r->od[c], options))
723 continue;
724
733 - buffer_json_add_array_item_double(wb, r->dv[c]);
725 + buffer_json_add_array_item_double(wb, sp[c].min);
726 }
727 + buffer_json_array_close(wb);
728 +
729 + buffer_json_member_add_array(wb, "max");
730 + for(size_t c = 0; c < r->d ; c++) {
731 + if (!rrdr_dimension_should_be_exposed(r->od[c], options))
732 + continue;
733
734 + buffer_json_add_array_item_double(wb, sp[c].max);
735 + }
736 buffer_json_array_close(wb);
737 -}
737
739 -static inline void rrdr_dimension_view_minimum_values(BUFFER *wb, const char *key, RRDR *r, RRDR_OPTIONS options) {
740 - if(!r->dmin)
741 - return;
738 + if(options & RRDR_OPTION_RETURN_RAW) {
739 + buffer_json_member_add_array(wb, "sum");
740 + for(size_t c = 0; c < r->d ; c++) {
741 + if (!rrdr_dimension_should_be_exposed(r->od[c], options))
742 + continue;
743
743 - buffer_json_member_add_array(wb, key);
744 + buffer_json_add_array_item_double(wb, sp[c].sum);
745 + }
746 + buffer_json_array_close(wb);
747
745 - for(size_t c = 0; c < r->d ; c++) {
746 - if(!rrdr_dimension_should_be_exposed(r->od[c], options))
747 - continue;
748 + buffer_json_member_add_array(wb, "cnt");
749 + for(size_t c = 0; c < r->d ; c++) {
750 + if (!rrdr_dimension_should_be_exposed(r->od[c], options))
751 + continue;
752 +
753 + buffer_json_add_array_item_uint64(wb, sp[c].count);
754 + }
755 + buffer_json_array_close(wb);
756
749 - buffer_json_add_array_item_double(wb, r->dmin[c]);
757 + buffer_json_member_add_array(wb, "ars");
758 + for(size_t c = 0; c < r->d ; c++) {
759 + if (!rrdr_dimension_should_be_exposed(r->od[c], options))
760 + continue;
761 +
762 + buffer_json_add_array_item_uint64(wb, sp[c].anomaly_count * 100 / anomaly_rate_multiplier);
763 + }
764 + buffer_json_array_close(wb);
765 }
766 + else {
767 + NETDATA_DOUBLE sum = 0.0;
768 + for(size_t c = 0; c < r->d ; c++) {
769 + if(!rrdr_dimension_should_be_exposed(r->od[c], options))
770 + continue;
771
752 - buffer_json_array_close(wb);
753 -}
772 + sum += ABS(sp[c].sum);
773 + }
774
755 -static inline void rrdr_dimension_view_maximum_values(BUFFER *wb, const char *key, RRDR *r, RRDR_OPTIONS options) {
756 - if(!r->dmin)
757 - return;
775 + buffer_json_member_add_array(wb, "avg");
776 + for(size_t c = 0; c < r->d ; c++) {
777 + if (!rrdr_dimension_should_be_exposed(r->od[c], options))
778 + continue;
779
759 - buffer_json_member_add_array(wb, key);
780 + buffer_json_add_array_item_double(wb, storage_point_average_value(sp[c]));
781 + }
782 + buffer_json_array_close(wb);
783
761 - for(size_t c = 0; c < r->d ; c++) {
762 - if(!rrdr_dimension_should_be_exposed(r->od[c], options))
763 - continue;
784 + buffer_json_member_add_array(wb, "arp");
785 + for(size_t c = 0; c < r->d ; c++) {
786 + if (!rrdr_dimension_should_be_exposed(r->od[c], options))
787 + continue;
788
765 - buffer_json_add_array_item_double(wb, r->dmax[c]);
789 + buffer_json_add_array_item_double(wb, storage_point_anomaly_rate(sp[c]) / anomaly_rate_multiplier);
790 + }
791 + buffer_json_array_close(wb);
792 +
793 + buffer_json_member_add_array(wb, "con");
794 + for(size_t c = 0; c < r->d ; c++) {
795 + if (!rrdr_dimension_should_be_exposed(r->od[c], options))
796 + continue;
797 +
798 + NETDATA_DOUBLE con = (sum > 0.0) ? ABS(sp[c].sum) * 100.0 / sum : 0.0;
799 + buffer_json_add_array_item_double(wb, con);
800 + }
801 + buffer_json_array_close(wb);
802 }
803
768 - buffer_json_array_close(wb);
804 + if(key)
805 + buffer_json_object_close(wb);
806 }
807
808 static void rrdr_timings_v12(BUFFER *wb, const char *key, RRDR *r) {
@@ -775,8 +812,7 @@ static void rrdr_timings_v12(BUFFER *wb, const char *key, RRDR *r) {
812 buffer_json_member_add_object(wb, key);
813 buffer_json_member_add_double(wb, "prep_ms", (NETDATA_DOUBLE)(qt->timings.preprocessed_ut - qt->timings.received_ut) / USEC_PER_MS);
814 buffer_json_member_add_double(wb, "query_ms", (NETDATA_DOUBLE)(qt->timings.executed_ut - qt->timings.preprocessed_ut) / USEC_PER_MS);
778 - buffer_json_member_add_double(wb, "group_by_ms", (NETDATA_DOUBLE)(qt->timings.group_by_ut - qt->timings.executed_ut) / USEC_PER_MS);
779 - buffer_json_member_add_double(wb, "output_ms", (NETDATA_DOUBLE)(qt->timings.finished_ut - qt->timings.group_by_ut) / USEC_PER_MS);
815 + buffer_json_member_add_double(wb, "output_ms", (NETDATA_DOUBLE)(qt->timings.finished_ut - qt->timings.executed_ut) / USEC_PER_MS);
816 buffer_json_member_add_double(wb, "total_ms", (NETDATA_DOUBLE)(qt->timings.finished_ut - qt->timings.received_ut) / USEC_PER_MS);
817 buffer_json_object_close(wb);
818 }
@@ -784,7 +820,7 @@ static void rrdr_timings_v12(BUFFER *wb, const char *key, RRDR *r) {
820 void rrdr_json_wrapper_begin(RRDR *r, BUFFER *wb) {
821 QUERY_TARGET *qt = r->internal.qt;
822 DATASOURCE_FORMAT format = qt->request.format;
787 - RRDR_OPTIONS options = qt->request.options;
823 + RRDR_OPTIONS options = qt->window.options;
824
825 long rows = rrdr_rows(r);
826
@@ -812,7 +848,7 @@ void rrdr_json_wrapper_begin(RRDR *r, BUFFER *wb) {
848 buffer_json_member_add_time_t(wb, "after", r->view.after);
849 buffer_json_member_add_time_t(wb, "before", r->view.before);
850 buffer_json_member_add_string(wb, "group", time_grouping_tostring(qt->request.time_group_method));
815 - web_client_api_request_v1_data_options_to_buffer_json_array(wb, "options", r->view.options);
851 + web_client_api_request_v1_data_options_to_buffer_json_array(wb, "options", options);
852
853 if(!rrdr_dimension_names(wb, "dimension_names", r, options))
854 rows = 0;
@@ -820,7 +856,7 @@ void rrdr_json_wrapper_begin(RRDR *r, BUFFER *wb) {
856 if(!rrdr_dimension_ids(wb, "dimension_ids", r, options))
857 rows = 0;
858
823 - if (r->view.options & RRDR_OPTION_ALL_DIMENSIONS) {
859 + if (options & RRDR_OPTION_ALL_DIMENSIONS) {
860 query_target_summary_instances_v1(wb, qt, "full_chart_list");
861 query_target_summary_dimensions_v12(wb, qt, "full_dimension_list", false, NULL);
862 query_target_summary_labels_v12(wb, qt, "full_chart_labels", false, NULL, NULL);
@@ -1006,8 +1042,7 @@ static void query_target_title(BUFFER *wb, QUERY_TARGET *qt, size_t contexts) {
1042
1043 size_t added = 0;
1044 for(size_t c = 0; c < qt->contexts.used ;c++) {
1009 - bool old = false;
1010 - bool *set = dictionary_set(dict, rrdcontext_acquired_id(qt->contexts.array[c].rca), &old, sizeof(old));
1045 + bool *set = dictionary_set(dict, rrdcontext_acquired_id(qt->contexts.array[c].rca), NULL, sizeof(*set));
1046 if(!*set) {
1047 *set = true;
1048 if(added)
@@ -1148,7 +1183,7 @@ static void query_target_detailed_objects_tree(BUFFER *wb, RRDR *r, RRDR_OPTIONS
1183 buffer_json_member_add_string(wb, "as", string2str(qm->grouped_as.name));
1184 }
1185
1151 - query_target_data_statistics(wb, qt, &qm->query_stats);
1186 + query_target_points_statistics(wb, qt, &qm->query_points);
1187
1188 if(options & RRDR_OPTION_DEBUG)
1189 jsonwrap_query_metric_plan(wb, qm);
@@ -1190,7 +1225,7 @@ void version_hashes_api_v2(BUFFER *wb, struct query_versions *versions) {
1225
1226 void rrdr_json_wrapper_begin2(RRDR *r, BUFFER *wb) {
1227 QUERY_TARGET *qt = r->internal.qt;
1193 - RRDR_OPTIONS options = qt->request.options;
1228 + RRDR_OPTIONS options = qt->window.options;
1229
1230 char kq[2] = "\"", // key quote
1231 sq[2] = "\""; // string quote
@@ -1201,8 +1236,8 @@ void rrdr_json_wrapper_begin2(RRDR *r, BUFFER *wb) {
1236 }
1237
1238 buffer_json_initialize(wb, kq, sq, 0, true, options & RRDR_OPTION_MINIFY);
1204 -
1239 buffer_json_member_add_uint64(wb, "api", 2);
1240 + buffer_json_agents_array_v2(wb, 0);
1241
1242 if(options & RRDR_OPTION_DEBUG) {
1243 buffer_json_member_add_string(wb, "id", qt->id);
@@ -1416,25 +1451,32 @@ void rrdr_json_wrapper_end(RRDR *r, BUFFER *wb) {
1451 void rrdr_json_wrapper_end2(RRDR *r, BUFFER *wb) {
1452 QUERY_TARGET *qt = r->internal.qt;
1453 DATASOURCE_FORMAT format = qt->request.format;
1419 - RRDR_OPTIONS options = qt->request.options;
1454 + RRDR_OPTIONS options = qt->window.options;
1455
1456 buffer_json_member_add_object(wb, "view");
1457 {
1458 query_target_title(wb, qt, r->internal.contexts);
1424 - buffer_json_member_add_string(wb, "format", rrdr_format_to_string(format));
1425 - web_client_api_request_v1_data_options_to_buffer_json_array(wb, "options", r->view.options);
1426 - buffer_json_member_add_string(wb, "time_group", time_grouping_tostring(qt->request.time_group_method));
1459 buffer_json_member_add_time_t(wb, "update_every", r->view.update_every);
1460 buffer_json_member_add_time_t(wb, "after", r->view.after);
1461 buffer_json_member_add_time_t(wb, "before", r->view.before);
1462
1431 - buffer_json_member_add_object(wb, "partial_data_trimming");
1432 - buffer_json_member_add_time_t(wb, "max_update_every", r->partial_data_trimming.max_update_every);
1433 - buffer_json_member_add_time_t(wb, "expected_after", r->partial_data_trimming.expected_after);
1434 - buffer_json_member_add_time_t(wb, "trimmed_after", r->partial_data_trimming.trimmed_after);
1435 - buffer_json_object_close(wb);
1463 + if(options & RRDR_OPTION_DEBUG) {
1464 + buffer_json_member_add_string(wb, "format", rrdr_format_to_string(format));
1465 + web_client_api_request_v1_data_options_to_buffer_json_array(wb, "options", options);
1466 + buffer_json_member_add_string(wb, "time_group", time_grouping_tostring(qt->request.time_group_method));
1467 + }
1468 +
1469 + if(options & RRDR_OPTION_DEBUG) {
1470 + buffer_json_member_add_object(wb, "partial_data_trimming");
1471 + buffer_json_member_add_time_t(wb, "max_update_every", r->partial_data_trimming.max_update_every);
1472 + buffer_json_member_add_time_t(wb, "expected_after", r->partial_data_trimming.expected_after);
1473 + buffer_json_member_add_time_t(wb, "trimmed_after", r->partial_data_trimming.trimmed_after);
1474 + buffer_json_object_close(wb);
1475 + }
1476 +
1477 + if(options & RRDR_OPTION_RETURN_RAW)
1478 + buffer_json_member_add_uint64(wb, "points", rrdr_rows(r));
1479
1437 - buffer_json_member_add_uint64(wb, "points", rrdr_rows(r));
1480 query_target_combined_units_v2(wb, qt, r->internal.contexts);
1481 query_target_combined_chart_type(wb, qt, r->internal.contexts);
1482 buffer_json_member_add_object(wb, "dimensions");
@@ -1445,11 +1487,8 @@ void rrdr_json_wrapper_end2(RRDR *r, BUFFER *wb) {
1487 rrdr_dimension_units_array_v2(wb, "units", r, options);
1488 rrdr_dimension_priority_array_v2(wb, "priorities", r, options);
1489 rrdr_dimension_aggregated_array_v2(wb, "aggregated", r, options);
1448 - rrdr_dimension_view_minimum_values(wb, "view_minimum_values", r, options);
1449 - rrdr_dimension_view_maximum_values(wb, "view_maximum_values", r, options);
1450 - rrdr_dimension_view_average_values(wb, "view_average_values", r, options);
1451 - size_t dims = rrdr_dimension_view_latest_values(wb, "view_latest_values", r, options);
1452 - buffer_json_member_add_uint64(wb, "count", dims);
1490 + rrdr_dimension_query_points_statistics(wb, NULL, r, options, true);
1491 + rrdr_dimension_query_points_statistics(wb, "sts", r, options, false);
1492 rrdr_json_group_by_labels(wb, "labels", r, options);
1493 }
1494 buffer_json_object_close(wb); // dimensions
web/api/formatters/rrd2json.c
+3 -6
@@ -4,8 +4,8 @@
4 #include "database/storage_engine.h"
5
6 inline bool query_target_has_percentage_units(struct query_target *qt) {
7 - if(qt->request.options & RRDR_OPTION_PERCENTAGE ||
8 - qt->request.time_group_method == RRDR_GROUPING_CV)
7 + if(qt->window.options & RRDR_OPTION_PERCENTAGE ||
8 + qt->window.time_group_method == RRDR_GROUPING_CV)
9 return true;
10
11 return false;
@@ -170,7 +170,6 @@ int data_query_execute(ONEWAYALLOC *owa, BUFFER *wb, QUERY_TARGET *qt, time_t *l
170 }
171
172 RRDR *r = rrd2rrdr(owa, qt);
173 - qt->timings.executed_ut = now_monotonic_usec();
173
174 if(!r) {
175 buffer_strcat(wb, "Cannot generate output with these parameters on this chart.");
@@ -191,9 +190,7 @@ int data_query_execute(ONEWAYALLOC *owa, BUFFER *wb, QUERY_TARGET *qt, time_t *l
190 *latest_timestamp = r->view.before;
191
192 DATASOURCE_FORMAT format = qt->request.format;
194 - RRDR_OPTIONS options = qt->request.options;
195 -
196 - qt->timings.group_by_ut = now_monotonic_usec();
193 + RRDR_OPTIONS options = qt->window.options;
194
195 switch(format) {
196 case DATASOURCE_SSV:
web/api/formatters/rrd2json.h
+1 -1
@@ -63,7 +63,7 @@ void rrdr_json_group_by_labels(BUFFER *wb, const char *key, RRDR *r, RRDR_OPTION
63
64 struct query_target;
65 bool query_target_has_percentage_units(struct query_target *qt);
66 -#define query_target_aggregatable(qt) (qt->request.options & RRDR_OPTION_RETURN_RAW)
66 +#define query_target_aggregatable(qt) ((qt)->window.options & RRDR_OPTION_RETURN_RAW)
67
68 int rrdset2value_api_v1(
69 RRDSET *st
web/api/formatters/value/value.c
+10 -4
@@ -107,7 +107,8 @@ QUERY_VALUE rrdmetric2value(RRDHOST *host,
107 .max = NAN,
108 .sum = NAN,
109 .anomaly_count = 0,
110 - }
110 + },
111 + .duration_ut = (r) ? r->internal.qt->timings.executed_ut - r->internal.qt->timings.received_ut : 0,
112 };
113 }
114 else {
@@ -118,11 +119,16 @@ QUERY_VALUE rrdmetric2value(RRDHOST *host,
119 .result_points = r->stats.result_points_generated,
120 .sp = {
121 .count = 0,
121 - }
122 + },
123 + .duration_ut = r->internal.qt->timings.executed_ut - r->internal.qt->timings.received_ut,
124 };
125
124 - for(size_t d = 0; d < r->d ;d++)
125 - storage_point_merge_to(qv.sp, r->drs[d]);
126 + for(size_t d = 0; d < r->internal.qt->query.used ;d++) {
127 + if(!rrdr_dimension_should_be_exposed(r->internal.qt->query.array[d].status, options))
128 + continue;
129 +
130 + storage_point_merge_to(qv.sp, r->internal.qt->query.array[d].query_points);
131 + }
132
133 for(size_t t = 0; t < storage_tiers ;t++)
134 qv.storage_points_per_tier[t] = r->internal.qt->db.tiers[t].points;
web/api/formatters/value/value.h
+1
@@ -14,6 +14,7 @@ typedef struct storage_value {
14 size_t storage_points_per_tier[RRD_STORAGE_TIERS];
15 size_t result_points;
16 STORAGE_POINT sp;
17 + usec_t duration_ut;
18 } QUERY_VALUE;
19
20 struct rrdmetric_acquired;
web/api/netdata-swagger.json
+2538 -2382
@@ -3,12 +3,210 @@
3 "info": {
4 "title": "Netdata API",
5 "description": "Real-time performance and health monitoring.",
6 - "version": "1.38"
6 + "version": "1.38",
7 + "contact": {
8 + "name": "Netdata Agent API",
9 + "email": "info@netdata.cloud",
10 + "url": "https://netdata.cloud"
11 + },
12 + "license": {
13 + "name": "GPL v3+",
14 + "url": "https://github.com/netdata/netdata/blob/master/LICENSE"
15 + }
16 },
17 + "servers": [
18 + {
19 + "url": "https://registry.my-netdata.io"
20 + },
21 + {
22 + "url": "http://registry.my-netdata.io"
23 + },
24 + {
25 + "url": "http://localhost:19999"
26 + }
27 + ],
28 + "tags": [
29 + {
30 + "name": "nodes",
31 + "description": "Everything related to monitored nodes"
32 + },
33 + {
34 + "name": "charts",
35 + "description": "Everything related to chart instances - DO NOT USE IN NEW CODE - use contexts instead"
36 + },
37 + {
38 + "name": "contexts",
39 + "description": "Everything related contexts - in new code, use this instead of charts"
40 + },
41 + {
42 + "name": "data",
43 + "description": "Everything related to data queries"
44 + },
45 + {
46 + "name": "badges",
47 + "description": "Everything related to dynamic badges based on metric data"
48 + },
49 + {
50 + "name": "weights",
51 + "description": "Everything related to scoring / weighting metrics"
52 + },
53 + {
54 + "name": "functions",
55 + "description": "Everything related to functions"
56 + },
57 + {
58 + "name": "alerts",
59 + "description": "Everything related to alerts"
60 + },
61 + {
62 + "name": "management",
63 + "description": "Everything related to managing netdata agents"
64 + }
65 + ],
66 "paths": {
67 + "/api/v2/nodes": {
68 + "get": {
69 + "operationId": "getNodes2",
70 + "tags": [
71 + "nodes"
72 + ],
73 + "summary": "Nodes Info v2",
74 + "description": "Get a list of all nodes hosted by this Netdata agent.\n",
75 + "parameters": [
76 + {
77 + "$ref": "#/components/parameters/scopeNodes"
78 + },
79 + {
80 + "$ref": "#/components/parameters/scopeContexts"
81 + },
82 + {
83 + "$ref": "#/components/parameters/filterNodes"
84 + },
85 + {
86 + "$ref": "#/components/parameters/filterContexts"
87 + }
88 + ],
89 + "responses": {
90 + "200": {
91 + "description": "OK",
92 + "content": {
93 + "application/json": {
94 + "schema": {
95 + "description": "`/api/v2/nodes` response for all nodes hosted by a Netdata agent.\n",
96 + "type": "object",
97 + "properties": {
98 + "api": {
99 + "$ref": "#/components/schemas/api"
100 + },
101 + "agents": {
102 + "$ref": "#/components/schemas/agents"
103 + },
104 + "versions": {
105 + "$ref": "#/components/schemas/versions"
106 + },
107 + "nodes": {
108 + "type": "array",
109 + "items": {
110 + "$ref": "#/components/schemas/nodeFull"
111 + }
112 + }
113 + }
114 + }
115 + }
116 + }
117 + }
118 + }
119 + }
120 + },
121 + "/api/v2/contexts": {
122 + "get": {
123 + "operationId": "getContexts2",
124 + "tags": [
125 + "contexts"
126 + ],
127 + "summary": "Contexts Info v2",
128 + "description": "Get a list of all contexts, across all nodes, hosted by this Netdata agent.\n",
129 + "parameters": [
130 + {
131 + "$ref": "#/components/parameters/scopeNodes"
132 + },
133 + {
134 + "$ref": "#/components/parameters/scopeContexts"
135 + },
136 + {
137 + "$ref": "#/components/parameters/filterNodes"
138 + },
139 + {
140 + "$ref": "#/components/parameters/filterContexts"
141 + }
142 + ],
143 + "responses": {
144 + "200": {
145 + "description": "OK",
146 + "content": {
147 + "application/json": {
148 + "schema": {
149 + "$ref": "#/components/schemas/contexts2"
150 + }
151 + }
152 + }
153 + }
154 + }
155 + }
156 + },
157 + "/api/v2/q": {
158 + "get": {
159 + "operationId": "q2",
160 + "tags": [
161 + "contexts"
162 + ],
163 + "summary": "Full Text Search v2",
164 + "description": "Get a list of contexts, across all nodes, hosted by this Netdata agent, matching a string expression\n",
165 + "parameters": [
166 + {
167 + "name": "q",
168 + "in": "query",
169 + "description": "The strings to search for, formatted as a simple pattern",
170 + "required": true,
171 + "schema": {
172 + "type": "string",
173 + "format": "simple pattern"
174 + }
175 + },
176 + {
177 + "$ref": "#/components/parameters/scopeNodes"
178 + },
179 + {
180 + "$ref": "#/components/parameters/scopeContexts"
181 + },
182 + {
183 + "$ref": "#/components/parameters/filterNodes"
184 + },
185 + {
186 + "$ref": "#/components/parameters/filterContexts"
187 + }
188 + ],
189 + "responses": {
190 + "200": {
191 + "description": "OK",
192 + "content": {
193 + "application/json": {
194 + "schema": {
195 + "$ref": "#/components/schemas/contexts2"
196 + }
197 + }
198 + }
199 + }
200 + }
201 + }
202 + },
203 "/api/v1/info": {
204 "get": {
11 - "summary": "Get netdata basic information",
205 + "operationId": "getNodeInfo1",
206 + "tags": [
207 + "nodes"
208 + ],
209 + "summary": "Node Info v1",
210 "description": "The info endpoint returns basic information about netdata. It provides:\n* netdata version\n* netdata unique id\n* list of hosts mirrored (includes itself)\n* Operating System, Virtualization, K8s nodes and Container technology information\n* List of active collector plugins and modules\n* Streaming information\n* number of alarms in the host\n * number of alarms in normal state\n * number of alarms in warning state\n * number of alarms in critical state\n",
211 "responses": {
212 "200": {
@@ -29,7 +227,11 @@
227 },
228 "/api/v1/charts": {
229 "get": {
32 - "summary": "Get a list of all charts available at the server",
230 + "operationId": "getNodeCharts1",
231 + "tags": [
232 + "charts"
233 + ],
234 + "summary": "List all charts v1 - EOL",
235 "description": "The charts endpoint returns a summary about all charts stored in the netdata server.",
236 "responses": {
237 "200": {
@@ -47,19 +249,15 @@
249 },
250 "/api/v1/chart": {
251 "get": {
50 - "summary": "Get info about a specific chart",
252 + "operationId": "getNodeChart1",
253 + "tags": [
254 + "charts"
255 + ],
256 + "summary": "Get one chart v1 - EOL",
257 "description": "The chart endpoint returns detailed information about a chart.",
258 "parameters": [
259 {
54 - "name": "chart",
55 - "in": "query",
56 - "description": "The id of the chart as returned by the /charts call.",
57 - "required": true,
58 - "schema": {
59 - "type": "string",
60 - "format": "as returned by /charts",
61 - "default": "system.cpu"
62 - }
260 + "$ref": "#/components/parameters/chart"
261 }
262 ],
263 "responses": {
@@ -84,86 +282,30 @@
282 },
283 "/api/v1/contexts": {
284 "get": {
87 - "summary": "Get a list of all contexts available at the server",
285 + "operationId": "getNodeContexts1",
286 + "tags": [
287 + "contexts"
288 + ],
289 + "summary": "Get a list of all node contexts available v1",
290 "description": "The contexts endpoint returns a summary about all contexts stored in the netdata server.",
291 "parameters": [
292 {
91 - "name": "options",
92 - "in": "query",
93 - "description": "Options that affect data generation.",
94 - "required": false,
95 - "allowEmptyValue": true,
96 - "schema": {
97 - "type": "array",
98 - "items": {
99 - "type": "string",
100 - "enum": [
101 - "full",
102 - "all",
103 - "charts",
104 - "dimensions",
105 - "labels",
106 - "uuids",
107 - "queue",
108 - "flags",
109 - "deleted",
110 - "deepscan"
111 - ]
112 - },
113 - "default": [
114 - "full"
115 - ]
116 - }
293 + "$ref": "#/components/parameters/dimensions"
294 },
295 {
119 - "name": "after",
120 - "in": "query",
121 - "description": "limit the results on context having data after this timestamp.",
122 - "required": false,
123 - "schema": {
124 - "type": "number",
125 - "format": "integer"
126 - }
296 + "$ref": "#/components/parameters/chart_label_key"
297 },
298 {
129 - "name": "before",
130 - "in": "query",
131 - "description": "limit the results on context having data before this timestamp.",
132 - "required": false,
133 - "schema": {
134 - "type": "number",
135 - "format": "integer"
136 - }
299 + "$ref": "#/components/parameters/chart_labels_filter"
300 },
301 {
139 - "name": "chart_label_key",
140 - "in": "query",
141 - "description": "a simple pattern matching charts label keys (use comma or pipe as separator)",
142 - "required": false,
143 - "allowEmptyValue": true,
144 - "schema": {
145 - "type": "string"
146 - }
302 + "$ref": "#/components/parameters/contextOptions1"
303 },
304 {
149 - "name": "chart_labels_filter",
150 - "in": "query",
151 - "description": "a simple pattern matching charts label key and values (use colon for equality, comma or pipe as separator)",
152 - "required": false,
153 - "allowEmptyValue": true,
154 - "schema": {
155 - "type": "string"
156 - }
305 + "$ref": "#/components/parameters/after"
306 },
307 {
159 - "name": "dimensions",
160 - "in": "query",
161 - "description": "a simple pattern matching dimensions (use comma or pipe as separator)",
162 - "required": false,
163 - "allowEmptyValue": true,
164 - "schema": {
165 - "type": "string"
166 - }
308 + "$ref": "#/components/parameters/before"
309 }
310 ],
311 "responses": {
@@ -182,97 +324,33 @@
324 },
325 "/api/v1/context": {
326 "get": {
327 + "operationId": "getNodeContext1",
328 + "tags": [
329 + "contexts"
330 + ],
331 "summary": "Get info about a specific context",
186 - "description": "The context endpoint returns detailed information about a given context.",
332 + "description": "The context endpoint returns detailed information about a given context.\nThe `context` parameter is required for this call.\n",
333 "parameters": [
334 {
189 - "name": "context",
190 - "in": "query",
191 - "description": "The id of the context as returned by the /contexts call.",
192 - "required": true,
193 - "schema": {
194 - "type": "string",
195 - "format": "as returned by /contexts",
196 - "default": "system.cpu"
197 - }
335 + "$ref": "#/components/parameters/context"
336 },
337 {
200 - "name": "options",
201 - "in": "query",
202 - "description": "Options that affect data generation.",
203 - "required": false,
204 - "allowEmptyValue": true,
205 - "schema": {
206 - "type": "array",
207 - "items": {
208 - "type": "string",
209 - "enum": [
210 - "full",
211 - "all",
212 - "charts",
213 - "dimensions",
214 - "labels",
215 - "uuids",
216 - "queue",
217 - "flags",
218 - "deleted",
219 - "deepscan"
220 - ]
221 - },
222 - "default": [
223 - "full"
224 - ]
225 - }
338 + "$ref": "#/components/parameters/dimensions"
339 },
340 {
228 - "name": "after",
229 - "in": "query",
230 - "description": "limit the results on context having data after this timestamp.",
231 - "required": false,
232 - "schema": {
233 - "type": "number",
234 - "format": "integer"
235 - }
341 + "$ref": "#/components/parameters/chart_label_key"
342 },
343 {
238 - "name": "before",
239 - "in": "query",
240 - "description": "limit the results on context having data before this timestamp.",
241 - "required": false,
242 - "schema": {
243 - "type": "number",
244 - "format": "integer"
245 - }
344 + "$ref": "#/components/parameters/chart_labels_filter"
345 },
346 {
248 - "name": "chart_label_key",
249 - "in": "query",
250 - "description": "a simple pattern matching charts label keys (use comma or pipe as separator)",
251 - "required": false,
252 - "allowEmptyValue": true,
253 - "schema": {
254 - "type": "string"
255 - }
347 + "$ref": "#/components/parameters/contextOptions1"
348 },
349 {
258 - "name": "chart_labels_filter",
259 - "in": "query",
260 - "description": "a simple pattern matching charts label key and values (use colon for equality, comma or pipe as separator)",
261 - "required": false,
262 - "allowEmptyValue": true,
263 - "schema": {
264 - "type": "string"
265 - }
350 + "$ref": "#/components/parameters/after"
351 },
352 {
268 - "name": "dimensions",
269 - "in": "query",
270 - "description": "a simple pattern matching dimensions (use comma or pipe as separator)",
271 - "required": false,
272 - "allowEmptyValue": true,
273 - "schema": {
274 - "type": "string"
275 - }
353 + "$ref": "#/components/parameters/before"
354 }
355 ],
356 "responses": {
@@ -295,177 +373,20 @@
373 }
374 }
375 },
298 - "/api/v1/alarm_variables": {
376 + "/api/v2/data": {
377 "get": {
300 - "summary": "List variables available to configure alarms for a chart",
301 - "description": "Returns the basic information of a chart and all the variables that can be used in alarm and template health configurations for the particular chart or family.",
378 + "operationId": "dataQuery2",
379 + "tags": [
380 + "data"
381 + ],
382 + "summary": "Data Query v2",
383 + "description": "Multi-node, multi-context, multi-instance, multi-dimension data queries, with time and metric aggregation.\n",
384 "parameters": [
385 {
304 - "name": "chart",
386 + "name": "group_by",
387 "in": "query",
306 - "description": "The id of the chart as returned by the /charts call.",
307 - "required": true,
308 - "schema": {
309 - "type": "string",
310 - "format": "as returned by /charts",
311 - "default": "system.cpu"
312 - }
313 - }
314 - ],
315 - "responses": {
316 - "200": {
317 - "description": "A javascript object with information about the chart and the available variables.",
318 - "content": {
319 - "application/json": {
320 - "schema": {
321 - "$ref": "#/components/schemas/alarm_variables"
322 - }
323 - }
324 - }
325 - },
326 - "400": {
327 - "description": "Bad request - the body will include a message stating what is wrong."
328 - },
329 - "404": {
330 - "description": "No chart with the given id is found."
331 - },
332 - "500": {
333 - "description": "Internal server error. This usually means the server is out of memory."
334 - }
335 - }
336 - }
337 - },
338 - "/api/v2/data": {
339 - "get": {
340 - "summary": "Query metrics data",
341 - "description": "Multi-node, multi-context, multi-instance, multi-dimension data queries, with time and metric aggregation.\n",
342 - "parameters": [
343 - {
344 - "name": "scope_nodes",
345 - "in": "query",
346 - "description": "A simple pattern limiting the nodes scope of the query. The scope controls both data and metadata response. The simple pattern is checked against the nodes' machine guid, node id, hostname. The default nodes scope is all nodes for which this agent has data for. Usually the nodes scope is used to slice the entire dashboard (e.g. the Global Nodes Selector at the Netdata Cloud overview dashboard). Both positive and negative simple pattern expressions are supported.\n",
347 - "required": false,
348 - "schema": {
349 - "type": "string",
350 - "format": "simple pattern",
351 - "default": "*"
352 - }
353 - },
354 - {
355 - "name": "scope_contexts",
356 - "in": "query",
357 - "description": "A simple pattern limiting the contexts scope of the query. The scope controls both data and metadata response. The default contexts scope is all contexts for which this agent has data for. Usually the contexts scope is used to slice charts of the dashboard (e.g. each context based chart has its own contexts scope, limiting the chart to all the instances of the selected contexts). Both positive and negative simple pattern expressions are supported.\n",
358 - "required": false,
359 - "schema": {
360 - "type": "string",
361 - "format": "simple pattern",
362 - "default": "*"
363 - }
364 - },
365 - {
366 - "name": "nodes",
367 - "in": "query",
368 - "description": "A simple pattern matching the nodes to be queried. This only controls the data response, not the metadata. The simple pattern is checked against the nodes' machine guid, node id, hostname. The default nodes selector is all the nodes matched by the nodes scope. Both positive and negative simple pattern expressions are supported.\n",
369 - "required": false,
370 - "schema": {
371 - "type": "string",
372 - "format": "simple pattern",
373 - "default": "*"
374 - }
375 - },
376 - {
377 - "name": "contexts",
378 - "in": "query",
379 - "description": "A simple pattern matching the contexts to be queried. This only controls the data response, not the metadata. Both positive and negative simple pattern expressions are supported.\n",
380 - "required": false,
381 - "schema": {
382 - "type": "string",
383 - "format": "simple pattern",
384 - "default": "*"
385 - }
386 - },
387 - {
388 - "name": "instances",
389 - "in": "query",
390 - "description": "A simple pattern matching the instances to be queried. The simple pattern is checked against the instance `id`, the instance `name`, the fully qualified name of the instance `id` and `name`, like `instance@machine_guid`, where `instance` is either its `id` or `name`. Both positive and negative simple pattern expressions are supported.\n",
391 - "required": false,
392 - "schema": {
393 - "type": "string",
394 - "format": "simple pattern",
395 - "default": "*"
396 - }
397 - },
398 - {
399 - "name": "labels",
400 - "in": "query",
401 - "description": "A simple pattern matching the labels to be queried. The simple pattern is checked against `name:value` of all the labels of all the eligible instances (as filtered by all the above: scope nodes, scope contexts, nodes, contexts and instances). Negative simple patterns should not be used in this filter.\n",
402 - "required": false,
403 - "schema": {
404 - "type": "string",
405 - "format": "simple pattern",
406 - "default": "*"
407 - }
408 - },
409 - {
410 - "name": "alerts",
411 - "in": "query",
412 - "description": "A simple pattern matching the alerts to be queried. The simple pattern is checked against the `name` of alerts and the combination of `name:status`, when status is one of `CLEAR`, `WARNING`, `CRITICAL`, `REMOVED`, `UNDEFINED`, `UNINITIALIZED`, of all the alerts of all the eligible instances (as filtered by all the above). A negative simple pattern will exclude the instances having the labels matched.\n",
413 - "required": false,
414 - "schema": {
415 - "type": "string",
416 - "format": "simple pattern",
417 - "default": "*"
418 - }
419 - },
420 - {
421 - "name": "dimensions",
422 - "in": "query",
423 - "description": "A simple patterns matching the dimensions to be queried. The simple pattern is checked against and `id` and the `name` of the dimensions of the eligible instances (as filtered by all the above). Both positive and negative simple pattern expressions are supported.\n",
424 - "required": false,
425 - "schema": {
426 - "type": "string",
427 - "format": "simple pattern",
428 - "default": "*"
429 - }
430 - },
431 - {
432 - "name": "before",
433 - "in": "query",
434 - "description": "The end timestamp (unix epoch) of the data query, or a negative number specifying the number of seconds\nin the past relative now.\n",
435 - "required": false,
436 - "schema": {
437 - "type": "number",
438 - "format": "integer",
439 - "default": 0
440 - }
441 - },
442 - {
443 - "name": "after",
444 - "in": "query",
445 - "description": "The start timestamp (unix epoch) of the data query, or a negative number specifying the number of seconds\nin the past relative to parameter `before`.\n",
446 - "required": false,
447 - "schema": {
448 - "type": "number",
449 - "format": "integer",
450 - "default": 0
451 - }
452 - },
453 - {
454 - "name": "points",
455 - "in": "query",
456 - "description": "The number of points to be returned. If not given, or it is <= 0, or it is bigger than the points stored in the database for the given duration, all the available collected values for the given duration will be returned.\n",
457 - "required": false,
458 - "schema": {
459 - "type": "number",
460 - "format": "integer",
461 - "default": 0
462 - }
463 - },
464 - {
465 - "name": "group_by",
466 - "in": "query",
467 - "description": "A comma separated list of the groupings required.\nAll possible values can be combined together, except `selected`. If `selected` is given in the list, all others are ignored.\nThe order they are placed in the list is currently ignored.\n",
468 - "required": false,
388 + "description": "A comma separated list of the groupings required.\nAll possible values can be combined together, except `selected`. If `selected` is given in the list, all others are ignored.\nThe order they are placed in the list is currently ignored.\n",
389 + "required": false,
390 "schema": {
391 "type": "array",
392 "items": {
@@ -499,7 +420,7 @@
420 {
421 "name": "aggregation",
422 "in": "query",
502 - "description": "The aggregation function to apply when grouping metrics together.\n",
423 + "description": "The aggregation function to apply when grouping metrics together.\nWhen option `raw` is given, `average` and `avg` behave like `sum` and the caller is expected to calculate the average.\n",
424 "required": false,
425 "schema": {
426 "type": "string",
@@ -514,194 +435,101 @@
435 }
436 },
437 {
517 - "name": "time_group",
518 - "in": "query",
519 - "description": "Time aggregation function. If multiple collected values are to be grouped in order to return fewer points, this parameters defines the method of grouping. methods supported \"min\", \"max\", \"average\", \"sum\", \"incremental-sum\". \"max\" is actually calculated on the absolute value collected (so it works for both positive and negative dimensions to return the most extreme value in either direction).\n",
520 - "required": true,
521 - "schema": {
522 - "type": "string",
523 - "enum": [
524 - "min",
525 - "max",
526 - "avg",
527 - "average",
528 - "median",
529 - "stddev",
530 - "sum",
531 - "incremental-sum",
532 - "ses",
533 - "des",
534 - "cv",
535 - "countif",
536 - "percentile",
537 - "percentile25",
538 - "percentile50",
539 - "percentile75",
540 - "percentile80",
541 - "percentile90",
542 - "percentile95",
543 - "percentile97",
544 - "percentile98",
545 - "percentile99",
546 - "trimmed-mean",
547 - "trimmed-mean1",
548 - "trimmed-mean2",
549 - "trimmed-mean3",
550 - "trimmed-mean5",
551 - "trimmed-mean10",
552 - "trimmed-mean15",
553 - "trimmed-mean20",
554 - "trimmed-mean25",
555 - "trimmed-median",
556 - "trimmed-median1",
557 - "trimmed-median2",
558 - "trimmed-median3",
559 - "trimmed-median5",
560 - "trimmed-median10",
561 - "trimmed-median15",
562 - "trimmed-median20",
563 - "trimmed-median25"
564 - ],
565 - "default": "average"
566 - }
438 + "$ref": "#/components/parameters/scopeNodes"
439 },
440 {
569 - "name": "time_group_options",
570 - "in": "query",
571 - "description": "When the group function supports additional parameters, this field can be used to pass them to it. Currently `countif`, `trimmed-mean`, `trimmed-median` and `percentile` support this. For `countif` the string may start with `<`, `<=`, `<:`, `<>`, `!=`, `>`, `>=`, `>:`. For all others just a number is expected.\n",
572 - "required": false,
573 - "schema": {
574 - "type": "string"
575 - }
441 + "$ref": "#/components/parameters/scopeContexts"
442 },
443 {
578 - "name": "time_resampling",
579 - "in": "query",
580 - "description": "For incremental values that are \"per second\", this value is used to resample them to \"per minute` (60) or \"per hour\" (3600). It can only be used in conjunction with group=average.\n",
581 - "required": false,
582 - "schema": {
583 - "type": "number",
584 - "format": "integer",
585 - "default": 0
586 - }
444 + "$ref": "#/components/parameters/filterNodes"
445 },
446 {
589 - "name": "timeout",
590 - "in": "query",
591 - "description": "Specify a timeout value in milliseconds after which the agent will abort the query and return a 503 error. A value of 0 indicates no timeout.\n",
592 - "required": false,
593 - "schema": {
594 - "type": "number",
595 - "format": "integer",
596 - "default": 0
597 - }
447 + "$ref": "#/components/parameters/filterContexts"
448 },
449 {
600 - "name": "format",
601 - "in": "query",
602 - "description": "The format of the data to be returned.\n",
603 - "required": true,
604 - "allowEmptyValue": false,
605 - "schema": {
606 - "type": "string",
607 - "enum": [
608 - "json",
609 - "json2",
610 - "jsonp",
611 - "csv",
612 - "tsv",
613 - "tsv-excel",
614 - "ssv",
615 - "ssvcomma",
616 - "datatable",
617 - "datasource",
618 - "html",
619 - "markdown",
620 - "array",
621 - "csvjsonarray"
622 - ],
623 - "default": "json2"
624 - }
450 + "$ref": "#/components/parameters/filterInstances"
451 },
452 {
627 - "name": "options",
628 - "in": "query",
629 - "description": "Options that affect data generation.\n`raw` changes the output so that the values can be aggregated across multiple such queries.\n",
630 - "required": false,
631 - "allowEmptyValue": false,
632 - "schema": {
633 - "type": "array",
634 - "items": {
635 - "type": "string",
636 - "enum": [
637 - "raw",
638 - "nonzero",
639 - "flip",
640 - "min2max",
641 - "seconds",
642 - "milliseconds",
643 - "abs",
644 - "absolute",
645 - "null2zero",
646 - "percentage",
647 - "unaligned",
648 - "match-ids",
649 - "match-names",
650 - "anomaly-bit",
651 - "group-by-labels"
652 - ]
653 - },
654 - "default": [
655 - "seconds",
656 - "jsonwrap"
657 - ]
658 - }
453 + "$ref": "#/components/parameters/filterLabels"
454 },
455 {
661 - "name": "tier",
662 - "in": "query",
663 - "description": "Use only the specified database tier.\n",
664 - "required": false,
665 - "schema": {
666 - "type": "number",
667 - "format": "integer"
668 - }
456 + "$ref": "#/components/parameters/filterAlerts"
457 },
458 {
671 - "name": "callback",
672 - "in": "query",
673 - "description": "For JSONP responses, the callback function name.\n",
674 - "required": false,
675 - "schema": {
676 - "type": "string"
677 - }
459 + "$ref": "#/components/parameters/filterDimensions"
460 },
461 {
680 - "name": "filename",
681 - "in": "query",
682 - "description": "Add `Content-Disposition: attachment; filename=` header to the response, that will instruct the browser to save the response with the given filename.\"\n",
683 - "required": false,
684 - "schema": {
685 - "type": "string"
686 - }
462 + "$ref": "#/components/parameters/after"
463 },
464 {
689 - "name": "tqx",
690 - "in": "query",
691 - "description": "[Google Visualization API](https://developers.google.com/chart/interactive/docs/dev/implementing_data_source?hl=en) formatted parameter.\n",
692 - "required": false,
693 - "schema": {
694 - "type": "string"
695 - }
465 + "$ref": "#/components/parameters/before"
466 + },
467 + {
468 + "$ref": "#/components/parameters/points"
469 + },
470 + {
471 + "$ref": "#/components/parameters/tier"
472 + },
473 + {
474 + "$ref": "#/components/parameters/dataQueryOptions"
475 + },
476 + {
477 + "$ref": "#/components/parameters/dataTimeGroup2"
478 + },
479 + {
480 + "$ref": "#/components/parameters/dataTimeGroupOptions2"
481 + },
482 + {
483 + "$ref": "#/components/parameters/dataTimeResampling2"
484 + },
485 + {
486 + "$ref": "#/components/parameters/dataFormat2"
487 + },
488 + {
489 + "$ref": "#/components/parameters/timeoutMS"
490 + },
491 + {
492 + "$ref": "#/components/parameters/callback"
493 + },
494 + {
495 + "$ref": "#/components/parameters/filename"
496 + },
497 + {
498 + "$ref": "#/components/parameters/tqx"
499 }
500 ],
501 "responses": {
502 "200": {
700 - "description": "The call was successful. The response includes the data in the format requested. Swagger2.0 does not process the discriminator field to show polymorphism. The response will be one of the sub-types of the data-schema according to the chosen format, e.g. json -> data_json.\n",
503 + "description": "The call was successful. The response includes the data in the format requested.\n",
504 "content": {
505 "application/json": {
506 "schema": {
704 - "$ref": "#/components/schemas/data_json2"
507 + "oneOf": [
508 + {
509 + "$ref": "#/components/schemas/jsonwrap2"
510 + },
511 + {
512 + "$ref": "#/components/schemas/data_json_formats2"
513 + }
514 + ]
515 + }
516 + },
517 + "text/plain": {
518 + "schema": {
519 + "type": "string",
520 + "format": "according to the format requested."
521 + }
522 + },
523 + "text/html": {
524 + "schema": {
525 + "type": "string",
526 + "format": "html"
527 + }
528 + },
529 + "application/x-javascript": {
530 + "schema": {
531 + "type": "string",
532 + "format": "javascript"
533 }
534 }
535 }
@@ -717,290 +545,100 @@
545 },
546 "/api/v1/data": {
547 "get": {
720 - "summary": "Get collected data for a specific chart",
721 - "description": "The data endpoint returns data stored in the round robin database of a chart.",
548 + "operationId": "dataQuery1",
549 + "tags": [
550 + "data"
551 + ],
552 + "summary": "Data Query v1 - Single node, single chart or context queries. without group-by.",
553 + "description": "Query metric data of a chart or context of a node and return a dataset having time-series data for all dimensions available.\nFor group-by functionality, use `/api/v2/data`.\nAt least a `chart` or a `context` have to be given for the data query to be executed.\n",
554 "parameters": [
555 {
724 - "name": "chart",
725 - "in": "query",
726 - "description": "The id of the chart as returned by the /charts call. Note chart or context must be specified",
727 - "required": false,
728 - "allowEmptyValue": false,
729 - "schema": {
730 - "type": "string",
731 - "format": "as returned by /charts",
732 - "default": "system.cpu"
733 - }
556 + "$ref": "#/components/parameters/chart"
557 },
558 {
736 - "name": "context",
737 - "in": "query",
738 - "description": "The context of the chart as returned by the /charts call. Note chart or context must be specified",
739 - "required": false,
740 - "allowEmptyValue": false,
741 - "schema": {
742 - "type": "string",
743 - "format": "as returned by /charts"
744 - }
559 + "$ref": "#/components/parameters/context"
560 },
561 {
747 - "name": "dimension",
748 - "in": "query",
749 - "description": "Zero, one or more dimension ids or names, as returned by the /chart call, separated with comma or pipe. Netdata simple patterns are supported.",
750 - "required": false,
751 - "allowEmptyValue": false,
752 - "schema": {
753 - "type": "array",
754 - "items": {
755 - "type": "string",
756 - "format": "as returned by /charts"
757 - }
758 - }
562 + "$ref": "#/components/parameters/dimension"
563 },
564 {
761 - "name": "after",
762 - "in": "query",
763 - "description": "This parameter can either be an absolute timestamp specifying the starting point of the data to be returned, or a relative number of seconds (negative, relative to parameter: before). Netdata will assume it is a relative number if it is less that 3 years (in seconds). If not specified the default is -600 seconds. Netdata will adapt this parameter to the boundaries of the round robin database unless the allow_past option is specified.",
764 - "required": true,
765 - "allowEmptyValue": false,
766 - "schema": {
767 - "type": "number",
768 - "format": "integer",
769 - "default": -600
770 - }
565 + "$ref": "#/components/parameters/chart_label_key"
566 },
567 {
773 - "name": "before",
774 - "in": "query",
775 - "description": "This parameter can either be an absolute timestamp specifying the ending point of the data to be returned, or a relative number of seconds (negative), relative to the last collected timestamp. Netdata will assume it is a relative number if it is less than 3 years (in seconds). Netdata will adapt this parameter to the boundaries of the round robin database. The default is zero (i.e. the timestamp of the last value collected).",
776 - "required": false,
777 - "schema": {
778 - "type": "number",
779 - "format": "integer",
780 - "default": 0
781 - }
568 + "$ref": "#/components/parameters/chart_labels_filter"
569 },
570 {
784 - "name": "points",
785 - "in": "query",
786 - "description": "The number of points to be returned. If not given, or it is <= 0, or it is bigger than the points stored in the round robin database for this chart for the given duration, all the available collected values for the given duration will be returned.",
787 - "required": true,
788 - "allowEmptyValue": false,
789 - "schema": {
790 - "type": "number",
791 - "format": "integer",
792 - "default": 20
793 - }
571 + "$ref": "#/components/parameters/after"
572 },
573 {
796 - "name": "chart_label_key",
797 - "in": "query",
798 - "description": "Specify the chart label keys that need to match for context queries as comma separated values. At least one matching key is needed to match the corresponding chart.",
799 - "required": false,
800 - "allowEmptyValue": false,
801 - "schema": {
802 - "type": "string",
803 - "format": "key1,key2,key3"
804 - }
574 + "$ref": "#/components/parameters/before"
575 },
576 {
807 - "name": "chart_labels_filter",
808 - "in": "query",
809 - "description": "Specify the chart label keys and values to match for context queries. All keys/values need to match for the chart to be included in the query. The labels are specified as key1:value1,key2:value2",
810 - "required": false,
811 - "allowEmptyValue": false,
812 - "schema": {
813 - "type": "string",
814 - "format": "key1:value1,key2:value2,key3:value3"
815 - }
577 + "$ref": "#/components/parameters/points"
578 },
579 {
818 - "name": "group",
819 - "in": "query",
820 - "description": "The grouping method. If multiple collected values are to be grouped in order to return fewer points, this parameters defines the method of grouping. methods supported \"min\", \"max\", \"average\", \"sum\", \"incremental-sum\". \"max\" is actually calculated on the absolute value collected (so it works for both positive and negative dimensions to return the most extreme value in either direction).",
821 - "required": true,
822 - "allowEmptyValue": false,
823 - "schema": {
824 - "type": "string",
825 - "enum": [
826 - "min",
827 - "max",
828 - "average",
829 - "median",
830 - "stddev",
831 - "sum",
832 - "incremental-sum",
833 - "ses",
834 - "des",
835 - "cv",
836 - "countif",
837 - "percentile",
838 - "percentile25",
839 - "percentile50",
840 - "percentile75",
841 - "percentile80",
842 - "percentile90",
843 - "percentile95",
844 - "percentile97",
845 - "percentile98",
846 - "percentile99",
847 - "trimmed-mean",
848 - "trimmed-mean1",
849 - "trimmed-mean2",
850 - "trimmed-mean3",
851 - "trimmed-mean5",
852 - "trimmed-mean10",
853 - "trimmed-mean15",
854 - "trimmed-mean20",
855 - "trimmed-mean25",
856 - "trimmed-median",
857 - "trimmed-median1",
858 - "trimmed-median2",
859 - "trimmed-median3",
860 - "trimmed-median5",
861 - "trimmed-median10",
862 - "trimmed-median15",
863 - "trimmed-median20",
864 - "trimmed-median25"
865 - ],
866 - "default": "average"
867 - }
580 + "$ref": "#/components/parameters/tier"
581 },
582 {
870 - "name": "group_options",
871 - "in": "query",
872 - "description": "When the group function supports additional parameters, this field can be used to pass them to it. Currently only \"countif\" supports this.",
873 - "required": false,
874 - "allowEmptyValue": false,
875 - "schema": {
876 - "type": "string"
877 - }
583 + "$ref": "#/components/parameters/dataQueryOptions"
584 },
585 {
880 - "name": "gtime",
881 - "in": "query",
882 - "description": "The grouping number of seconds. This is used in conjunction with group=average to change the units of metrics (ie when the data is per-second, setting gtime=60 will turn them to per-minute).",
883 - "required": false,
884 - "allowEmptyValue": false,
885 - "schema": {
886 - "type": "number",
887 - "format": "integer",
888 - "default": 0
889 - }
586 + "$ref": "#/components/parameters/dataFormat1"
587 },
588 {
892 - "name": "timeout",
893 - "in": "query",
894 - "description": "Specify a timeout value in milliseconds after which the agent will abort the query and return a 503 error. A value of 0 indicates no timeout.",
895 - "required": false,
896 - "allowEmptyValue": false,
897 - "schema": {
898 - "type": "number",
899 - "format": "integer",
900 - "default": 0
901 - }
589 + "$ref": "#/components/parameters/dataTimeGroup1"
590 },
591 {
904 - "name": "format",
905 - "in": "query",
906 - "description": "The format of the data to be returned.",
907 - "required": true,
908 - "allowEmptyValue": false,
909 - "schema": {
910 - "type": "string",
911 - "enum": [
912 - "json",
913 - "jsonp",
914 - "csv",
915 - "tsv",
916 - "tsv-excel",
917 - "ssv",
918 - "ssvcomma",
919 - "datatable",
920 - "datasource",
921 - "html",
922 - "markdown",
923 - "array",
924 - "csvjsonarray"
925 - ],
926 - "default": "json"
927 - }
592 + "$ref": "#/components/parameters/dataTimeGroupOptions1"
593 },
594 {
930 - "name": "options",
931 - "in": "query",
932 - "description": "Options that affect data generation.",
933 - "required": false,
934 - "allowEmptyValue": false,
935 - "schema": {
936 - "type": "array",
937 - "items": {
938 - "type": "string",
939 - "enum": [
940 - "nonzero",
941 - "flip",
942 - "jsonwrap",
943 - "min2max",
944 - "seconds",
945 - "milliseconds",
946 - "abs",
947 - "absolute",
948 - "absolute-sum",
949 - "null2zero",
950 - "objectrows",
951 - "google_json",
952 - "percentage",
953 - "unaligned",
954 - "match-ids",
955 - "match-names",
956 - "allow_past",
957 - "anomaly-bit"
958 - ]
959 - },
960 - "default": [
961 - "seconds",
962 - "jsonwrap"
963 - ]
964 - }
595 + "$ref": "#/components/parameters/dataTimeResampling1"
596 },
597 {
967 - "name": "callback",
968 - "in": "query",
969 - "description": "For JSONP responses, the callback function name.",
970 - "required": false,
971 - "allowEmptyValue": true,
972 - "schema": {
973 - "type": "string"
974 - }
598 + "$ref": "#/components/parameters/timeoutMS"
599 },
600 {
977 - "name": "filename",
978 - "in": "query",
979 - "description": "Add Content-Disposition: attachment; filename= header to the response, that will instruct the browser to save the response with the given filename.",
980 - "required": false,
981 - "allowEmptyValue": true,
982 - "schema": {
983 - "type": "string"
984 - }
601 + "$ref": "#/components/parameters/callback"
602 },
603 {
987 - "name": "tqx",
988 - "in": "query",
989 - "description": "[Google Visualization API](https://developers.google.com/chart/interactive/docs/dev/implementing_data_source?hl=en) formatted parameter.",
990 - "required": false,
991 - "allowEmptyValue": true,
992 - "schema": {
993 - "type": "string"
994 - }
604 + "$ref": "#/components/parameters/filename"
605 + },
606 + {
607 + "$ref": "#/components/parameters/tqx"
608 }
609 ],
610 "responses": {
611 "200": {
999 - "description": "The call was successful. The response includes the data in the format requested. Swagger2.0 does not process the discriminator field to show polymorphism. The response will be one of the sub-types of the data-schema according to the chosen format, e.g. json -> data_json.",
612 + "description": "The call was successful. The response includes the data in the format requested.\n",
613 "content": {
614 "application/json": {
615 "schema": {
1003 - "$ref": "#/components/schemas/data"
616 + "oneOf": [
617 + {
618 + "$ref": "#/components/schemas/jsonwrap1"
619 + },
620 + {
621 + "$ref": "#/components/schemas/data_json_formats1"
622 + }
623 + ]
624 + }
625 + },
626 + "text/plain": {
627 + "schema": {
628 + "type": "string",
629 + "format": "according to the format requested."
630 + }
631 + },
632 + "text/html": {
633 + "schema": {
634 + "type": "string",
635 + "format": "html"
636 + }
637 + },
638 + "application/x-javascript": {
639 + "schema": {
640 + "type": "string",
641 + "format": "javascript"
642 }
643 }
644 }
@@ -1017,240 +655,314 @@
655 }
656 }
657 },
1020 - "/api/v1/badge.svg": {
658 + "/api/v1/allmetrics": {
659 "get": {
1022 - "summary": "Generate a badge in form of SVG image for a chart (or dimension)",
1023 - "description": "Successful responses are SVG images.",
660 + "operationId": "allMetrics1",
661 + "tags": [
662 + "data"
663 + ],
664 + "summary": "All Metrics v1 - Fetch latest value for all metrics",
665 + "description": "The `allmetrics` endpoint returns the latest value of all metrics maintained for a netdata node.\n",
666 "parameters": [
667 {
1026 - "name": "chart",
668 + "name": "format",
669 "in": "query",
1028 - "description": "The id of the chart as returned by the /charts call.",
670 + "description": "The format of the response to be returned.",
671 "required": true,
1030 - "allowEmptyValue": false,
672 "schema": {
673 "type": "string",
1033 - "format": "as returned by /charts",
1034 - "default": "system.cpu"
674 + "enum": [
675 + "shell",
676 + "prometheus",
677 + "prometheus_all_hosts",
678 + "json"
679 + ],
680 + "default": "shell"
681 }
682 },
683 {
1038 - "name": "alarm",
684 + "name": "filter",
685 "in": "query",
1040 - "description": "The name of an alarm linked to the chart.",
686 + "description": "Allows to filter charts out using simple patterns.",
687 "required": false,
1042 - "allowEmptyValue": true,
688 "schema": {
689 "type": "string",
690 "format": "any text"
691 }
692 },
693 {
1049 - "name": "dimension",
694 + "name": "variables",
695 "in": "query",
1051 - "description": "Zero, one or more dimension ids, as returned by the /chart call.",
696 + "description": "When enabled, netdata will expose various system configuration variables.\n",
697 "required": false,
1053 - "allowEmptyValue": false,
698 "schema": {
1055 - "type": "array",
1056 - "items": {
1057 - "type": "string",
1058 - "format": "as returned by /charts"
1059 - }
699 + "type": "string",
700 + "enum": [
701 + "yes",
702 + "no"
703 + ],
704 + "default": "no"
705 }
706 },
707 {
1063 - "name": "after",
708 + "name": "help",
709 "in": "query",
1065 - "description": "This parameter can either be an absolute timestamp specifying the starting point of the data to be returned, or a relative number of seconds, to the last collected timestamp. Netdata will assume it is a relative number if it is smaller than the duration of the round robin database for this chart. So, if the round robin database is 3600 seconds, any value from -3600 to 3600 will trigger relative arithmetics. Netdata will adapt this parameter to the boundaries of the round robin database.",
1066 - "required": true,
1067 - "allowEmptyValue": false,
710 + "description": "Enable or disable HELP lines in prometheus output.\n",
711 + "required": false,
712 "schema": {
1069 - "type": "number",
1070 - "format": "integer",
1071 - "default": -600
713 + "type": "string",
714 + "enum": [
715 + "yes",
716 + "no"
717 + ],
718 + "default": "no"
719 }
720 },
721 {
1075 - "name": "before",
722 + "name": "types",
723 "in": "query",
1077 - "description": "This parameter can either be an absolute timestamp specifying the ending point of the data to be returned, or a relative number of seconds, to the last collected timestamp. Netdata will assume it is a relative number if it is smaller than the duration of the round robin database for this chart. So, if the round robin database is 3600 seconds, any value from -3600 to 3600 will trigger relative arithmetics. Netdata will adapt this parameter to the boundaries of the round robin database.",
724 + "description": "Enable or disable TYPE lines in prometheus output.\n",
725 "required": false,
726 "schema": {
1080 - "type": "number",
1081 - "format": "integer",
1082 - "default": 0
727 + "type": "string",
728 + "enum": [
729 + "yes",
730 + "no"
731 + ],
732 + "default": "no"
733 }
734 },
735 {
1086 - "name": "group",
736 + "name": "timestamps",
737 "in": "query",
1088 - "description": "The grouping method. If multiple collected values are to be grouped in order to return fewer points, this parameters defines the method of grouping. methods are supported \"min\", \"max\", \"average\", \"sum\", \"incremental-sum\". \"max\" is actually calculated on the absolute value collected (so it works for both positive and negative dimensions to return the most extreme value in either direction).",
1089 - "required": true,
1090 - "allowEmptyValue": false,
738 + "description": "Enable or disable timestamps in prometheus output.\n",
739 + "required": false,
740 "schema": {
741 "type": "string",
742 "enum": [
1094 - "min",
1095 - "max",
1096 - "average",
1097 - "median",
1098 - "stddev",
1099 - "sum",
1100 - "incremental-sum",
1101 - "ses",
1102 - "des",
1103 - "cv",
1104 - "countif",
1105 - "percentile",
1106 - "percentile25",
1107 - "percentile50",
1108 - "percentile75",
1109 - "percentile80",
1110 - "percentile90",
1111 - "percentile95",
1112 - "percentile97",
1113 - "percentile98",
1114 - "percentile99",
1115 - "trimmed-mean",
1116 - "trimmed-mean1",
1117 - "trimmed-mean2",
1118 - "trimmed-mean3",
1119 - "trimmed-mean5",
1120 - "trimmed-mean10",
1121 - "trimmed-mean15",
1122 - "trimmed-mean20",
1123 - "trimmed-mean25",
1124 - "trimmed-median",
1125 - "trimmed-median1",
1126 - "trimmed-median2",
1127 - "trimmed-median3",
1128 - "trimmed-median5",
1129 - "trimmed-median10",
1130 - "trimmed-median15",
1131 - "trimmed-median20",
1132 - "trimmed-median25"
743 + "yes",
744 + "no"
745 ],
1134 - "default": "average"
746 + "default": "yes"
747 }
748 },
749 {
1138 - "name": "options",
750 + "name": "names",
751 "in": "query",
1140 - "description": "Options that affect data generation.",
752 + "description": "When enabled netdata will report dimension names. When disabled netdata will report dimension IDs. The default is controlled in netdata.conf.\n",
753 "required": false,
1142 - "allowEmptyValue": true,
754 "schema": {
1144 - "type": "array",
1145 - "items": {
1146 - "type": "string",
1147 - "enum": [
1148 - "abs",
1149 - "absolute",
1150 - "display-absolute",
1151 - "absolute-sum",
1152 - "null2zero",
1153 - "percentage",
1154 - "unaligned",
1155 - "anomaly-bit"
1156 - ]
1157 - },
1158 - "default": [
1159 - "absolute"
1160 - ]
755 + "type": "string",
756 + "enum": [
757 + "yes",
758 + "no"
759 + ],
760 + "default": "yes"
761 }
762 },
763 {
1164 - "name": "label",
764 + "name": "oldunits",
765 "in": "query",
1166 - "description": "A text to be used as the label.",
766 + "description": "When enabled, netdata will show metric names for the default `source=average` as they appeared before 1.12, by using the legacy unit naming conventions.\n",
767 "required": false,
1168 - "allowEmptyValue": true,
768 "schema": {
769 "type": "string",
1171 - "format": "any text"
770 + "enum": [
771 + "yes",
772 + "no"
773 + ],
774 + "default": "yes"
775 }
776 },
777 {
1175 - "name": "units",
778 + "name": "hideunits",
779 "in": "query",
1177 - "description": "A text to be used as the units.",
780 + "description": "When enabled, netdata will not include the units in the metric names, for the default `source=average`.\n",
781 "required": false,
1179 - "allowEmptyValue": true,
782 "schema": {
783 "type": "string",
1182 - "format": "any text"
784 + "enum": [
785 + "yes",
786 + "no"
787 + ],
788 + "default": "yes"
789 }
790 },
791 {
1186 - "name": "label_color",
792 + "name": "server",
793 "in": "query",
1188 - "description": "A color to be used for the background of the label side(left side) of the badge. One of predefined colors or specific color in hex `RGB` or `RRGGBB` format (without preceding `#` character). If value wrong or not given default color will be used.",
794 + "description": "Set a distinct name of the client querying prometheus metrics. Netdata will use the client IP if this is not set.\n",
795 "required": false,
1190 - "allowEmptyValue": true,
796 "schema": {
1192 - "oneOf": [
1193 - {
1194 - "type": "string",
1195 - "enum": [
1196 - "green",
1197 - "brightgreen",
1198 - "yellow",
1199 - "yellowgreen",
1200 - "orange",
1201 - "red",
1202 - "blue",
1203 - "grey",
1204 - "gray",
1205 - "lightgrey",
1206 - "lightgray"
1207 - ]
1208 - },
1209 - {
1210 - "type": "string",
1211 - "format": "^([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
1212 - }
1213 - ]
797 + "type": "string",
798 + "format": "any text"
799 }
800 },
801 {
1217 - "name": "value_color",
802 + "name": "prefix",
803 "in": "query",
1219 - "description": "A color to be used for the background of the value *(right)* part of badge. You can set multiple using a pipe with a condition each, like this: `color<value|color:null` The following operators are supported: >, <, >=, <=, =, :null (to check if no value exists). Each color can be specified in same manner as for `label_color` parameter. Currently only integers are supported as values.",
804 + "description": "Prefix all prometheus metrics with this string.\n",
805 "required": false,
1221 - "allowEmptyValue": true,
806 "schema": {
807 "type": "string",
808 "format": "any text"
809 }
810 },
811 {
1228 - "name": "text_color_lbl",
812 + "name": "data",
813 "in": "query",
1230 - "description": "Font color for label *(left)* part of the badge. One of predefined colors or as HTML hexadecimal color without preceding `#` character. Formats allowed `RGB` or `RRGGBB`. If no or wrong value given default color will be used.",
814 + "description": "Select the prometheus response data source. There is a setting in netdata.conf for the default.\n",
815 "required": false,
1232 - "allowEmptyValue": true,
816 "schema": {
1234 - "oneOf": [
1235 - {
1236 - "type": "string",
1237 - "enum": [
1238 - "green",
1239 - "brightgreen",
1240 - "yellow",
1241 - "yellowgreen",
1242 - "orange",
1243 - "red",
1244 - "blue",
1245 - "grey",
1246 - "gray",
1247 - "lightgrey",
1248 - "lightgray"
1249 - ]
1250 - },
1251 - {
1252 - "type": "string",
1253 - "format": "^([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
817 + "type": "string",
818 + "enum": [
819 + "as-collected",
820 + "average",
821 + "sum"
822 + ],
823 + "default": "average"
824 + }
825 + }
826 + ],
827 + "responses": {
828 + "200": {
829 + "description": "All the metrics returned in the format requested."
830 + },
831 + "400": {
832 + "description": "The format requested is not supported."
833 + }
834 + }
835 + }
836 + },
837 + "/api/v1/badge.svg": {
838 + "get": {
839 + "operationId": "badge1",
840 + "tags": [
841 + "badges"
842 + ],
843 + "summary": "Generate a badge in form of SVG image for a chart (or dimension)",
844 + "description": "Successful responses are SVG images.",
845 + "parameters": [
846 + {
847 + "$ref": "#/components/parameters/chart"
848 + },
849 + {
850 + "$ref": "#/components/parameters/dimension"
851 + },
852 + {
853 + "$ref": "#/components/parameters/after"
854 + },
855 + {
856 + "$ref": "#/components/parameters/before"
857 + },
858 + {
859 + "$ref": "#/components/parameters/dataTimeGroup1"
860 + },
861 + {
862 + "$ref": "#/components/parameters/dataQueryOptions"
863 + },
864 + {
865 + "name": "alarm",
866 + "in": "query",
867 + "description": "The name of an alarm linked to the chart.",
868 + "required": false,
869 + "allowEmptyValue": true,
870 + "schema": {
871 + "type": "string",
872 + "format": "any text"
873 + }
874 + },
875 + {
876 + "name": "label",
877 + "in": "query",
878 + "description": "A text to be used as the label.",
879 + "required": false,
880 + "allowEmptyValue": true,
881 + "schema": {
882 + "type": "string",
883 + "format": "any text"
884 + }
885 + },
886 + {
887 + "name": "units",
888 + "in": "query",
889 + "description": "A text to be used as the units.",
890 + "required": false,
891 + "allowEmptyValue": true,
892 + "schema": {
893 + "type": "string",
894 + "format": "any text"
895 + }
896 + },
897 + {
898 + "name": "label_color",
899 + "in": "query",
900 + "description": "A color to be used for the background of the label side(left side) of the badge. One of predefined colors or specific color in hex `RGB` or `RRGGBB` format (without preceding `#` character). If value wrong or not given default color will be used.\n",
901 + "required": false,
902 + "allowEmptyValue": true,
903 + "schema": {
904 + "oneOf": [
905 + {
906 + "type": "string",
907 + "enum": [
908 + "green",
909 + "brightgreen",
910 + "yellow",
911 + "yellowgreen",
912 + "orange",
913 + "red",
914 + "blue",
915 + "grey",
916 + "gray",
917 + "lightgrey",
918 + "lightgray"
919 + ]
920 + },
921 + {
922 + "type": "string",
923 + "format": "^([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
924 + }
925 + ]
926 + }
927 + },
928 + {
929 + "name": "value_color",
930 + "in": "query",
931 + "description": "A color to be used for the background of the value *(right)* part of badge. You can set multiple using a pipe with a condition each, like this: `color<value|color:null` The following operators are supported: >, <, >=, <=, =, :null (to check if no value exists). Each color can be specified in same manner as for `label_color` parameter. Currently only integers are supported as values.\n",
932 + "required": false,
933 + "allowEmptyValue": true,
934 + "schema": {
935 + "type": "string",
936 + "format": "any text"
937 + }
938 + },
939 + {
940 + "name": "text_color_lbl",
941 + "in": "query",
942 + "description": "Font color for label *(left)* part of the badge. One of predefined colors or as HTML hexadecimal color without preceding `#` character. Formats allowed `RGB` or `RRGGBB`. If no or wrong value given default color will be used.\n",
943 + "required": false,
944 + "allowEmptyValue": true,
945 + "schema": {
946 + "oneOf": [
947 + {
948 + "type": "string",
949 + "enum": [
950 + "green",
951 + "brightgreen",
952 + "yellow",
953 + "yellowgreen",
954 + "orange",
955 + "red",
956 + "blue",
957 + "grey",
958 + "gray",
959 + "lightgrey",
960 + "lightgray"
961 + ]
962 + },
963 + {
964 + "type": "string",
965 + "format": "^([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
966 }
967 ]
968 }
@@ -1258,7 +970,7 @@
970 {
971 "name": "text_color_val",
972 "in": "query",
1261 - "description": "Font color for value *(right)* part of the badge. One of predefined colors or as HTML hexadecimal color without preceding `#` character. Formats allowed `RGB` or `RRGGBB`. If no or wrong value given default color will be used.",
973 + "description": "Font color for value *(right)* part of the badge. One of predefined colors or as HTML hexadecimal color without preceding `#` character. Formats allowed `RGB` or `RRGGBB`. If no or wrong value given default color will be used.\n",
974 "required": false,
975 "allowEmptyValue": true,
976 "schema": {
@@ -1322,7 +1034,7 @@
1034 {
1035 "name": "fixed_width_lbl",
1036 "in": "query",
1325 - "description": "This parameter overrides auto-sizing of badge and creates it with fixed width. This parameter determines the size of the label's left side *(label/name)*. You must set this parameter together with `fixed_width_val` otherwise it will be ignored. You should set the label/value widths wide enough to provide space for all the possible values/contents of the badge you're requesting. In case the text cannot fit the space given it will be clipped. The `scale` parameter still applies on the values you give to `fixed_width_lbl` and `fixed_width_val`.",
1037 + "description": "This parameter overrides auto-sizing of badge and creates it with fixed width. This parameter determines the size of the label's left side *(label/name)*. You must set this parameter together with `fixed_width_val` otherwise it will be ignored. You should set the label/value widths wide enough to provide space for all the possible values/contents of the badge you're requesting. In case the text cannot fit the space given it will be clipped. The `scale` parameter still applies on the values you give to `fixed_width_lbl` and `fixed_width_val`.\n",
1038 "required": false,
1039 "allowEmptyValue": false,
1040 "schema": {
@@ -1333,7 +1045,7 @@
1045 {
1046 "name": "fixed_width_val",
1047 "in": "query",
1336 - "description": "This parameter overrides auto-sizing of badge and creates it with fixed width. This parameter determines the size of the label's right side *(value)*. You must set this parameter together with `fixed_width_lbl` otherwise it will be ignored. You should set the label/value widths wide enough to provide space for all the possible values/contents of the badge you're requesting. In case the text cannot fit the space given it will be clipped. The `scale` parameter still applies on the values you give to `fixed_width_lbl` and `fixed_width_val`.",
1048 + "description": "This parameter overrides auto-sizing of badge and creates it with fixed width. This parameter determines the size of the label's right side *(value)*. You must set this parameter together with `fixed_width_lbl` otherwise it will be ignored. You should set the label/value widths wide enough to provide space for all the possible values/contents of the badge you're requesting. In case the text cannot fit the space given it will be clipped. The `scale` parameter still applies on the values you give to `fixed_width_lbl` and `fixed_width_val`.\n",
1049 "required": false,
1050 "allowEmptyValue": false,
1051 "schema": {
@@ -1358,185 +1070,310 @@
1070 }
1071 }
1072 },
1361 - "/api/v1/allmetrics": {
1073 + "/api/v2/weights": {
1074 "get": {
1363 - "summary": "Get a value of all the metrics maintained by netdata",
1364 - "description": "The allmetrics endpoint returns the latest value of all charts and dimensions stored in the netdata server.",
1075 + "operationId": "weights2",
1076 + "tags": [
1077 + "weights"
1078 + ],
1079 + "summary": "Score or weight all or some of the metrics, across all nodes, according to various algorithms.",
1080 + "description": "This endpoint goes through all metrics and scores them according to an algorithm.\n",
1081 "parameters": [
1082 {
1367 - "name": "format",
1368 - "in": "query",
1369 - "description": "The format of the response to be returned.",
1370 - "required": true,
1371 - "schema": {
1372 - "type": "string",
1373 - "enum": [
1374 - "shell",
1375 - "prometheus",
1376 - "prometheus_all_hosts",
1377 - "json"
1378 - ],
1379 - "default": "shell"
1380 - }
1083 + "$ref": "#/components/parameters/weightMethods"
1084 },
1085 {
1383 - "name": "filter",
1384 - "in": "query",
1385 - "description": "Allows to filter charts out using simple patterns.",
1386 - "required": false,
1387 - "schema": {
1388 - "type": "string",
1389 - "format": "any text"
1390 - }
1086 + "$ref": "#/components/parameters/scopeNodes"
1087 },
1088 {
1393 - "name": "variables",
1394 - "in": "query",
1395 - "description": "When enabled, netdata will expose various system configuration metrics.",
1396 - "required": false,
1397 - "schema": {
1398 - "type": "string",
1399 - "enum": [
1400 - "yes",
1401 - "no"
1402 - ],
1403 - "default": "no"
1404 - }
1089 + "$ref": "#/components/parameters/scopeContexts"
1090 },
1091 {
1407 - "name": "help",
1408 - "in": "query",
1409 - "description": "Enable or disable HELP lines in prometheus output.",
1410 - "required": false,
1411 - "schema": {
1412 - "type": "string",
1413 - "enum": [
1414 - "yes",
1415 - "no"
1416 - ],
1417 - "default": "no"
1418 - }
1092 + "$ref": "#/components/parameters/filterNodes"
1093 },
1094 {
1421 - "name": "types",
1422 - "in": "query",
1423 - "description": "Enable or disable TYPE lines in prometheus output.",
1424 - "required": false,
1425 - "schema": {
1426 - "type": "string",
1427 - "enum": [
1428 - "yes",
1429 - "no"
1430 - ],
1431 - "default": "no"
1432 - }
1095 + "$ref": "#/components/parameters/filterContexts"
1096 },
1097 {
1435 - "name": "timestamps",
1436 - "in": "query",
1437 - "description": "Enable or disable timestamps in prometheus output.",
1438 - "required": false,
1439 - "schema": {
1440 - "type": "string",
1441 - "enum": [
1442 - "yes",
1443 - "no"
1444 - ],
1445 - "default": "yes"
1446 - }
1098 + "$ref": "#/components/parameters/filterInstances"
1099 },
1100 {
1449 - "name": "names",
1450 - "in": "query",
1451 - "description": "When enabled netdata will report dimension names. When disabled netdata will report dimension IDs. The default is controlled in netdata.conf.",
1452 - "required": false,
1453 - "schema": {
1454 - "type": "string",
1455 - "enum": [
1456 - "yes",
1457 - "no"
1458 - ],
1459 - "default": "yes"
1460 - }
1101 + "$ref": "#/components/parameters/filterLabels"
1102 },
1103 {
1463 - "name": "oldunits",
1464 - "in": "query",
1465 - "description": "When enabled, netdata will show metric names for the default source=average as they appeared before 1.12, by using the legacy unit naming conventions.",
1466 - "required": false,
1467 - "schema": {
1468 - "type": "string",
1469 - "enum": [
1470 - "yes",
1471 - "no"
1472 - ],
1473 - "default": "yes"
1474 - }
1104 + "$ref": "#/components/parameters/filterAlerts"
1105 },
1106 {
1477 - "name": "hideunits",
1478 - "in": "query",
1479 - "description": "When enabled, netdata will not include the units in the metric names, for the default source=average.",
1480 - "required": false,
1481 - "schema": {
1482 - "type": "string",
1483 - "enum": [
1484 - "yes",
1485 - "no"
1486 - ],
1487 - "default": "yes"
1488 - }
1107 + "$ref": "#/components/parameters/filterDimensions"
1108 },
1109 {
1491 - "name": "server",
1492 - "in": "query",
1493 - "description": "Set a distinct name of the client querying prometheus metrics. Netdata will use the client IP if this is not set.",
1494 - "required": false,
1495 - "schema": {
1496 - "type": "string",
1497 - "format": "any text"
1498 - }
1110 + "$ref": "#/components/parameters/baselineAfter"
1111 },
1112 {
1501 - "name": "prefix",
1502 - "in": "query",
1503 - "description": "Prefix all prometheus metrics with this string.",
1504 - "required": false,
1505 - "schema": {
1506 - "type": "string",
1507 - "format": "any text"
1508 - }
1113 + "$ref": "#/components/parameters/baselineBefore"
1114 },
1115 {
1511 - "name": "data",
1512 - "in": "query",
1513 - "description": "Select the prometheus response data source. There is a setting in netdata.conf for the default.",
1514 - "required": false,
1515 - "schema": {
1516 - "type": "string",
1517 - "enum": [
1518 - "as-collected",
1519 - "average",
1520 - "sum"
1521 - ],
1522 - "default": "average"
1116 + "$ref": "#/components/parameters/after"
1117 + },
1118 + {
1119 + "$ref": "#/components/parameters/before"
1120 + },
1121 + {
1122 + "$ref": "#/components/parameters/tier"
1123 + },
1124 + {
1125 + "$ref": "#/components/parameters/points"
1126 + },
1127 + {
1128 + "$ref": "#/components/parameters/timeoutMS"
1129 + },
1130 + {
1131 + "$ref": "#/components/parameters/dataQueryOptions"
1132 + },
1133 + {
1134 + "$ref": "#/components/parameters/dataTimeGroup2"
1135 + },
1136 + {
1137 + "$ref": "#/components/parameters/dataTimeGroupOptions2"
1138 + }
1139 + ],
1140 + "responses": {
1141 + "200": {
1142 + "description": "JSON object with weights for each context, chart and dimension.",
1143 + "content": {
1144 + "application/json": {
1145 + "schema": {
1146 + "$ref": "#/components/schemas/weights2"
1147 + }
1148 + }
1149 }
1150 + },
1151 + "400": {
1152 + "description": "The given parameters are invalid."
1153 + },
1154 + "403": {
1155 + "description": "metrics correlations are not enabled on this Netdata Agent."
1156 + },
1157 + "404": {
1158 + "description": "No charts could be found, or the method that correlated the metrics did not produce any result.\n"
1159 + },
1160 + "504": {
1161 + "description": "Timeout - the query took too long and has been cancelled."
1162 + }
1163 + }
1164 + }
1165 + },
1166 + "/api/v1/weights": {
1167 + "get": {
1168 + "operationId": "weights1",
1169 + "tags": [
1170 + "weights"
1171 + ],
1172 + "summary": "Score or weight all or some of the metrics of a single node, according to various algorithms.",
1173 + "description": "This endpoint goes through all metrics and scores them according to an algorithm.\n",
1174 + "parameters": [
1175 + {
1176 + "$ref": "#/components/parameters/weightMethods"
1177 + },
1178 + {
1179 + "$ref": "#/components/parameters/context"
1180 + },
1181 + {
1182 + "$ref": "#/components/parameters/baselineAfter"
1183 + },
1184 + {
1185 + "$ref": "#/components/parameters/baselineBefore"
1186 + },
1187 + {
1188 + "$ref": "#/components/parameters/after"
1189 + },
1190 + {
1191 + "$ref": "#/components/parameters/before"
1192 + },
1193 + {
1194 + "$ref": "#/components/parameters/tier"
1195 + },
1196 + {
1197 + "$ref": "#/components/parameters/points"
1198 + },
1199 + {
1200 + "$ref": "#/components/parameters/timeoutMS"
1201 + },
1202 + {
1203 + "$ref": "#/components/parameters/dataQueryOptions"
1204 + },
1205 + {
1206 + "$ref": "#/components/parameters/dataTimeGroup1"
1207 + },
1208 + {
1209 + "$ref": "#/components/parameters/dataTimeGroupOptions1"
1210 }
1211 ],
1212 "responses": {
1213 "200": {
1528 - "description": "All the metrics returned in the format requested."
1214 + "description": "JSON object with weights for each context, chart and dimension.",
1215 + "content": {
1216 + "application/json": {
1217 + "schema": {
1218 + "$ref": "#/components/schemas/weights"
1219 + }
1220 + }
1221 + }
1222 },
1223 "400": {
1531 - "description": "The format requested is not supported."
1224 + "description": "The given parameters are invalid."
1225 + },
1226 + "403": {
1227 + "description": "metrics correlations are not enabled on this Netdata Agent."
1228 + },
1229 + "404": {
1230 + "description": "No charts could be found, or the method that correlated the metrics did not produce any result."
1231 + },
1232 + "504": {
1233 + "description": "Timeout - the query took too long and has been cancelled."
1234 + }
1235 + }
1236 + }
1237 + },
1238 + "/api/v1/metric_correlations": {
1239 + "get": {
1240 + "operationId": "metricCorrelations1",
1241 + "tags": [
1242 + "weights"
1243 + ],
1244 + "summary": "Analyze all the metrics to find their correlations - EOL",
1245 + "description": "THIS ENDPOINT IS OBSOLETE. Use the /weights endpoint. Given two time-windows (baseline, highlight), it goes through all the available metrics, querying both windows and tries to find how these two windows relate to each other. It supports multiple algorithms to do so. The result is a list of all metrics evaluated, weighted for 0.0 (the two windows are more different) to 1.0 (the two windows are similar). The algorithm adjusts automatically the baseline window to be a power of two multiple of the highlighted (1, 2, 4, 8, etc).\n",
1246 + "parameters": [
1247 + {
1248 + "$ref": "#/components/parameters/weightMethods"
1249 + },
1250 + {
1251 + "$ref": "#/components/parameters/baselineAfter"
1252 + },
1253 + {
1254 + "$ref": "#/components/parameters/baselineBefore"
1255 + },
1256 + {
1257 + "$ref": "#/components/parameters/after"
1258 + },
1259 + {
1260 + "$ref": "#/components/parameters/before"
1261 + },
1262 + {
1263 + "$ref": "#/components/parameters/points"
1264 + },
1265 + {
1266 + "$ref": "#/components/parameters/tier"
1267 + },
1268 + {
1269 + "$ref": "#/components/parameters/timeoutMS"
1270 + },
1271 + {
1272 + "$ref": "#/components/parameters/dataQueryOptions"
1273 + },
1274 + {
1275 + "$ref": "#/components/parameters/dataTimeGroup1"
1276 + },
1277 + {
1278 + "$ref": "#/components/parameters/dataTimeGroupOptions1"
1279 + }
1280 + ],
1281 + "responses": {
1282 + "200": {
1283 + "description": "JSON object with weights for each chart and dimension.",
1284 + "content": {
1285 + "application/json": {
1286 + "schema": {
1287 + "$ref": "#/components/schemas/metric_correlations"
1288 + }
1289 + }
1290 + }
1291 + },
1292 + "400": {
1293 + "description": "The given parameters are invalid."
1294 + },
1295 + "403": {
1296 + "description": "metrics correlations are not enabled on this Netdata Agent."
1297 + },
1298 + "404": {
1299 + "description": "No charts could be found, or the method that correlated the metrics did not produce any result."
1300 + },
1301 + "504": {
1302 + "description": "Timeout - the query took too long and has been cancelled."
1303 + }
1304 + }
1305 + }
1306 + },
1307 + "/api/v1/function": {
1308 + "get": {
1309 + "operationId": "function1",
1310 + "tags": [
1311 + "functions"
1312 + ],
1313 + "description": "Execute a collector function.",
1314 + "parameters": [
1315 + {
1316 + "name": "function",
1317 + "in": "query",
1318 + "description": "The name of the function, as returned by the collector.",
1319 + "required": true,
1320 + "allowEmptyValue": false,
1321 + "schema": {
1322 + "type": "string"
1323 + }
1324 + },
1325 + {
1326 + "$ref": "#/components/parameters/timeoutSecs"
1327 + }
1328 + ],
1329 + "responses": {
1330 + "200": {
1331 + "description": "The collector function has been executed successfully. Each collector may return a different type of content."
1332 + },
1333 + "400": {
1334 + "description": "The request was rejected by the collector."
1335 + },
1336 + "404": {
1337 + "description": "The requested function is not found."
1338 + },
1339 + "500": {
1340 + "description": "Other internal error, getting this error means there is a bug in Netdata."
1341 + },
1342 + "503": {
1343 + "description": "The collector to execute the function is not currently available."
1344 + },
1345 + "504": {
1346 + "description": "Timeout while waiting for the collector to execute the function."
1347 + },
1348 + "591": {
1349 + "description": "The collector sent a response, but it was invalid or corrupted."
1350 + }
1351 + }
1352 + }
1353 + },
1354 + "/api/v1/functions": {
1355 + "get": {
1356 + "operationId": "functions1",
1357 + "tags": [
1358 + "functions"
1359 + ],
1360 + "summary": "Get a list of all registered collector functions.",
1361 + "description": "Collector functions are programs that can be executed on demand.",
1362 + "responses": {
1363 + "200": {
1364 + "description": "A JSON object containing one object per supported function."
1365 }
1366 }
1367 }
1368 },
1369 "/api/v1/alarms": {
1370 "get": {
1371 + "operationId": "alerts1",
1372 + "tags": [
1373 + "alerts"
1374 + ],
1375 "summary": "Get a list of active or raised alarms on the server",
1539 - "description": "The alarms endpoint returns the list of all raised or enabled alarms on the netdata server. Called without any parameters, the raised alarms in state WARNING or CRITICAL are returned. By passing \"?all\", all the enabled alarms are returned.",
1376 + "description": "The alarms endpoint returns the list of all raised or enabled alarms on the netdata server. Called without any parameters, the raised alarms in state WARNING or CRITICAL are returned. By passing \"?all\", all the enabled alarms are returned.\n",
1377 "parameters": [
1378 {
1379 "name": "all",
@@ -1575,8 +1412,12 @@
1412 },
1413 "/api/v1/alarms_values": {
1414 "get": {
1415 + "operationId": "alertValues1",
1416 + "tags": [
1417 + "alerts"
1418 + ],
1419 "summary": "Get a list of active or raised alarms on the server",
1579 - "description": "The alarms_values endpoint returns the list of all raised or enabled alarms on the netdata server. Called without any parameters, the raised alarms in state WARNING or CRITICAL are returned. By passing '?all', all the enabled alarms are returned. This option output differs from `/alarms` in the number of variables delivered. This endpoint gives to user `id`, `value`, `last_updated` time, and alarm `status`.",
1420 + "description": "The alarms_values endpoint returns the list of all raised or enabled alarms on the netdata server. Called without any parameters, the raised alarms in state WARNING or CRITICAL are returned. By passing '?all', all the enabled alarms are returned. This option output differs from `/alarms` in the number of variables delivered. This endpoint gives to user `id`, `value`, `last_updated` time, and alarm `status`.\n",
1421 "parameters": [
1422 {
1423 "name": "all",
@@ -1615,13 +1456,17 @@
1456 },
1457 "/api/v1/alarm_log": {
1458 "get": {
1459 + "operationId": "alertsLog1",
1460 + "tags": [
1461 + "alerts"
1462 + ],
1463 "summary": "Retrieves the entries of the alarm log",
1619 - "description": "Returns an array of alarm_log entries, with historical information on raised and cleared alarms.",
1464 + "description": "Returns an array of alarm_log entries, with historical information on raised and cleared alarms.\n",
1465 "parameters": [
1466 {
1467 "name": "after",
1468 "in": "query",
1624 - "description": "Passing the parameter after=UNIQUEID returns all the events in the alarm log that occurred after UNIQUEID. An automated series of calls would call the interface once without after=, store the last UNIQUEID of the returned set, and give it back to get incrementally the next events.",
1469 + "description": "Passing the parameter after=UNIQUEID returns all the events in the alarm log that occurred after UNIQUEID. An automated series of calls would call the interface once without after=, store the last UNIQUEID of the returned set, and give it back to get incrementally the next events.\n",
1470 "required": false,
1471 "schema": {
1472 "type": "integer"
@@ -1647,28 +1492,19 @@
1492 },
1493 "/api/v1/alarm_count": {
1494 "get": {
1495 + "operationId": "alertsCount1",
1496 + "tags": [
1497 + "alerts"
1498 + ],
1499 "summary": "Get an overall status of the chart",
1651 - "description": "Checks multiple charts with the same context and counts number of alarms with given status.",
1500 + "description": "Checks multiple charts with the same context and counts number of alarms with given status.\n",
1501 "parameters": [
1502 {
1654 - "in": "query",
1655 - "name": "context",
1656 - "description": "Specify context which should be checked.",
1657 - "required": false,
1658 - "allowEmptyValue": true,
1659 - "schema": {
1660 - "type": "array",
1661 - "items": {
1662 - "type": "string"
1663 - },
1664 - "default": [
1665 - "system.cpu"
1666 - ]
1667 - }
1503 + "$ref": "#/components/parameters/context"
1504 },
1505 {
1670 - "in": "query",
1506 "name": "status",
1507 + "in": "query",
1508 "description": "Specify alarm status to count.",
1509 "required": false,
1510 "allowEmptyValue": true,
@@ -1707,37 +1543,85 @@
1543 }
1544 }
1545 },
1710 - "/api/v1/manage/health": {
1546 + "/api/v1/alarm_variables": {
1547 "get": {
1712 - "summary": "Accesses the health management API to control health checks and notifications at runtime.",
1713 - "description": "Available from Netdata v1.12 and above, protected via bearer authorization. Especially useful for maintenance periods, the API allows you to disable health checks completely, silence alarm notifications, or Disable/Silence specific alarms that match selectors on alarm/template name, chart, context, host and family. For the simple disable/silence all scenarios, only the cmd parameter is required. The other parameters are used to define alarm selectors. For more information and examples, refer to the netdata documentation.",
1548 + "operationId": "getNodeAlertVariables1",
1549 + "tags": [
1550 + "alerts"
1551 + ],
1552 + "summary": "List variables available to configure alarms for a chart",
1553 + "description": "Returns the basic information of a chart and all the variables that can be used in alarm and template health configurations for the particular chart or family.\n",
1554 "parameters": [
1555 {
1716 - "name": "cmd",
1556 + "name": "chart",
1557 "in": "query",
1718 - "description": "DISABLE ALL: No alarm criteria are evaluated, nothing is written in the alarm log. SILENCE ALL: No notifications are sent. RESET: Return to the default state. DISABLE/SILENCE: Set the mode to be used for the alarms matching the criteria of the alarm selectors. LIST: Show active configuration.",
1719 - "required": false,
1558 + "description": "The id of the chart as returned by the /charts call.",
1559 + "required": true,
1560 "schema": {
1561 "type": "string",
1722 - "enum": [
1723 - "DISABLE ALL",
1724 - "SILENCE ALL",
1725 - "DISABLE",
1726 - "SILENCE",
1727 - "RESET",
1728 - "LIST"
1729 - ]
1562 + "format": "as returned by /charts",
1563 + "default": "system.cpu"
1564 }
1731 - },
1732 - {
1733 - "name": "alarm",
1734 - "in": "query",
1735 - "description": "The expression provided will match both `alarm` and `template` names.",
1736 - "schema": {
1737 - "type": "string"
1565 + }
1566 + ],
1567 + "responses": {
1568 + "200": {
1569 + "description": "A javascript object with information about the chart and the available variables.",
1570 + "content": {
1571 + "application/json": {
1572 + "schema": {
1573 + "$ref": "#/components/schemas/alarm_variables"
1574 + }
1575 + }
1576 }
1577 },
1740 - {
1578 + "400": {
1579 + "description": "Bad request - the body will include a message stating what is wrong."
1580 + },
1581 + "404": {
1582 + "description": "No chart with the given id is found."
1583 + },
1584 + "500": {
1585 + "description": "Internal server error. This usually means the server is out of memory."
1586 + }
1587 + }
1588 + }
1589 + },
1590 + "/api/v1/manage/health": {
1591 + "get": {
1592 + "operationId": "health1",
1593 + "tags": [
1594 + "management"
1595 + ],
1596 + "summary": "Accesses the health management API to control health checks and notifications at runtime.\n",
1597 + "description": "Available from Netdata v1.12 and above, protected via bearer authorization. Especially useful for maintenance periods, the API allows you to disable health checks completely, silence alarm notifications, or Disable/Silence specific alarms that match selectors on alarm/template name, chart, context, host and family. For the simple disable/silence all scenarios, only the cmd parameter is required. The other parameters are used to define alarm selectors. For more information and examples, refer to the netdata documentation.\n",
1598 + "parameters": [
1599 + {
1600 + "name": "cmd",
1601 + "in": "query",
1602 + "description": "DISABLE ALL: No alarm criteria are evaluated, nothing is written in the alarm log. SILENCE ALL: No notifications are sent. RESET: Return to the default state. DISABLE/SILENCE: Set the mode to be used for the alarms matching the criteria of the alarm selectors. LIST: Show active configuration.\n",
1603 + "required": false,
1604 + "schema": {
1605 + "type": "string",
1606 + "enum": [
1607 + "DISABLE ALL",
1608 + "SILENCE ALL",
1609 + "DISABLE",
1610 + "SILENCE",
1611 + "RESET",
1612 + "LIST"
1613 + ]
1614 + }
1615 + },
1616 + {
1617 + "name": "alarm",
1618 + "in": "query",
1619 + "description": "The expression provided will match both `alarm` and `template` names.",
1620 + "schema": {
1621 + "type": "string"
1622 + }
1623 + },
1624 + {
1625 "name": "chart",
1626 "in": "query",
1627 "description": "Chart ids/names, as shown on the dashboard. These will match the `on` entry of a configured `alarm`.",
@@ -1782,8 +1666,12 @@
1666 },
1667 "/api/v1/aclk": {
1668 "get": {
1669 + "operationId": "aclk1",
1670 + "tags": [
1671 + "management"
1672 + ],
1673 "summary": "Get information about current ACLK state",
1786 - "description": "ACLK endpoint returns detailed information about current state of ACLK (Agent to Cloud communication).",
1674 + "description": "ACLK endpoint returns detailed information about current state of ACLK (Agent to Cloud communication).\n",
1675 "responses": {
1676 "200": {
1677 "description": "JSON object with ACLK information.",
@@ -1797,834 +1685,873 @@
1685 }
1686 }
1687 }
1800 - },
1801 - "/api/v1/metric_correlations": {
1802 - "get": {
1803 - "summary": "Analyze all the metrics to find their correlations",
1804 - "description": "THIS ENDPOINT IS OBSOLETE. Use the /weights endpoint. Given two time-windows (baseline, highlight), it goes through all the available metrics, querying both windows and tries to find how these two windows relate to each other. It supports multiple algorithms to do so. The result is a list of all metrics evaluated, weighted for 0.0 (the two windows are more different) to 1.0 (the two windows are similar). The algorithm adjusts automatically the baseline window to be a power of two multiple of the highlighted (1, 2, 4, 8, etc).",
1805 - "parameters": [
1806 - {
1807 - "name": "baseline_after",
1808 - "in": "query",
1809 - "description": "This parameter can either be an absolute timestamp specifying the starting point of baseline window, or a relative number of seconds (negative, relative to parameter baseline_before). Netdata will assume it is a relative number if it is less that 3 years (in seconds).",
1810 - "required": false,
1811 - "allowEmptyValue": false,
1812 - "schema": {
1813 - "type": "number",
1814 - "format": "integer",
1815 - "default": -300
1816 - }
1688 + }
1689 + },
1690 + "components": {
1691 + "parameters": {
1692 + "scopeNodes": {
1693 + "name": "scope_nodes",
1694 + "in": "query",
1695 + "description": "A simple pattern limiting the nodes scope of the query. The scope controls both data and metadata response. The simple pattern is checked against the nodes' machine guid, node id and hostname. The default nodes scope is all nodes for which this agent has data for. Usually the nodes scope is used to slice the entire dashboard (e.g. the Global Nodes Selector at the Netdata Cloud overview dashboard). Both positive and negative simple pattern expressions are supported.\n",
1696 + "required": false,
1697 + "schema": {
1698 + "type": "string",
1699 + "format": "simple pattern",
1700 + "default": "*"
1701 + }
1702 + },
1703 + "scopeContexts": {
1704 + "name": "scope_contexts",
1705 + "in": "query",
1706 + "description": "A simple pattern limiting the contexts scope of the query. The scope controls both data and metadata response. The default contexts scope is all contexts for which this agent has data for. Usually the contexts scope is used to slice data on the dashboard (e.g. each context based chart has its own contexts scope, limiting the chart to all the instances of the selected context). Both positive and negative simple pattern expressions are supported.\n",
1707 + "required": false,
1708 + "schema": {
1709 + "type": "string",
1710 + "format": "simple pattern",
1711 + "default": "*"
1712 + }
1713 + },
1714 + "filterNodes": {
1715 + "name": "nodes",
1716 + "in": "query",
1717 + "description": "A simple pattern matching the nodes to be queried. This only controls the data response, not the metadata. The simple pattern is checked against the nodes' machine guid, node id, hostname. The default nodes selector is all the nodes matched by the nodes scope. Both positive and negative simple pattern expressions are supported.\n",
1718 + "required": false,
1719 + "schema": {
1720 + "type": "string",
1721 + "format": "simple pattern",
1722 + "default": "*"
1723 + }
1724 + },
1725 + "filterContexts": {
1726 + "name": "contexts",
1727 + "in": "query",
1728 + "description": "A simple pattern matching the contexts to be queried. This only controls the data response, not the metadata. Both positive and negative simple pattern expressions are supported.\n",
1729 + "required": false,
1730 + "schema": {
1731 + "type": "string",
1732 + "format": "simple pattern",
1733 + "default": "*"
1734 + }
1735 + },
1736 + "filterInstances": {
1737 + "name": "instances",
1738 + "in": "query",
1739 + "description": "A simple pattern matching the instances to be queried. The simple pattern is checked against the instance `id`, the instance `name`, the fully qualified name of the instance `id` and `name`, like `instance@machine_guid`, where `instance` is either its `id` or `name`. Both positive and negative simple pattern expressions are supported.\n",
1740 + "required": false,
1741 + "schema": {
1742 + "type": "string",
1743 + "format": "simple pattern",
1744 + "default": "*"
1745 + }
1746 + },
1747 + "filterLabels": {
1748 + "name": "labels",
1749 + "in": "query",
1750 + "description": "A simple pattern matching the labels to be queried. The simple pattern is checked against `name:value` of all the labels of all the eligible instances (as filtered by all the above: scope nodes, scope contexts, nodes, contexts and instances). Negative simple patterns should not be used in this filter.\n",
1751 + "required": false,
1752 + "schema": {
1753 + "type": "string",
1754 + "format": "simple pattern",
1755 + "default": "*"
1756 + }
1757 + },
1758 + "filterAlerts": {
1759 + "name": "alerts",
1760 + "in": "query",
1761 + "description": "A simple pattern matching the alerts to be queried. The simple pattern is checked against the `name` of alerts and the combination of `name:status`, when status is one of `CLEAR`, `WARNING`, `CRITICAL`, `REMOVED`, `UNDEFINED`, `UNINITIALIZED`, of all the alerts of all the eligible instances (as filtered by all the above). A negative simple pattern will exclude the instances having the labels matched.\n",
1762 + "required": false,
1763 + "schema": {
1764 + "type": "string",
1765 + "format": "simple pattern",
1766 + "default": "*"
1767 + }
1768 + },
1769 + "filterDimensions": {
1770 + "name": "dimensions",
1771 + "in": "query",
1772 + "description": "A simple patterns matching the dimensions to be queried. The simple pattern is checked against and `id` and the `name` of the dimensions of the eligible instances (as filtered by all the above). Both positive and negative simple pattern expressions are supported.\n",
1773 + "required": false,
1774 + "schema": {
1775 + "type": "string",
1776 + "format": "simple pattern",
1777 + "default": "*"
1778 + }
1779 + },
1780 + "dataFormat1": {
1781 + "name": "format",
1782 + "in": "query",
1783 + "description": "The format of the data to be returned.",
1784 + "allowEmptyValue": false,
1785 + "schema": {
1786 + "type": "string",
1787 + "enum": [
1788 + "json",
1789 + "jsonp",
1790 + "csv",
1791 + "tsv",
1792 + "tsv-excel",
1793 + "ssv",
1794 + "ssvcomma",
1795 + "datatable",
1796 + "datasource",
1797 + "html",
1798 + "markdown",
1799 + "array",
1800 + "csvjsonarray"
1801 + ],
1802 + "default": "json"
1803 + }
1804 + },
1805 + "dataFormat2": {
1806 + "name": "format",
1807 + "in": "query",
1808 + "description": "The format of the data to be returned.",
1809 + "allowEmptyValue": false,
1810 + "schema": {
1811 + "type": "string",
1812 + "enum": [
1813 + "json",
1814 + "json2",
1815 + "jsonp",
1816 + "csv",
1817 + "tsv",
1818 + "tsv-excel",
1819 + "ssv",
1820 + "ssvcomma",
1821 + "datatable",
1822 + "datasource",
1823 + "html",
1824 + "markdown",
1825 + "array",
1826 + "csvjsonarray"
1827 + ],
1828 + "default": "json2"
1829 + }
1830 + },
1831 + "dataQueryOptions": {
1832 + "name": "options",
1833 + "in": "query",
1834 + "description": "Options that affect data generation.\n* `jsonwrap` - Wrap the output in a JSON object with metadata about the query.\n* `raw` - change the output so that it is aggregatable across multiple such queries. Supported by `/api/v2` data queries and `json2` format.\n* `minify` - Remove unnecessary spaces and newlines from the output.\n* `debug` - Provide additional information in `jsonwrap` output to help tracing issues.\n* `nonzero` - Do not return dimensions that all their values are zero, to improve the visual appearance of charts. They will still be returned if all the dimensions are entirely zero.\n* `null2zero` - Replace `null` values with `0`.\n* `absolute` or `abs` - Traditionally Netdata returns select dimensions negative to improve visual appearance. This option turns this feature off.\n* `display-absolute` - Only used by badges, to do color calculation using the signed value, but render the value without a sign.\n* `flip` or `reversed` - Order the timestamps array in reverse order (newest to oldest).\n* `min2max` - When flattening multi-dimensional data into a single metric format, use `max - min` instead of `sum`. This is EOL - use `/api/v2` to control aggregation across dimensions.\n* `percentage` - Convert all values into a percentage vs the row total. When enabled, Netdata will query all dimensions, even the ones that have not been selected or are hidden, to find the row total, in order to calculate the percentage of each dimension selected.\n* `seconds` - Output timestamps in seconds instead of dates.\n* `milliseconds` or `ms` - Output timestamps in milliseconds instead of dates.\n* `unaligned` - by default queries are aligned to the the view, so that as time passes past data returned do not change. When a data query will not be used for visualization, `unaligned` can be given to avoid aligning the query time-frame for visual precision.\n* `match-ids`, `match-names`. By default filters match both IDs and names when they are available. Setting either of the two options will disable the other.\n* `anomaly-bit` - query the anomaly information instead of metric values. This is EOL, use `/api/v2` and `json2` format which always returns this information and many more.\n* `jw-anomaly-rates` - return anomaly rates as a separate result set in the same `json` format response. This is EOL, use `/api/v2` and `json2` format which always returns information and many more. \n* `details` - `/api/v2/data` returns in `jsonwrap` the full tree of dimensions that have been matched by the query.\n* `group-by-labels` - `/api/v2/data` returns in `jsonwrap` flattened labels per output dimension. These are used to identify the instances that have been aggregated into each dimension, making it possible to provide a map, like Netdata does for Kubernetes.\n* `natural-points` - return timestamps as found in the database. The result is again fixed-step, but the query engine attempts to align them with the timestamps found in the database.\n* `virtual-points` - return timestamps independent of the database alignment. This is needed aggregating data across multiple Netdata agents, to ensure that their outputs do not need to be interpolated to be merged.\n* `selected-tier` - use data exclusively from the selected tier given with the `tier` parameter. This option is set automatically when the `tier` parameter is set.\n* `all-dimensions` - In `/api/v1` `jsonwrap` include metadata for all candidate metrics examined. In `/api/v2` this is standard behavior and no option is needed.\n* `label-quotes` - In `csv` output format, enclose each header label in quotes.\n* `objectrows` - Each row of value should be an object, not an array (only for `json` format).\n* `google_json` - Comply with google JSON/JSONP specs (only for `json` format).\n",
1835 + "required": false,
1836 + "allowEmptyValue": false,
1837 + "schema": {
1838 + "type": "array",
1839 + "items": {
1840 + "type": "string",
1841 + "enum": [
1842 + "jsonwrap",
1843 + "raw",
1844 + "minify",
1845 + "debug",
1846 + "nonzero",
1847 + "null2zero",
1848 + "abs",
1849 + "absolute",
1850 + "display-absolute",
1851 + "flip",
1852 + "reversed",
1853 + "min2max",
1854 + "percentage",
1855 + "seconds",
1856 + "ms",
1857 + "milliseconds",
1858 + "unaligned",
1859 + "match-ids",
1860 + "match-names",
1861 + "anomaly-bit",
1862 + "jw-anomaly-rates",
1863 + "details",
1864 + "group-by-labels",
1865 + "natural-points",
1866 + "virtual-points",
1867 + "selected-tier",
1868 + "all-dimensions",
1869 + "label-quotes",
1870 + "objectrows",
1871 + "google_json"
1872 + ]
1873 },
1818 - {
1819 - "name": "baseline_before",
1820 - "in": "query",
1821 - "description": "This parameter can either be an absolute timestamp specifying the ending point of the baseline window, or a relative number of seconds (negative), relative to the last collected timestamp. Netdata will assume it is a relative number if it is less than 3 years (in seconds).",
1822 - "required": false,
1823 - "schema": {
1824 - "type": "number",
1825 - "format": "integer",
1826 - "default": -60
1827 - }
1874 + "default": [
1875 + "seconds",
1876 + "jsonwrap"
1877 + ]
1878 + }
1879 + },
1880 + "dataTimeGroup1": {
1881 + "name": "group",
1882 + "in": "query",
1883 + "description": "Time aggregation function. If multiple collected values are to be grouped in order to return fewer points, this parameters defines the method of grouping. If the `absolute` option is set, the values are turned positive before applying this calculation.\n",
1884 + "required": false,
1885 + "schema": {
1886 + "type": "string",
1887 + "enum": [
1888 + "min",
1889 + "max",
1890 + "avg",
1891 + "average",
1892 + "median",
1893 + "stddev",
1894 + "sum",
1895 + "incremental-sum",
1896 + "ses",
1897 + "des",
1898 + "cv",
1899 + "countif",
1900 + "percentile",
1901 + "percentile25",
1902 + "percentile50",
1903 + "percentile75",
1904 + "percentile80",
1905 + "percentile90",
1906 + "percentile95",
1907 + "percentile97",
1908 + "percentile98",
1909 + "percentile99",
1910 + "trimmed-mean",
1911 + "trimmed-mean1",
1912 + "trimmed-mean2",
1913 + "trimmed-mean3",
1914 + "trimmed-mean5",
1915 + "trimmed-mean10",
1916 + "trimmed-mean15",
1917 + "trimmed-mean20",
1918 + "trimmed-mean25",
1919 + "trimmed-median",
1920 + "trimmed-median1",
1921 + "trimmed-median2",
1922 + "trimmed-median3",
1923 + "trimmed-median5",
1924 + "trimmed-median10",
1925 + "trimmed-median15",
1926 + "trimmed-median20",
1927 + "trimmed-median25"
1928 + ],
1929 + "default": "average"
1930 + }
1931 + },
1932 + "dataTimeGroup2": {
1933 + "name": "time_group",
1934 + "in": "query",
1935 + "description": "Time aggregation function. If multiple collected values are to be grouped in order to return fewer points, this parameters defines the method of grouping. If the `absolute` option is set, the values are turned positive before applying this calculation.\n",
1936 + "required": false,
1937 + "schema": {
1938 + "type": "string",
1939 + "enum": [
1940 + "min",
1941 + "max",
1942 + "avg",
1943 + "average",
1944 + "median",
1945 + "stddev",
1946 + "sum",
1947 + "incremental-sum",
1948 + "ses",
1949 + "des",
1950 + "cv",
1951 + "countif",
1952 + "percentile",
1953 + "percentile25",
1954 + "percentile50",
1955 + "percentile75",
1956 + "percentile80",
1957 + "percentile90",
1958 + "percentile95",
1959 + "percentile97",
1960 + "percentile98",
1961 + "percentile99",
1962 + "trimmed-mean",
1963 + "trimmed-mean1",
1964 + "trimmed-mean2",
1965 + "trimmed-mean3",
1966 + "trimmed-mean5",
1967 + "trimmed-mean10",
1968 + "trimmed-mean15",
1969 + "trimmed-mean20",
1970 + "trimmed-mean25",
1971 + "trimmed-median",
1972 + "trimmed-median1",
1973 + "trimmed-median2",
1974 + "trimmed-median3",
1975 + "trimmed-median5",
1976 + "trimmed-median10",
1977 + "trimmed-median15",
1978 + "trimmed-median20",
1979 + "trimmed-median25"
1980 + ],
1981 + "default": "average"
1982 + }
1983 + },
1984 + "dataTimeGroupOptions1": {
1985 + "name": "group_options",
1986 + "in": "query",
1987 + "description": "When the time grouping function supports additional parameters, this field can be used to pass them to it. Currently `countif`, `trimmed-mean`, `trimmed-median` and `percentile` support this. For `countif` the string may start with `<`, `<=`, `<:`, `<>`, `!=`, `>`, `>=`, `>:`. For all others just a number is expected.\n",
1988 + "required": false,
1989 + "schema": {
1990 + "type": "string"
1991 + }
1992 + },
1993 + "dataTimeGroupOptions2": {
1994 + "name": "time_group_options",
1995 + "in": "query",
1996 + "description": "When the time grouping function supports additional parameters, this field can be used to pass them to it. Currently `countif`, `trimmed-mean`, `trimmed-median` and `percentile` support this. For `countif` the string may start with `<`, `<=`, `<:`, `<>`, `!=`, `>`, `>=`, `>:`. For all others just a number is expected.\n",
1997 + "required": false,
1998 + "schema": {
1999 + "type": "string"
2000 + }
2001 + },
2002 + "dataTimeResampling1": {
2003 + "name": "gtime",
2004 + "in": "query",
2005 + "description": "The grouping number of seconds. This is used in conjunction with group=average to change the units of metrics (ie when the data is per-second, setting gtime=60 will turn them to per-minute).\n",
2006 + "required": false,
2007 + "allowEmptyValue": false,
2008 + "schema": {
2009 + "type": "number",
2010 + "format": "integer",
2011 + "default": 0
2012 + }
2013 + },
2014 + "dataTimeResampling2": {
2015 + "name": "time_resampling",
2016 + "in": "query",
2017 + "description": "For incremental values that are \"per second\", this value is used to resample them to \"per minute` (60) or \"per hour\" (3600). It can only be used in conjunction with group=average.\n",
2018 + "required": false,
2019 + "schema": {
2020 + "type": "number",
2021 + "format": "integer",
2022 + "default": 0
2023 + }
2024 + },
2025 + "timeoutMS": {
2026 + "name": "timeout",
2027 + "in": "query",
2028 + "description": "Specify a timeout value in milliseconds after which the agent will abort the query and return a 503 error. A value of 0 indicates no timeout.\n",
2029 + "required": false,
2030 + "schema": {
2031 + "type": "number",
2032 + "format": "integer",
2033 + "default": 0
2034 + }
2035 + },
2036 + "timeoutSecs": {
2037 + "name": "timeout",
2038 + "in": "query",
2039 + "description": "Specify a timeout value in seconds after which the agent will abort the query and return a 504 error. A value of 0 indicates no timeout, but some endpoints, like `weights`, do not accept infinite timeouts (they have a predefined default), so to disable the timeout it must be set to a really high value.\n",
2040 + "required": false,
2041 + "schema": {
2042 + "type": "number",
2043 + "format": "integer",
2044 + "default": 0
2045 + }
2046 + },
2047 + "before": {
2048 + "name": "before",
2049 + "in": "query",
2050 + "description": "`after` and `before` define the time-frame of a query. `before` can be a negative number of seconds, up to 3 years (-94608000), relative to current clock. If not set, it is assumed to be the current clock time. When `before` is positive, it is assumed to be a unix epoch timestamp. When non-data endpoints support the `after` and `before`, they use the time-frame to limit their response for objects having data retention within the time-frame given.\n",
2051 + "required": false,
2052 + "schema": {
2053 + "type": "integer",
2054 + "default": 0
2055 + }
2056 + },
2057 + "after": {
2058 + "name": "after",
2059 + "in": "query",
2060 + "description": "`after` and `before` define the time-frame of a query. `after` can be a negative number of seconds, up to 3 years (-94608000), relative to `before`. If not set, it is usually assumed to be -600. When non-data endpoints support the `after` and `before`, they use the time-frame to limit their response for objects having data retention within the time-frame given.\n",
2061 + "required": false,
2062 + "schema": {
2063 + "type": "integer",
2064 + "default": -600
2065 + }
2066 + },
2067 + "baselineBefore": {
2068 + "name": "baseline_before",
2069 + "in": "query",
2070 + "description": "`baseline_after` and `baseline_before` define the baseline time-frame of a comparative query. `baseline_before` can be a negative number of seconds, up to 3 years (-94608000), relative to current clock. If not set, it is assumed to be the current clock time. When `baseline_before` is positive, it is assumed to be a unix epoch timestamp.\n",
2071 + "required": false,
2072 + "schema": {
2073 + "type": "integer",
2074 + "default": 0
2075 + }
2076 + },
2077 + "baselineAfter": {
2078 + "name": "baseline_after",
2079 + "in": "query",
2080 + "description": "`baseline_after` and `baseline_before` define the baseline time-frame of a comparative query. `baseline_after` can be a negative number of seconds, up to 3 years (-94608000), relative to `baseline_before`. If not set, it is usually assumed to be -300.\n",
2081 + "required": false,
2082 + "schema": {
2083 + "type": "integer",
2084 + "default": -600
2085 + }
2086 + },
2087 + "points": {
2088 + "name": "points",
2089 + "in": "query",
2090 + "description": "The number of points to be returned. If not given, or it is <= 0, or it is bigger than the points stored in the database for the given duration, all the available collected values for the given duration will be returned. For `weights` endpoints that do statistical analysis, the `points` define the detail of this analysis (the default is 500).\n",
2091 + "required": false,
2092 + "schema": {
2093 + "type": "number",
2094 + "format": "integer",
2095 + "default": 0
2096 + }
2097 + },
2098 + "tier": {
2099 + "name": "tier",
2100 + "in": "query",
2101 + "description": "Use only the given dbengine tier for executing the query. Setting this parameters automatically sets the option `selected-tier` for the query.\n",
2102 + "required": false,
2103 + "schema": {
2104 + "type": "number",
2105 + "format": "integer"
2106 + }
2107 + },
2108 + "callback": {
2109 + "name": "callback",
2110 + "in": "query",
2111 + "description": "For JSONP responses, the callback function name.\n",
2112 + "required": false,
2113 + "schema": {
2114 + "type": "string"
2115 + }
2116 + },
2117 + "filename": {
2118 + "name": "filename",
2119 + "in": "query",
2120 + "description": "Add `Content-Disposition: attachment; filename=` header to the response, that will instruct the browser to save the response with the given filename.\"\n",
2121 + "required": false,
2122 + "schema": {
2123 + "type": "string"
2124 + }
2125 + },
2126 + "tqx": {
2127 + "name": "tqx",
2128 + "in": "query",
2129 + "description": "[Google Visualization API](https://developers.google.com/chart/interactive/docs/dev/implementing_data_source?hl=en) formatted parameter.\n",
2130 + "required": false,
2131 + "schema": {
2132 + "type": "string"
2133 + }
2134 + },
2135 + "contextOptions1": {
2136 + "name": "options",
2137 + "in": "query",
2138 + "description": "Options that affect data generation.",
2139 + "required": false,
2140 + "schema": {
2141 + "type": "array",
2142 + "items": {
2143 + "type": "string",
2144 + "enum": [
2145 + "full",
2146 + "all",
2147 + "charts",
2148 + "dimensions",
2149 + "labels",
2150 + "uuids",
2151 + "queue",
2152 + "flags",
2153 + "deleted",
2154 + "deepscan"
2155 + ]
2156 + }
2157 + }
2158 + },
2159 + "chart": {
2160 + "name": "chart",
2161 + "in": "query",
2162 + "description": "The id of the chart as returned by the `/api/v1/charts` call.",
2163 + "required": false,
2164 + "allowEmptyValue": false,
2165 + "schema": {
2166 + "type": "string",
2167 + "format": "as returned by `/api/v1/charts`"
2168 + }
2169 + },
2170 + "context": {
2171 + "name": "context",
2172 + "in": "query",
2173 + "description": "The context of the chart as returned by the /charts call.",
2174 + "required": false,
2175 + "allowEmptyValue": false,
2176 + "schema": {
2177 + "type": "string",
2178 + "format": "as returned by /charts"
2179 + }
2180 + },
2181 + "dimension": {
2182 + "name": "dimension",
2183 + "in": "query",
2184 + "description": "Zero, one or more dimension ids or names, as returned by the /chart call, separated with comma or pipe. Netdata simple patterns are supported.",
2185 + "required": false,
2186 + "allowEmptyValue": false,
2187 + "schema": {
2188 + "type": "array",
2189 + "items": {
2190 + "type": "string",
2191 + "format": "as returned by /charts"
2192 + }
2193 + }
2194 + },
2195 + "dimensions": {
2196 + "name": "dimensions",
2197 + "in": "query",
2198 + "description": "a simple pattern matching dimensions (use comma or pipe as separator)",
2199 + "required": false,
2200 + "allowEmptyValue": true,
2201 + "schema": {
2202 + "type": "string"
2203 + }
2204 + },
2205 + "chart_label_key": {
2206 + "name": "chart_label_key",
2207 + "in": "query",
2208 + "description": "Specify the chart label keys that need to match for context queries as comma separated values. At least one matching key is needed to match the corresponding chart.\n",
2209 + "required": false,
2210 + "allowEmptyValue": false,
2211 + "schema": {
2212 + "type": "string",
2213 + "format": "key1,key2,key3"
2214 + }
2215 + },
2216 + "chart_labels_filter": {
2217 + "name": "chart_labels_filter",
2218 + "in": "query",
2219 + "description": "Specify the chart label keys and values to match for context queries. All keys/values need to match for the chart to be included in the query. The labels are specified as key1:value1,key2:value2\n",
2220 + "required": false,
2221 + "allowEmptyValue": false,
2222 + "schema": {
2223 + "type": "string",
2224 + "format": "key1:value1,key2:value2,key3:value3"
2225 + }
2226 + },
2227 + "weightMethods": {
2228 + "name": "method",
2229 + "in": "query",
2230 + "description": "The weighting / scoring algorithm.",
2231 + "required": false,
2232 + "schema": {
2233 + "type": "string",
2234 + "enum": [
2235 + "ks2",
2236 + "volume",
2237 + "anomaly-rate",
2238 + "value"
2239 + ]
2240 + }
2241 + }
2242 + },
2243 + "schemas": {
2244 + "info": {
2245 + "type": "object",
2246 + "properties": {
2247 + "version": {
2248 + "type": "string",
2249 + "description": "netdata version of the server.",
2250 + "example": "1.11.1_rolling"
2251 },
1829 - {
1830 - "name": "after",
1831 - "in": "query",
1832 - "description": "This parameter can either be an absolute timestamp specifying the starting point of highlighted window, or a relative number of seconds (negative, relative to parameter highlight_before). Netdata will assume it is a relative number if it is less that 3 years (in seconds).",
1833 - "required": false,
1834 - "allowEmptyValue": false,
1835 - "schema": {
1836 - "type": "number",
1837 - "format": "integer",
1838 - "default": -60
1839 - }
2252 + "uid": {
2253 + "type": "string",
2254 + "description": "netdata unique id of the server.",
2255 + "example": "24e9fe3c-f2ac-11e8-bafc-0242ac110002"
2256 },
1841 - {
1842 - "name": "before",
1843 - "in": "query",
1844 - "description": "This parameter can either be an absolute timestamp specifying the ending point of the highlighted window, or a relative number of seconds (negative), relative to the last collected timestamp. Netdata will assume it is a relative number if it is less than 3 years (in seconds).",
1845 - "required": false,
1846 - "schema": {
1847 - "type": "number",
1848 - "format": "integer",
1849 - "default": 0
1850 - }
2257 + "mirrored_hosts": {
2258 + "type": "array",
2259 + "description": "List of hosts mirrored of the server (include itself).",
2260 + "items": {
2261 + "type": "string"
2262 + },
2263 + "example": [
2264 + "host1.example.com",
2265 + "host2.example.com"
2266 + ]
2267 },
1852 - {
1853 - "name": "points",
1854 - "in": "query",
1855 - "description": "The number of points to be evaluated for the highlighted window. The baseline window will be adjusted automatically to receive a proportional amount of points.",
1856 - "required": false,
1857 - "allowEmptyValue": false,
1858 - "schema": {
1859 - "type": "number",
1860 - "format": "integer",
1861 - "default": 500
2268 + "mirrored_hosts_status": {
2269 + "type": "array",
2270 + "description": "List of details of hosts mirrored to this served (including self). Indexes correspond to indexes in \"mirrored_hosts\".",
2271 + "items": {
2272 + "type": "object",
2273 + "description": "Host data",
2274 + "properties": {
2275 + "guid": {
2276 + "type": "string",
2277 + "format": "uuid",
2278 + "nullable": false,
2279 + "description": "Host unique GUID from `netdata.public.unique.id`.",
2280 + "example": "245e4bff-3b34-47c1-a6e5-5c535a9abfb2"
2281 + },
2282 + "reachable": {
2283 + "type": "boolean",
2284 + "nullable": false,
2285 + "description": "Current state of streaming. Always true for localhost/self."
2286 + },
2287 + "claim_id": {
2288 + "type": "string",
2289 + "format": "uuid",
2290 + "nullable": true,
2291 + "description": "Cloud GUID/identifier in case the host is claimed. If child status unknown or unclaimed this field is set to `null`",
2292 + "example": "c3b2a66a-3052-498c-ac52-7fe9e8cccb0c"
2293 + }
2294 + }
2295 }
2296 },
1864 - {
1865 - "name": "method",
1866 - "in": "query",
1867 - "description": "the algorithm to run",
1868 - "required": false,
1869 - "schema": {
1870 - "type": "string",
1871 - "enum": [
1872 - "ks2",
1873 - "volume"
1874 - ],
1875 - "default": "ks2"
1876 - }
2297 + "os_name": {
2298 + "type": "string",
2299 + "description": "Operating System Name.",
2300 + "example": "Manjaro Linux"
2301 },
1878 - {
1879 - "name": "timeout",
1880 - "in": "query",
1881 - "description": "Cancel the query if to takes more that this amount of milliseconds.",
1882 - "required": false,
1883 - "allowEmptyValue": false,
1884 - "schema": {
1885 - "type": "number",
1886 - "format": "integer",
1887 - "default": 60000
1888 - }
2302 + "os_id": {
2303 + "type": "string",
2304 + "description": "Operating System ID.",
2305 + "example": "manjaro"
2306 },
1890 - {
1891 - "name": "options",
1892 - "in": "query",
1893 - "description": "Options that affect data generation.",
1894 - "required": false,
1895 - "allowEmptyValue": false,
1896 - "schema": {
1897 - "type": "array",
1898 - "items": {
1899 - "type": "string",
1900 - "enum": [
1901 - "min2max",
1902 - "abs",
1903 - "absolute",
1904 - "absolute-sum",
1905 - "null2zero",
1906 - "percentage",
1907 - "unaligned",
1908 - "allow_past",
1909 - "nonzero",
1910 - "anomaly-bit",
1911 - "raw"
1912 - ]
1913 - },
1914 - "default": [
1915 - "null2zero",
1916 - "allow_past",
1917 - "nonzero",
1918 - "unaligned"
1919 - ]
1920 - }
2307 + "os_id_like": {
2308 + "type": "string",
2309 + "description": "Known OS similar to this OS.",
2310 + "example": "arch"
2311 },
1922 - {
1923 - "name": "group",
1924 - "in": "query",
1925 - "description": "The grouping method. If multiple collected values are to be grouped in order to return fewer points, this parameters defines the method of grouping. methods supported \"min\", \"max\", \"average\", \"sum\", \"incremental-sum\". \"max\" is actually calculated on the absolute value collected (so it works for both positive and negative dimensions to return the most extreme value in either direction).",
1926 - "required": true,
1927 - "allowEmptyValue": false,
1928 - "schema": {
1929 - "type": "string",
1930 - "enum": [
1931 - "min",
1932 - "max",
1933 - "average",
1934 - "median",
1935 - "stddev",
1936 - "sum",
1937 - "incremental-sum",
1938 - "ses",
1939 - "des",
1940 - "cv",
1941 - "countif",
1942 - "percentile",
1943 - "percentile25",
1944 - "percentile50",
1945 - "percentile75",
1946 - "percentile80",
1947 - "percentile90",
1948 - "percentile95",
1949 - "percentile97",
1950 - "percentile98",
1951 - "percentile99",
1952 - "trimmed-mean",
1953 - "trimmed-mean1",
1954 - "trimmed-mean2",
1955 - "trimmed-mean3",
1956 - "trimmed-mean5",
1957 - "trimmed-mean10",
1958 - "trimmed-mean15",
1959 - "trimmed-mean20",
1960 - "trimmed-mean25",
1961 - "trimmed-median",
1962 - "trimmed-median1",
1963 - "trimmed-median2",
1964 - "trimmed-median3",
1965 - "trimmed-median5",
1966 - "trimmed-median10",
1967 - "trimmed-median15",
1968 - "trimmed-median20",
1969 - "trimmed-median25"
1970 - ],
1971 - "default": "average"
1972 - }
1973 - },
1974 - {
1975 - "name": "group_options",
1976 - "in": "query",
1977 - "description": "When the group function supports additional parameters, this field can be used to pass them to it. Currently only \"countif\" supports this.",
1978 - "required": false,
1979 - "allowEmptyValue": false,
1980 - "schema": {
1981 - "type": "string"
1982 - }
1983 - }
1984 - ],
1985 - "responses": {
1986 - "200": {
1987 - "description": "JSON object with weights for each chart and dimension.",
1988 - "content": {
1989 - "application/json": {
1990 - "schema": {
1991 - "$ref": "#/components/schemas/metric_correlations"
1992 - }
1993 - }
1994 - }
2312 + "os_version": {
2313 + "type": "string",
2314 + "description": "Operating System Version.",
2315 + "example": "18.0.4"
2316 },
1996 - "400": {
1997 - "description": "The given parameters are invalid."
2317 + "os_version_id": {
2318 + "type": "string",
2319 + "description": "Operating System Version ID.",
2320 + "example": "unknown"
2321 },
1999 - "403": {
2000 - "description": "metrics correlations are not enabled on this Netdata Agent."
2322 + "os_detection": {
2323 + "type": "string",
2324 + "description": "OS parameters detection method.",
2325 + "example": "Mixed"
2326 },
2002 - "404": {
2003 - "description": "No charts could be found, or the method that correlated the metrics did not produce any result."
2327 + "kernel_name": {
2328 + "type": "string",
2329 + "description": "Kernel Name.",
2330 + "example": "Linux"
2331 },
2005 - "504": {
2006 - "description": "Timeout - the query took too long and has been cancelled."
2007 - }
2008 - }
2009 - }
2010 - },
2011 - "/api/v1/function": {
2012 - "get": {
2013 - "summary": "Execute a collector function.",
2014 - "parameters": [
2015 - {
2016 - "name": "function",
2017 - "in": "query",
2018 - "description": "The name of the function, as returned by the collector.",
2019 - "required": true,
2020 - "allowEmptyValue": false,
2021 - "schema": {
2022 - "type": "string"
2023 - }
2332 + "kernel_version": {
2333 + "type": "string",
2334 + "description": "Kernel Version.",
2335 + "example": "4.19.32-1-MANJARO"
2336 },
2025 - {
2026 - "name": "timeout",
2027 - "in": "query",
2028 - "description": "The timeout in seconds to wait for the function to complete.",
2029 - "required": false,
2030 - "schema": {
2031 - "type": "number",
2032 - "format": "integer",
2033 - "default": 10
2034 - }
2035 - }
2036 - ],
2037 - "responses": {
2038 - "200": {
2039 - "description": "The collector function has been executed successfully. Each collector may return a different type of content."
2337 + "is_k8s_node": {
2338 + "type": "boolean",
2339 + "description": "Netdata is running on a K8s node.",
2340 + "example": false
2341 },
2041 - "400": {
2042 - "description": "The request was rejected by the collector."
2342 + "architecture": {
2343 + "type": "string",
2344 + "description": "Kernel architecture.",
2345 + "example": "x86_64"
2346 },
2044 - "404": {
2045 - "description": "The requested function is not found."
2347 + "virtualization": {
2348 + "type": "string",
2349 + "description": "Virtualization Type.",
2350 + "example": "kvm"
2351 },
2047 - "500": {
2048 - "description": "Other internal error, getting this error means there is a bug in Netdata."
2352 + "virt_detection": {
2353 + "type": "string",
2354 + "description": "Virtualization detection method.",
2355 + "example": "systemd-detect-virt"
2356 },
2050 - "503": {
2051 - "description": "The collector to execute the function is not currently available."
2357 + "container": {
2358 + "type": "string",
2359 + "description": "Container technology.",
2360 + "example": "docker"
2361 },
2053 - "504": {
2054 - "description": "Timeout while waiting for the collector to execute the function."
2362 + "container_detection": {
2363 + "type": "string",
2364 + "description": "Container technology detection method.",
2365 + "example": "dockerenv"
2366 },
2056 - "591": {
2057 - "description": "The collector sent a response, but it was invalid or corrupted."
2058 - }
2059 - }
2060 - }
2061 - },
2062 - "/api/v1/functions": {
2063 - "get": {
2064 - "summary": "Get a list of all registered collector functions.",
2065 - "description": "Collector functions are programs that can be executed on demand.",
2066 - "responses": {
2067 - "200": {
2068 - "description": "A JSON object containing one object per supported function."
2069 - }
2070 - }
2071 - }
2072 - },
2073 - "/api/v1/weights": {
2074 - "get": {
2075 - "summary": "Analyze all the metrics using an algorithm and score them accordingly",
2076 - "description": "This endpoint goes through all metrics and scores them according to an algorithm.",
2077 - "parameters": [
2078 - {
2079 - "name": "baseline_after",
2080 - "in": "query",
2081 - "description": "This parameter can either be an absolute timestamp specifying the starting point of baseline window, or a relative number of seconds (negative, relative to parameter baseline_before). Netdata will assume it is a relative number if it is less that 3 years (in seconds). This parameter is used in KS2 and VOLUME algorithms.",
2082 - "required": false,
2083 - "allowEmptyValue": false,
2084 - "schema": {
2085 - "type": "number",
2086 - "format": "integer",
2087 - "default": -300
2088 - }
2367 + "stream_compression": {
2368 + "type": "boolean",
2369 + "description": "Stream transmission compression method.",
2370 + "example": true
2371 },
2090 - {
2091 - "name": "baseline_before",
2092 - "in": "query",
2093 - "description": "This parameter can either be an absolute timestamp specifying the ending point of the baseline window, or a relative number of seconds (negative), relative to the last collected timestamp. Netdata will assume it is a relative number if it is less than 3 years (in seconds). This parameter is used in KS2 and VOLUME algorithms.",
2094 - "required": false,
2095 - "schema": {
2096 - "type": "number",
2097 - "format": "integer",
2098 - "default": -60
2372 + "labels": {
2373 + "type": "object",
2374 + "description": "List of host labels.",
2375 + "properties": {
2376 + "app": {
2377 + "type": "string",
2378 + "description": "Host label.",
2379 + "example": "netdata"
2380 + }
2381 }
2382 },
2101 - {
2102 - "name": "after",
2103 - "in": "query",
2104 - "description": "This parameter can either be an absolute timestamp specifying the starting point of highlighted window, or a relative number of seconds (negative, relative to parameter highlight_before). Netdata will assume it is a relative number if it is less that 3 years (in seconds).",
2105 - "required": false,
2106 - "allowEmptyValue": false,
2107 - "schema": {
2108 - "type": "number",
2109 - "format": "integer",
2110 - "default": -60
2383 + "collectors": {
2384 + "type": "array",
2385 + "items": {
2386 + "type": "object",
2387 + "description": "Array of collector plugins and modules.",
2388 + "properties": {
2389 + "plugin": {
2390 + "type": "string",
2391 + "description": "Collector plugin.",
2392 + "example": "python.d.plugin"
2393 + },
2394 + "module": {
2395 + "type": "string",
2396 + "description": "Module of the collector plugin.",
2397 + "example": "dockerd"
2398 + }
2399 + }
2400 }
2401 },
2113 - {
2114 - "name": "before",
2115 - "in": "query",
2116 - "description": "This parameter can either be an absolute timestamp specifying the ending point of the highlighted window, or a relative number of seconds (negative), relative to the last collected timestamp. Netdata will assume it is a relative number if it is less than 3 years (in seconds).",
2117 - "required": false,
2118 - "schema": {
2119 - "type": "number",
2120 - "format": "integer",
2121 - "default": 0
2402 + "alarms": {
2403 + "type": "object",
2404 + "description": "Number of alarms in the server.",
2405 + "properties": {
2406 + "normal": {
2407 + "type": "integer",
2408 + "description": "Number of alarms in normal state."
2409 + },
2410 + "warning": {
2411 + "type": "integer",
2412 + "description": "Number of alarms in warning state."
2413 + },
2414 + "critical": {
2415 + "type": "integer",
2416 + "description": "Number of alarms in critical state."
2417 + }
2418 }
2419 + }
2420 + }
2421 + },
2422 + "chart_summary": {
2423 + "type": "object",
2424 + "properties": {
2425 + "hostname": {
2426 + "type": "string",
2427 + "description": "The hostname of the netdata server."
2428 },
2124 - {
2125 - "name": "context",
2126 - "in": "query",
2127 - "description": "A simple pattern matching the contexts to evaluate.",
2128 - "required": false,
2129 - "allowEmptyValue": false,
2130 - "schema": {
2131 - "type": "string"
2132 - }
2429 + "version": {
2430 + "type": "string",
2431 + "description": "netdata version of the server."
2432 },
2134 - {
2135 - "name": "points",
2136 - "in": "query",
2137 - "description": "The number of points to be evaluated for the highlighted window. The baseline window will be adjusted automatically to receive a proportional amount of points. This parameter is only used by the KS2 algorithm.",
2138 - "required": false,
2139 - "allowEmptyValue": false,
2140 - "schema": {
2141 - "type": "number",
2142 - "format": "integer",
2143 - "default": 500
2144 - }
2433 + "release_channel": {
2434 + "type": "string",
2435 + "description": "The release channel of the build on the server.",
2436 + "example": "nightly"
2437 },
2146 - {
2147 - "name": "method",
2148 - "in": "query",
2149 - "description": "the algorithm to run",
2150 - "required": false,
2151 - "schema": {
2152 - "type": "string",
2153 - "enum": [
2154 - "ks2",
2155 - "volume",
2156 - "anomaly-rate"
2157 - ],
2158 - "default": "anomaly-rate"
2159 - }
2438 + "timezone": {
2439 + "type": "string",
2440 + "description": "The current timezone on the server."
2441 },
2161 - {
2162 - "name": "tier",
2163 - "in": "query",
2164 - "description": "Use the specified database tier",
2165 - "required": false,
2166 - "allowEmptyValue": false,
2167 - "schema": {
2168 - "type": "number",
2169 - "format": "integer"
2170 - }
2442 + "os": {
2443 + "type": "string",
2444 + "description": "The netdata server host operating system.",
2445 + "enum": [
2446 + "macos",
2447 + "linux",
2448 + "freebsd"
2449 + ]
2450 },
2172 - {
2173 - "name": "timeout",
2174 - "in": "query",
2175 - "description": "Cancel the query if to takes more that this amount of milliseconds.",
2176 - "required": false,
2177 - "allowEmptyValue": false,
2178 - "schema": {
2179 - "type": "number",
2180 - "format": "integer",
2181 - "default": 60000
2182 - }
2451 + "history": {
2452 + "type": "number",
2453 + "description": "The duration, in seconds, of the round robin database maintained by netdata."
2454 },
2184 - {
2185 - "name": "options",
2186 - "in": "query",
2187 - "description": "Options that affect data generation.",
2188 - "required": false,
2189 - "allowEmptyValue": false,
2190 - "schema": {
2191 - "type": "array",
2192 - "items": {
2193 - "type": "string",
2194 - "enum": [
2195 - "min2max",
2196 - "abs",
2197 - "absolute",
2198 - "absolute-sum",
2199 - "null2zero",
2200 - "percentage",
2201 - "unaligned",
2202 - "nonzero",
2203 - "anomaly-bit",
2204 - "raw"
2205 - ]
2206 - },
2207 - "default": [
2208 - "null2zero",
2209 - "nonzero",
2210 - "unaligned"
2211 - ]
2212 - }
2455 + "memory_mode": {
2456 + "type": "string",
2457 + "description": "The name of the database memory mode on the server."
2458 },
2214 - {
2215 - "name": "group",
2216 - "in": "query",
2217 - "description": "The grouping method. If multiple collected values are to be grouped in order to return fewer points, this parameters defines the method of grouping. methods supported \"min\", \"max\", \"average\", \"sum\", \"incremental-sum\". \"max\" is actually calculated on the absolute value collected (so it works for both positive and negative dimensions to return the most extreme value in either direction).",
2218 - "required": true,
2219 - "allowEmptyValue": false,
2220 - "schema": {
2221 - "type": "string",
2222 - "enum": [
2223 - "min",
2224 - "max",
2225 - "average",
2226 - "median",
2227 - "stddev",
2228 - "sum",
2229 - "incremental-sum",
2230 - "ses",
2231 - "des",
2232 - "cv",
2233 - "countif",
2234 - "percentile",
2235 - "percentile25",
2236 - "percentile50",
2237 - "percentile75",
2238 - "percentile80",
2239 - "percentile90",
2240 - "percentile95",
2241 - "percentile97",
2242 - "percentile98",
2243 - "percentile99",
2244 - "trimmed-mean",
2245 - "trimmed-mean1",
2246 - "trimmed-mean2",
2247 - "trimmed-mean3",
2248 - "trimmed-mean5",
2249 - "trimmed-mean10",
2250 - "trimmed-mean15",
2251 - "trimmed-mean20",
2252 - "trimmed-mean25",
2253 - "trimmed-median",
2254 - "trimmed-median1",
2255 - "trimmed-median2",
2256 - "trimmed-median3",
2257 - "trimmed-median5",
2258 - "trimmed-median10",
2259 - "trimmed-median15",
2260 - "trimmed-median20",
2261 - "trimmed-median25"
2262 - ],
2263 - "default": "average"
2264 - }
2459 + "update_every": {
2460 + "type": "number",
2461 + "description": "The default update frequency of the netdata server. All charts have an update frequency equal or bigger than this."
2462 },
2266 - {
2267 - "name": "group_options",
2268 - "in": "query",
2269 - "description": "When the group function supports additional parameters, this field can be used to pass them to it. Currently only \"countif\" supports this.",
2270 - "required": false,
2271 - "allowEmptyValue": false,
2272 - "schema": {
2273 - "type": "string"
2274 - }
2275 - }
2276 - ],
2277 - "responses": {
2278 - "200": {
2279 - "description": "JSON object with weights for each context, chart and dimension.",
2280 - "content": {
2281 - "application/json": {
2282 - "schema": {
2283 - "$ref": "#/components/schemas/weights"
2284 - }
2285 - }
2463 + "charts": {
2464 + "type": "object",
2465 + "description": "An object containing all the chart objects available at the netdata server. This is used as an indexed array. The key of each chart object is the id of the chart.",
2466 + "additionalProperties": {
2467 + "$ref": "#/components/schemas/chart"
2468 }
2469 },
2288 - "400": {
2289 - "description": "The given parameters are invalid."
2470 + "charts_count": {
2471 + "type": "number",
2472 + "description": "The number of charts."
2473 },
2291 - "403": {
2292 - "description": "metrics correlations are not enabled on this Netdata Agent."
2474 + "dimensions_count": {
2475 + "type": "number",
2476 + "description": "The total number of dimensions."
2477 },
2294 - "404": {
2295 - "description": "No charts could be found, or the method that correlated the metrics did not produce any result."
2478 + "alarms_count": {
2479 + "type": "number",
2480 + "description": "The number of alarms."
2481 },
2297 - "504": {
2298 - "description": "Timeout - the query took too long and has been cancelled."
2482 + "rrd_memory_bytes": {
2483 + "type": "number",
2484 + "description": "The size of the round robin database in bytes."
2485 }
2486 }
2301 - }
2302 - }
2303 - },
2304 - "servers": [
2305 - {
2306 - "url": "https://registry.my-netdata.io"
2307 - },
2308 - {
2309 - "url": "http://registry.my-netdata.io"
2310 - },
2311 - {
2312 - "url": "http://localhost:19999"
2313 - }
2314 - ],
2315 - "components": {
2316 - "schemas": {
2317 - "info": {
2487 + },
2488 + "chart": {
2489 "type": "object",
2490 "properties": {
2320 - "version": {
2321 - "type": "string",
2322 - "description": "netdata version of the server.",
2323 - "example": "1.11.1_rolling"
2324 - },
2325 - "uid": {
2491 + "id": {
2492 "type": "string",
2327 - "description": "netdata unique id of the server.",
2328 - "example": "24e9fe3c-f2ac-11e8-bafc-0242ac110002"
2329 - },
2330 - "mirrored_hosts": {
2331 - "type": "array",
2332 - "description": "List of hosts mirrored of the server (include itself).",
2333 - "items": {
2334 - "type": "string"
2335 - },
2336 - "example": [
2337 - "host1.example.com",
2338 - "host2.example.com"
2339 - ]
2340 - },
2341 - "mirrored_hosts_status": {
2342 - "type": "array",
2343 - "description": "List of details of hosts mirrored to this served (including self). Indexes correspond to indexes in \"mirrored_hosts\".",
2344 - "items": {
2345 - "type": "object",
2346 - "description": "Host data",
2347 - "properties": {
2348 - "guid": {
2349 - "type": "string",
2350 - "format": "uuid",
2351 - "nullable": false,
2352 - "description": "Host unique GUID from `netdata.public.unique.id`.",
2353 - "example": "245e4bff-3b34-47c1-a6e5-5c535a9abfb2"
2354 - },
2355 - "reachable": {
2356 - "type": "boolean",
2357 - "nullable": false,
2358 - "description": "Current state of streaming. Always true for localhost/self."
2359 - },
2360 - "claim_id": {
2361 - "type": "string",
2362 - "format": "uuid",
2363 - "nullable": true,
2364 - "description": "Cloud GUID/identifier in case the host is claimed. If child status unknown or unclaimed this field is set to `null`",
2365 - "example": "c3b2a66a-3052-498c-ac52-7fe9e8cccb0c"
2366 - }
2367 - }
2368 - }
2493 + "description": "The unique id of the chart."
2494 },
2370 - "os_name": {
2495 + "name": {
2496 "type": "string",
2372 - "description": "Operating System Name.",
2373 - "example": "Manjaro Linux"
2497 + "description": "The name of the chart."
2498 },
2375 - "os_id": {
2499 + "type": {
2500 "type": "string",
2377 - "description": "Operating System ID.",
2378 - "example": "manjaro"
2501 + "description": "The type of the chart. Types are not handled by netdata. You can use this field for anything you like."
2502 },
2380 - "os_id_like": {
2503 + "family": {
2504 "type": "string",
2382 - "description": "Known OS similar to this OS.",
2383 - "example": "arch"
2505 + "description": "The family of the chart. Families are not handled by netdata. You can use this field for anything you like."
2506 },
2385 - "os_version": {
2507 + "title": {
2508 "type": "string",
2387 - "description": "Operating System Version.",
2388 - "example": "18.0.4"
2509 + "description": "The title of the chart."
2510 },
2390 - "os_version_id": {
2391 - "type": "string",
2392 - "description": "Operating System Version ID.",
2393 - "example": "unknown"
2511 + "priority": {
2512 + "type": "number",
2513 + "description": "The relative priority of the chart. Netdata does not care about priorities. This is just an indication of importance for the chart viewers to sort charts of higher priority (lower number) closer to the top. Priority sorting should only be used among charts of the same type or family."
2514 },
2395 - "os_detection": {
2396 - "type": "string",
2397 - "description": "OS parameters detection method.",
2398 - "example": "Mixed"
2515 + "enabled": {
2516 + "type": "boolean",
2517 + "description": "True when the chart is enabled. Disabled charts do not currently collect values, but they may have historical values available."
2518 },
2400 - "kernel_name": {
2519 + "units": {
2520 "type": "string",
2402 - "description": "Kernel Name.",
2403 - "example": "Linux"
2521 + "description": "The unit of measurement for the values of all dimensions of the chart."
2522 },
2405 - "kernel_version": {
2523 + "data_url": {
2524 "type": "string",
2407 - "description": "Kernel Version.",
2408 - "example": "4.19.32-1-MANJARO"
2409 - },
2410 - "is_k8s_node": {
2411 - "type": "boolean",
2412 - "description": "Netdata is running on a K8s node.",
2413 - "example": false
2525 + "description": "The absolute path to get data values for this chart. You are expected to use this path as the base when constructing the URL to fetch data values for this chart."
2526 },
2415 - "architecture": {
2527 + "chart_type": {
2528 "type": "string",
2417 - "description": "Kernel architecture.",
2418 - "example": "x86_64"
2529 + "description": "The chart type.",
2530 + "enum": [
2531 + "line",
2532 + "area",
2533 + "stacked"
2534 + ]
2535 },
2420 - "virtualization": {
2421 - "type": "string",
2422 - "description": "Virtualization Type.",
2423 - "example": "kvm"
2536 + "duration": {
2537 + "type": "number",
2538 + "description": "The duration, in seconds, of the round robin database maintained by netdata."
2539 },
2425 - "virt_detection": {
2426 - "type": "string",
2427 - "description": "Virtualization detection method.",
2428 - "example": "systemd-detect-virt"
2540 + "first_entry": {
2541 + "type": "number",
2542 + "description": "The UNIX timestamp of the first entry (the oldest) in the round robin database."
2543 },
2430 - "container": {
2431 - "type": "string",
2432 - "description": "Container technology.",
2433 - "example": "docker"
2544 + "last_entry": {
2545 + "type": "number",
2546 + "description": "The UNIX timestamp of the latest entry in the round robin database."
2547 },
2435 - "container_detection": {
2436 - "type": "string",
2437 - "description": "Container technology detection method.",
2438 - "example": "dockerenv"
2439 - },
2440 - "stream_compression": {
2441 - "type": "boolean",
2442 - "description": "Stream transmission compression method.",
2443 - "example": true
2444 - },
2445 - "labels": {
2446 - "type": "object",
2447 - "description": "List of host labels.",
2448 - "properties": {
2449 - "app": {
2450 - "type": "string",
2451 - "description": "Host label.",
2452 - "example": "netdata"
2453 - }
2454 - }
2455 - },
2456 - "collectors": {
2457 - "type": "array",
2458 - "items": {
2459 - "type": "object",
2460 - "description": "Array of collector plugins and modules.",
2461 - "properties": {
2462 - "plugin": {
2463 - "type": "string",
2464 - "description": "Collector plugin.",
2465 - "example": "python.d.plugin"
2466 - },
2467 - "module": {
2468 - "type": "string",
2469 - "description": "Module of the collector plugin.",
2470 - "example": "dockerd"
2471 - }
2472 - }
2473 - }
2474 - },
2475 - "alarms": {
2476 - "type": "object",
2477 - "description": "Number of alarms in the server.",
2478 - "properties": {
2479 - "normal": {
2480 - "type": "integer",
2481 - "description": "Number of alarms in normal state."
2482 - },
2483 - "warning": {
2484 - "type": "integer",
2485 - "description": "Number of alarms in warning state."
2486 - },
2487 - "critical": {
2488 - "type": "integer",
2489 - "description": "Number of alarms in critical state."
2490 - }
2491 - }
2492 - }
2493 - }
2494 - },
2495 - "chart_summary": {
2496 - "type": "object",
2497 - "properties": {
2498 - "hostname": {
2499 - "type": "string",
2500 - "description": "The hostname of the netdata server."
2501 - },
2502 - "version": {
2503 - "type": "string",
2504 - "description": "netdata version of the server."
2505 - },
2506 - "release_channel": {
2507 - "type": "string",
2508 - "description": "The release channel of the build on the server.",
2509 - "example": "nightly"
2510 - },
2511 - "timezone": {
2512 - "type": "string",
2513 - "description": "The current timezone on the server."
2514 - },
2515 - "os": {
2516 - "type": "string",
2517 - "description": "The netdata server host operating system.",
2518 - "enum": [
2519 - "macos",
2520 - "linux",
2521 - "freebsd"
2522 - ]
2523 - },
2524 - "history": {
2525 - "type": "number",
2526 - "description": "The duration, in seconds, of the round robin database maintained by netdata."
2527 - },
2528 - "memory_mode": {
2529 - "type": "string",
2530 - "description": "The name of the database memory mode on the server."
2531 - },
2532 - "update_every": {
2533 - "type": "number",
2534 - "description": "The default update frequency of the netdata server. All charts have an update frequency equal or bigger than this."
2535 - },
2536 - "charts": {
2537 - "type": "object",
2538 - "description": "An object containing all the chart objects available at the netdata server. This is used as an indexed array. The key of each chart object is the id of the chart.",
2539 - "additionalProperties": {
2540 - "$ref": "#/components/schemas/chart"
2541 - }
2542 - },
2543 - "charts_count": {
2544 - "type": "number",
2545 - "description": "The number of charts."
2546 - },
2547 - "dimensions_count": {
2548 - "type": "number",
2549 - "description": "The total number of dimensions."
2550 - },
2551 - "alarms_count": {
2552 - "type": "number",
2553 - "description": "The number of alarms."
2554 - },
2555 - "rrd_memory_bytes": {
2556 - "type": "number",
2557 - "description": "The size of the round robin database in bytes."
2558 - }
2559 - }
2560 - },
2561 - "chart": {
2562 - "type": "object",
2563 - "properties": {
2564 - "id": {
2565 - "type": "string",
2566 - "description": "The unique id of the chart."
2567 - },
2568 - "name": {
2569 - "type": "string",
2570 - "description": "The name of the chart."
2571 - },
2572 - "type": {
2573 - "type": "string",
2574 - "description": "The type of the chart. Types are not handled by netdata. You can use this field for anything you like."
2575 - },
2576 - "family": {
2577 - "type": "string",
2578 - "description": "The family of the chart. Families are not handled by netdata. You can use this field for anything you like."
2579 - },
2580 - "title": {
2581 - "type": "string",
2582 - "description": "The title of the chart."
2583 - },
2584 - "priority": {
2585 - "type": "number",
2586 - "description": "The relative priority of the chart. Netdata does not care about priorities. This is just an indication of importance for the chart viewers to sort charts of higher priority (lower number) closer to the top. Priority sorting should only be used among charts of the same type or family."
2587 - },
2588 - "enabled": {
2589 - "type": "boolean",
2590 - "description": "True when the chart is enabled. Disabled charts do not currently collect values, but they may have historical values available."
2591 - },
2592 - "units": {
2593 - "type": "string",
2594 - "description": "The unit of measurement for the values of all dimensions of the chart."
2595 - },
2596 - "data_url": {
2597 - "type": "string",
2598 - "description": "The absolute path to get data values for this chart. You are expected to use this path as the base when constructing the URL to fetch data values for this chart."
2599 - },
2600 - "chart_type": {
2601 - "type": "string",
2602 - "description": "The chart type.",
2603 - "enum": [
2604 - "line",
2605 - "area",
2606 - "stacked"
2607 - ]
2608 - },
2609 - "duration": {
2610 - "type": "number",
2611 - "description": "The duration, in seconds, of the round robin database maintained by netdata."
2612 - },
2613 - "first_entry": {
2614 - "type": "number",
2615 - "description": "The UNIX timestamp of the first entry (the oldest) in the round robin database."
2616 - },
2617 - "last_entry": {
2618 - "type": "number",
2619 - "description": "The UNIX timestamp of the latest entry in the round robin database."
2620 - },
2621 - "update_every": {
2622 - "type": "number",
2623 - "description": "The update frequency of this chart, in seconds. One value every this amount of time is kept in the round robin database."
2548 + "update_every": {
2549 + "type": "number",
2550 + "description": "The update frequency of this chart, in seconds. One value every this amount of time is kept in the round robin database."
2551 },
2552 "dimensions": {
2553 "type": "object",
2627 - "description": "An object containing all the chart dimensions available for the chart. This is used as an indexed array. For each pair in the dictionary: the key is the id of the dimension and the value is a dictionary containing the name.",
2554 + "description": "An object containing all the chart dimensions available for the chart. This is used as an indexed array. For each pair in the dictionary: the key is the id of the dimension and the value is a dictionary containing the name.\"\n",
2555 "additionalProperties": {
2556 "type": "object",
2557 "properties": {
@@ -2806,122 +2733,18 @@
2733 }
2734 }
2735 },
2809 - "data": {
2736 + "jsonwrap2": {
2737 + "description": "Data response with `format=json2`\n",
2738 "type": "object",
2811 - "discriminator": {
2812 - "propertyName": "format"
2813 - },
2814 - "description": "Response will contain the appropriate subtype, e.g. data_json depending on the requested format.",
2739 "properties": {
2740 "api": {
2817 - "type": "number",
2818 - "description": "The API version this conforms to, currently 1."
2819 - },
2820 - "id": {
2821 - "type": "string",
2822 - "description": "The unique id of the chart."
2823 - },
2824 - "name": {
2825 - "type": "string",
2826 - "description": "The name of the chart."
2827 - },
2828 - "update_every": {
2829 - "type": "number",
2830 - "description": "The update frequency of this chart, in seconds. One value every this amount of time is kept in the round robin database (independently of the current view)."
2831 - },
2832 - "view_update_every": {
2833 - "type": "number",
2834 - "description": "The current view appropriate update frequency of this chart, in seconds. There is no point to request chart refreshes, using the same settings, more frequently than this."
2835 - },
2836 - "first_entry": {
2837 - "type": "number",
2838 - "description": "The UNIX timestamp of the first entry (the oldest) in the round robin database (independently of the current view)."
2839 - },
2840 - "last_entry": {
2841 - "type": "number",
2842 - "description": "The UNIX timestamp of the latest entry in the round robin database (independently of the current view)."
2843 - },
2844 - "after": {
2845 - "type": "number",
2846 - "description": "The UNIX timestamp of the first entry (the oldest) returned in this response."
2847 - },
2848 - "before": {
2849 - "type": "number",
2850 - "description": "The UNIX timestamp of the latest entry returned in this response."
2851 - },
2852 - "min": {
2853 - "type": "number",
2854 - "description": "The minimum value returned in the current view. This can be used to size the y-series of the chart."
2855 - },
2856 - "max": {
2857 - "type": "number",
2858 - "description": "The maximum value returned in the current view. This can be used to size the y-series of the chart."
2859 - },
2860 - "dimension_names": {
2861 - "description": "The dimension names of the chart as returned in the current view.",
2862 - "type": "array",
2863 - "items": {
2864 - "type": "string"
2865 - }
2741 + "$ref": "#/components/schemas/api"
2742 },
2867 - "dimension_ids": {
2868 - "description": "The dimension IDs of the chart as returned in the current view.",
2869 - "type": "array",
2870 - "items": {
2871 - "type": "string"
2872 - }
2743 + "agents": {
2744 + "$ref": "#/components/schemas/agents"
2745 },
2874 - "latest_values": {
2875 - "description": "The latest values collected for the chart (independently of the current view).",
2876 - "type": "array",
2877 - "items": {
2878 - "type": "string"
2879 - }
2880 - },
2881 - "view_latest_values": {
2882 - "description": "The latest values returned with this response.",
2883 - "type": "array",
2884 - "items": {
2885 - "type": "string"
2886 - }
2887 - },
2888 - "dimensions": {
2889 - "type": "number",
2890 - "description": "The number of dimensions returned."
2891 - },
2892 - "points": {
2893 - "type": "number",
2894 - "description": "The number of rows / points returned."
2895 - },
2896 - "format": {
2897 - "type": "string",
2898 - "description": "The format of the result returned."
2899 - },
2900 - "chart_variables": {
2901 - "type": "object",
2902 - "additionalProperties": {
2903 - "$ref": "#/components/schemas/chart_variables"
2904 - }
2905 - }
2906 - }
2907 - },
2908 - "data_json2": {
2909 - "description": "Data response with `format=json2`\n",
2910 - "type": "object",
2911 - "properties": {
2912 - "versions": {
2913 - "description": "Hashes that allow the caller to detect important database changes of Netdata agents.\n",
2914 - "type": "object",
2915 - "properties": {
2916 - "contexts_hard_hash": {
2917 - "description": "An auto-increment value that reflects the number of changes to the number of contexts maintained by the server. Everytime a context is added or removed, this number gets incremented.\n",
2918 - "type": "integer"
2919 - },
2920 - "contexts_soft_hash": {
2921 - "description": "An auto-increment value that reflects the number of changes to the queue that sends contexts updates to Netdata Cloud. Everytime the contents of a context are updated, this number gets incremented.\n",
2922 - "type": "integer"
2923 - }
2924 - }
2746 + "versions": {
2747 + "$ref": "#/components/schemas/versions"
2748 },
2749 "summary": {
2750 "description": "Summarized information about nodes, contexts, instances, labels, alerts, and dimensions. The items returned are determined by the scope of the query only, however the statistical data in them are influenced by the filters of the query. Using this information the dashboard allows users to slice and dice the data by filtering and grouping.\n",
@@ -2930,47 +2753,7 @@
2753 "nodes": {
2754 "type": "array",
2755 "items": {
2933 - "type": "object",
2934 - "description": "An object describing a node. `is` stands for instances, `ds` for dimensions, `al` for alerts, `sts` for statistics.\n",
2935 - "properties": {
2936 - "ni": {
2937 - "description": "the node index id, a number that uniquely identifies this node for this query.",
2938 - "type": "integer"
2939 - },
2940 - "mg": {
2941 - "description": "the machine guid of the node.",
2942 - "type": "string",
2943 - "format": "UUID"
2944 - },
2945 - "nd": {
2946 - "description": "the node id of the node.",
2947 - "type": "string",
2948 - "format": "UUID"
2949 - },
2950 - "nm": {
2951 - "description": "the name (hostname) of the node.",
2952 - "type": "string"
2953 - },
2954 - "is": {
2955 - "$ref": "#/components/schemas/data_json2_items_count"
2956 - },
2957 - "ds": {
2958 - "$ref": "#/components/schemas/data_json2_items_count"
2959 - },
2960 - "al": {
2961 - "$ref": "#/components/schemas/data_json2_alerts_count"
2962 - },
2963 - "sts": {
2964 - "oneOf": [
2965 - {
2966 - "$ref": "#/components/schemas/data_json2_sts"
2967 - },
2968 - {
2969 - "$ref": "#/components/schemas/data_json2_sts_raw"
2970 - }
2971 - ]
2972 - }
2973 - }
2756 + "$ref": "#/components/schemas/nodeWithDataStatistics"
2757 }
2758 },
2759 "contexts": {
@@ -2984,21 +2767,21 @@
2767 "type": "string"
2768 },
2769 "is": {
2987 - "$ref": "#/components/schemas/data_json2_items_count"
2770 + "$ref": "#/components/schemas/jsonwrap2_items_count"
2771 },
2772 "ds": {
2990 - "$ref": "#/components/schemas/data_json2_items_count"
2773 + "$ref": "#/components/schemas/jsonwrap2_items_count"
2774 },
2775 "al": {
2993 - "$ref": "#/components/schemas/data_json2_alerts_count"
2776 + "$ref": "#/components/schemas/jsonwrap2_alerts_count"
2777 },
2778 "sts": {
2779 "oneOf": [
2780 {
2998 - "$ref": "#/components/schemas/data_json2_sts"
2781 + "$ref": "#/components/schemas/jsonwrap2_sts"
2782 },
2783 {
3001 - "$ref": "#/components/schemas/data_json2_sts_raw"
2784 + "$ref": "#/components/schemas/jsonwrap2_sts_raw"
2785 }
2786 ]
2787 }
@@ -3023,18 +2806,18 @@
2806 "description": "the node index id this instance belongs to. The UI uses this to compone the fully qualified name of the instance, using the node hostname to present it to users and its machine guid to add it to filters."
2807 },
2808 "ds": {
3026 - "$ref": "#/components/schemas/data_json2_items_count"
2809 + "$ref": "#/components/schemas/jsonwrap2_items_count"
2810 },
2811 "al": {
3029 - "$ref": "#/components/schemas/data_json2_alerts_count"
2812 + "$ref": "#/components/schemas/jsonwrap2_alerts_count"
2813 },
2814 "sts": {
2815 "oneOf": [
2816 {
3034 - "$ref": "#/components/schemas/data_json2_sts"
2817 + "$ref": "#/components/schemas/jsonwrap2_sts"
2818 },
2819 {
3037 - "$ref": "#/components/schemas/data_json2_sts_raw"
2820 + "$ref": "#/components/schemas/jsonwrap2_sts_raw"
2821 }
2822 ]
2823 }
@@ -3056,15 +2839,15 @@
2839 "type": "string"
2840 },
2841 "ds": {
3059 - "$ref": "#/components/schemas/data_json2_items_count"
2842 + "$ref": "#/components/schemas/jsonwrap2_items_count"
2843 },
2844 "sts": {
2845 "oneOf": [
2846 {
3064 - "$ref": "#/components/schemas/data_json2_sts"
2847 + "$ref": "#/components/schemas/jsonwrap2_sts"
2848 },
2849 {
3067 - "$ref": "#/components/schemas/data_json2_sts_raw"
2850 + "$ref": "#/components/schemas/jsonwrap2_sts_raw"
2851 }
2852 ]
2853 }
@@ -3082,15 +2865,15 @@
2865 "type": "string"
2866 },
2867 "ds": {
3085 - "$ref": "#/components/schemas/data_json2_items_count"
2868 + "$ref": "#/components/schemas/jsonwrap2_items_count"
2869 },
2870 "sts": {
2871 "oneOf": [
2872 {
3090 - "$ref": "#/components/schemas/data_json2_sts"
2873 + "$ref": "#/components/schemas/jsonwrap2_sts"
2874 },
2875 {
3093 - "$ref": "#/components/schemas/data_json2_sts_raw"
2876 + "$ref": "#/components/schemas/jsonwrap2_sts_raw"
2877 }
2878 ]
2879 },
@@ -3105,15 +2888,15 @@
2888 "type": "string"
2889 },
2890 "ds": {
3108 - "$ref": "#/components/schemas/data_json2_items_count"
2891 + "$ref": "#/components/schemas/jsonwrap2_items_count"
2892 },
2893 "sts": {
2894 "oneOf": [
2895 {
3113 - "$ref": "#/components/schemas/data_json2_sts"
2896 + "$ref": "#/components/schemas/jsonwrap2_sts"
2897 },
2898 {
3116 - "$ref": "#/components/schemas/data_json2_sts_raw"
2899 + "$ref": "#/components/schemas/jsonwrap2_sts_raw"
2900 }
2901 ]
2902 }
@@ -3127,7 +2910,7 @@
2910 "description": "An array of all the unique alerts running, grouped by alert name (`nm` is available here)\n",
2911 "type": "array",
2912 "items": {
3130 - "$ref": "#/components/schemas/data_json2_alerts_count"
2913 + "$ref": "#/components/schemas/jsonwrap2_alerts_count"
2914 }
2915 }
2916 }
@@ -3136,22 +2919,22 @@
2919 "type": "object",
2920 "properties": {
2921 "nodes": {
3139 - "$ref": "#/components/schemas/data_json2_items_count"
2922 + "$ref": "#/components/schemas/jsonwrap2_items_count"
2923 },
2924 "contexts": {
3142 - "$ref": "#/components/schemas/data_json2_items_count"
2925 + "$ref": "#/components/schemas/jsonwrap2_items_count"
2926 },
2927 "instances": {
3145 - "$ref": "#/components/schemas/data_json2_items_count"
2928 + "$ref": "#/components/schemas/jsonwrap2_items_count"
2929 },
2930 "dimensions": {
3148 - "$ref": "#/components/schemas/data_json2_items_count"
2931 + "$ref": "#/components/schemas/jsonwrap2_items_count"
2932 },
2933 "label_keys": {
3151 - "$ref": "#/components/schemas/data_json2_items_count"
2934 + "$ref": "#/components/schemas/jsonwrap2_items_count"
2935 },
2936 "label_key_values": {
3154 - "$ref": "#/components/schemas/data_json2_items_count"
2937 + "$ref": "#/components/schemas/jsonwrap2_items_count"
2938 }
2939 }
2940 },
@@ -3222,458 +3005,828 @@
3005 "type": "string"
3006 },
3007 "format": {
3225 - "description": "The format the `result` top level member has.\n",
3008 + "description": "The format the `result` top level member has. Available on when `debug` flag is set.\n",
3009 "type": "string"
3010 },
3011 "options": {
3229 - "description": "An array presenting all the options given to the query.\n",
3012 + "description": "An array presenting all the options given to the query. Available on when `debug` flag is set.\n",
3013 "type": "array",
3014 "items": {
3015 "type": "string"
3016 }
3017 },
3018 "time_group": {
3236 - "description": "The same as the parameter `time_group`.\n",
3019 + "description": "The same as the parameter `time_group`. Available on when `debug` flag is set.\n",
3020 "type": "string"
3021 },
3022 "after": {
3023 "description": "The oldest unix epoch timestamp of the data returned in the `result`.\n",
3024 "type": "integer"
3025 },
3243 - "before": {
3244 - "description": "The newest unix epoch timestamp of the data returned in the `result`.\n",
3026 + "before": {
3027 + "description": "The newest unix epoch timestamp of the data returned in the `result`.\n",
3028 + "type": "integer"
3029 + },
3030 + "partial_data_trimming": {
3031 + "description": "Information related to trimming of the last few points of the `result`, that was required to remove (increasing) partial data.\nTrimming is disabled when the `raw` option is given to the query.\nThis object is available only when the `debug` flag is set.\n",
3032 + "type": "object",
3033 + "properties": {
3034 + "max_update_every": {
3035 + "description": "The maximum `update_every` for all metrics aggregated into the query.\nTrimming is by default enabled at `view.before - max_update_every`, but only when `view.before >= now - max_update_every`.\n",
3036 + "type": "integer"
3037 + },
3038 + "expected_after": {
3039 + "description": "The timestamp at which trimming can be enabled.\nIf this timestamp is greater or equal to `view.before`, there is no trimming.\n",
3040 + "type": "integer"
3041 + },
3042 + "trimmed_after": {
3043 + "description": "The timestamp at which trimming has been applied.\nIf this timestamp is greater or equal to `view.before`, there is no trimming.\n"
3044 + }
3045 + }
3046 + },
3047 + "points": {
3048 + "description": "The number of points in `result`. Available only when `raw` is given.\n",
3049 + "type": "integer"
3050 + },
3051 + "units": {
3052 + "description": "The units of the query.\n",
3053 + "oneOf": [
3054 + {
3055 + "type": "string"
3056 + },
3057 + {
3058 + "type": "array",
3059 + "items": {
3060 + "type": "string"
3061 + }
3062 + }
3063 + ]
3064 + },
3065 + "chart_type": {
3066 + "description": "The default chart type of the query.\n",
3067 + "type": "string",
3068 + "enum": [
3069 + "line",
3070 + "area",
3071 + "stacked"
3072 + ]
3073 + },
3074 + "dimensions": {
3075 + "description": "Detailed information about the chart dimensions included in the `result`.\n",
3076 + "type": "object",
3077 + "properties": {
3078 + "grouped_by": {
3079 + "description": "An array with the order of the groupings performed.\n",
3080 + "type": "array",
3081 + "items": {
3082 + "type": "string",
3083 + "enum": [
3084 + "selected",
3085 + "dimension",
3086 + "instance",
3087 + "node",
3088 + "context",
3089 + "units",
3090 + "label:key1",
3091 + "label:key2",
3092 + "label:keyN"
3093 + ]
3094 + }
3095 + },
3096 + "ids": {
3097 + "description": "An array with the dimension ids that uniquely identify the dimensions for this query.\n",
3098 + "type": "array",
3099 + "items": {
3100 + "type": "string"
3101 + }
3102 + },
3103 + "names": {
3104 + "description": "An array with the dimension names to be presented to users. Names may be overlapping, but IDs are not.\n",
3105 + "type": "array",
3106 + "items": {
3107 + "type": "string"
3108 + }
3109 + },
3110 + "units": {
3111 + "description": "An array with the units each dimension has.\n",
3112 + "type": "array",
3113 + "items": {
3114 + "type": "string"
3115 + }
3116 + },
3117 + "priorities": {
3118 + "description": "An array with the relative priorities of the dimensions.\nNumbers may not be sequential or unique. The application is expected to order by this and then by name.\n",
3119 + "type": "array",
3120 + "items": {
3121 + "type": "integer"
3122 + }
3123 + },
3124 + "aggregated": {
3125 + "description": "An array with the number of source metrics aggregated into each dimension.\n",
3126 + "type": "array",
3127 + "items": {
3128 + "type": "integer"
3129 + }
3130 + },
3131 + "min": {
3132 + "description": "An array of the minimum value of each dimension across the entire query.\n",
3133 + "type": "array",
3134 + "items": {
3135 + "type": "number"
3136 + }
3137 + },
3138 + "max": {
3139 + "description": "An array of the maximum value of each dimension across the entire query.\n",
3140 + "type": "array",
3141 + "items": {
3142 + "type": "number"
3143 + }
3144 + },
3145 + "avg": {
3146 + "description": "An array of the average value of each dimension across the entire query.\n",
3147 + "type": "array",
3148 + "items": {
3149 + "type": "number"
3150 + }
3151 + },
3152 + "sts": {
3153 + "description": "Statistics about the data collection points used for each dimension.\n",
3154 + "type": "object",
3155 + "properties": {
3156 + "min": {
3157 + "description": "An array with the minimum data collection value aggregated to each dimension.\n",
3158 + "type": "array",
3159 + "items": {
3160 + "type": "number"
3161 + }
3162 + },
3163 + "max": {
3164 + "description": "An array with the maximum data collection value aggregated to each dimension.\n",
3165 + "type": "array",
3166 + "items": {
3167 + "type": "number"
3168 + }
3169 + },
3170 + "sum": {
3171 + "description": "An array with the sum of all data collection values aggregated to each dimension.\nThis member exists only when option `raw` is given.\n",
3172 + "type": "array",
3173 + "items": {
3174 + "type": "number"
3175 + }
3176 + },
3177 + "cnt": {
3178 + "description": "An array with the count of the data collection values aggregated to each dimension.\nThis member exists only when option `raw` is given.\n",
3179 + "type": "array",
3180 + "items": {
3181 + "type": "number"
3182 + }
3183 + },
3184 + "ars": {
3185 + "description": "An array with the anomaly rate sum of all data collection values aggregated to each dimension.\nThis member exists only when option `raw` is given.\n",
3186 + "type": "array",
3187 + "items": {
3188 + "type": "number"
3189 + }
3190 + },
3191 + "avg": {
3192 + "description": "An array with the average of all data collection values aggregated to each dimension.\nThis member exists only when option `raw` is not given. When option `raw` is given, the average can be calculated by dividing `sum` with `cnt`.\n",
3193 + "type": "array",
3194 + "items": {
3195 + "type": "number"
3196 + }
3197 + },
3198 + "arp": {
3199 + "description": "An array with the average anomaly rate of all data collection values aggregated to each dimension.\nThis member exists only when option `raw` is not given. When option `raw` is given, the average can be calculated by dividing `ars` with `cnt`.\n",
3200 + "type": "array",
3201 + "items": {
3202 + "type": "number"
3203 + }
3204 + },
3205 + "con": {
3206 + "description": "An array with the contribution % of all data collection values aggregated to each dimension.\nThis member exists only when option `raw` is not given. When option `raw` is given, the contribution can be calculated by multiplying `ABS(sum)` with 100.0 and dividing it with the total of the ABS(sum) of all dimensions.\n",
3207 + "type": "array",
3208 + "items": {
3209 + "type": "number"
3210 + }
3211 + }
3212 + }
3213 + },
3214 + "labels": {
3215 + "description": "The labels associated with each dimension in the query.\nThis object is only available when the `group-by-labels` option is given to the query.\n",
3216 + "type": "object",
3217 + "properties": {
3218 + "label_key1": {
3219 + "description": "An array having one entry for each of the dimensions of the query.\n",
3220 + "type": "array",
3221 + "items": {
3222 + "description": "An array having one entry for each of the values this label key has for the given dimension.\n",
3223 + "type": "array",
3224 + "items": {
3225 + "type": "string"
3226 + }
3227 + }
3228 + }
3229 + }
3230 + }
3231 + }
3232 + },
3233 + "min": {
3234 + "description": "The minimum value of all points included in the `result`.\n",
3235 + "type": "number"
3236 + },
3237 + "max": {
3238 + "description": "The maximum value of all points included in the `result`.\n",
3239 + "type": "number"
3240 + }
3241 + }
3242 + },
3243 + "result": {
3244 + "$ref": "#/components/schemas/data_json_formats2"
3245 + },
3246 + "timings": {
3247 + "type": "object"
3248 + }
3249 + }
3250 + },
3251 + "jsonwrap2_sts": {
3252 + "description": "Statistical values\n",
3253 + "type": "object",
3254 + "properties": {
3255 + "min": {
3256 + "description": "The minimum value of all metrics aggregated",
3257 + "type": "number"
3258 + },
3259 + "max": {
3260 + "description": "The maximum value of all metrics aggregated",
3261 + "type": "number"
3262 + },
3263 + "avg": {
3264 + "description": "The average value of all metrics aggregated",
3265 + "type": "number"
3266 + },
3267 + "arp": {
3268 + "description": "The average anomaly rate of all metrics aggregated",
3269 + "type": "number"
3270 + },
3271 + "con": {
3272 + "description": "The contribution percentage of all the metrics aggregated",
3273 + "type": "number"
3274 + }
3275 + }
3276 + },
3277 + "jsonwrap2_sts_raw": {
3278 + "description": "Statistical values when `raw` option is given.\n",
3279 + "type": "object",
3280 + "properties": {
3281 + "min": {
3282 + "description": "The minimum value of all metrics aggregated",
3283 + "type": "number"
3284 + },
3285 + "max": {
3286 + "description": "The maximum value of all metrics aggregated",
3287 + "type": "number"
3288 + },
3289 + "sum": {
3290 + "description": "The sum value of all metrics aggregated",
3291 + "type": "number"
3292 + },
3293 + "ars": {
3294 + "description": "The sum anomaly rate of all metrics aggregated",
3295 + "type": "number"
3296 + },
3297 + "vol": {
3298 + "description": "The volume of all the metrics aggregated",
3299 + "type": "number"
3300 + },
3301 + "cnt": {
3302 + "description": "The count of all metrics aggregated",
3303 + "type": "integer"
3304 + }
3305 + }
3306 + },
3307 + "jsonwrap2_items_count": {
3308 + "description": "Depending on the placement of this object, `items` may be `nodes`, `contexts`, `instances`, `dimensions`, `label keys`, `label key-value pairs`. Furthermore, if the whole object is missing it should be assumed that all its members are zero.\n",
3309 + "type": "object",
3310 + "properties": {
3311 + "sl": {
3312 + "description": "The number of items `selected` to query. If absent it is zero.",
3313 + "type": "integer"
3314 + },
3315 + "ex": {
3316 + "description": "The number of items `excluded` from querying. If absent it is zero.",
3317 + "type": "integer"
3318 + },
3319 + "qr": {
3320 + "description": "The number of items (out of `selected`) the query successfully `queried`. If absent it is zero.",
3321 + "type": "integer"
3322 + },
3323 + "fl": {
3324 + "description": "The number of items (from `selected`) that `failed` to be queried. If absent it is zero.",
3325 + "type": "integer"
3326 + }
3327 + }
3328 + },
3329 + "jsonwrap2_alerts_count": {
3330 + "description": "Counters about alert statuses. If this object is missing, it is assumed that all its members are zero.\n",
3331 + "type": "object",
3332 + "properties": {
3333 + "nm": {
3334 + "description": "The name of the alert. Can be absent when the counters refer to more than one alert instances.",
3335 + "type": "string"
3336 + },
3337 + "cl": {
3338 + "description": "The number of CLEAR alerts. If absent, it is zero.",
3339 + "type": "integer"
3340 + },
3341 + "wr": {
3342 + "description": "The number of WARNING alerts. If absent, it is zero.",
3343 + "type": "integer"
3344 + },
3345 + "cr": {
3346 + "description": "The number of CRITICAL alerts. If absent, it is zero.",
3347 + "type": "integer"
3348 + },
3349 + "ot": {
3350 + "description": "The number of alerts that are not CLEAR, WARNING, CRITICAL (so, they are \"other\"). If absent, it is zero.\n",
3351 + "type": "integer"
3352 + }
3353 + }
3354 + },
3355 + "api": {
3356 + "description": "The version of the API used.",
3357 + "type": "integer"
3358 + },
3359 + "agents": {
3360 + "description": "An array of agent definitions consulted to compose this response.\n",
3361 + "type": "array",
3362 + "items": {
3363 + "type": "object",
3364 + "properties": {
3365 + "mg": {
3366 + "description": "The agent machine GUID.",
3367 + "type": "string",
3368 + "format": "uuid"
3369 + },
3370 + "nd": {
3371 + "description": "The agent cloud node ID.",
3372 + "type": "string",
3373 + "format": "uuid"
3374 + },
3375 + "nm": {
3376 + "description": "The agent hostname.",
3377 + "type": "string"
3378 + },
3379 + "ai": {
3380 + "description": "The agent index ID for this agent, in this response.",
3381 + "type": "integer"
3382 + },
3383 + "now": {
3384 + "description": "The current unix epoch timestamp of this agent.",
3385 + "type": "integer"
3386 + }
3387 + }
3388 + }
3389 + },
3390 + "versions": {
3391 + "description": "Hashes that allow the caller to detect important database changes of Netdata agents.\n",
3392 + "type": "object",
3393 + "properties": {
3394 + "nodes_hard_hash": {
3395 + "description": "An auto-increment value that reflects the number of changes to the number of nodes maintained by the server. Everytime a node is added or removed, this number gets incremented.\n",
3396 + "type": "integer"
3397 + },
3398 + "contexts_hard_hash": {
3399 + "description": "An auto-increment value that reflects the number of changes to the number of contexts maintained by the server. Everytime a context is added or removed, this number gets incremented.\n",
3400 + "type": "integer"
3401 + },
3402 + "contexts_soft_hash": {
3403 + "description": "An auto-increment value that reflects the number of changes to the queue that sends contexts updates to Netdata Cloud. Everytime the contents of a context are updated, this number gets incremented.\n",
3404 + "type": "integer"
3405 + },
3406 + "alerts_hard_hash": {
3407 + "description": "An auto-increment value that reflects the number of changes to the number of alerts. Everytime an alert is added or removed, this number gets incremented.\n",
3408 + "type": "integer"
3409 + },
3410 + "alerts_soft_hash": {
3411 + "description": "An auto-increment value that reflects the number of alerts transitions. Everytime an alert transitions to a new state, this number gets incremented.\n",
3412 + "type": "integer"
3413 + }
3414 + }
3415 + },
3416 + "nodeBasic": {
3417 + "type": "object",
3418 + "description": "Basic information about a node.",
3419 + "required": [
3420 + "ni",
3421 + "st"
3422 + ],
3423 + "properties": {
3424 + "mg": {
3425 + "description": "The machine guid of the node. May not be available if the request is served by the Netdata Cloud.",
3426 + "type": "string",
3427 + "format": "UUID"
3428 + },
3429 + "nd": {
3430 + "description": "The node id of the node. May not be available if the node is not registered to Netdata Cloud.",
3431 + "type": "string",
3432 + "format": "UUID"
3433 + },
3434 + "nm": {
3435 + "description": "The name (hostname) of the node.",
3436 + "type": "string"
3437 + },
3438 + "ni": {
3439 + "description": "The node index id, a number that uniquely identifies this node for this query.",
3440 + "type": "integer"
3441 + },
3442 + "st": {
3443 + "description": "Status information about the communication with this node.",
3444 + "type": "object",
3445 + "properties": {
3446 + "ai": {
3447 + "description": "The agent index id that has been contacted for this node.",
3448 + "type": "integer"
3449 + },
3450 + "code": {
3451 + "description": "The HTTP response code of the response for this node. When working directly with an agent, this is always 200. If the `code` is missing, it should be assumed to be 200.",
3452 "type": "integer"
3453 },
3247 - "partial_data_trimming": {
3248 - "description": "Information related to trimming of the last few points of the `result`, that was required to remove (increasing) partial data.\nTrimming is disabled when the `raw` option is given to the query.\n",
3249 - "type": "object",
3250 - "properties": {
3251 - "max_update_every": {
3252 - "description": "The maximum `update_every` for all metrics aggregated into the query.\nTrimming is by default enabled at `view.before - max_update_every`, but only when `view.before >= now - max_update_every`.\n",
3253 - "type": "integer"
3254 - },
3255 - "expected_after": {
3256 - "description": "The timestamp at which trimming can be enabled.\nIf this timestamp is greater or equal to `view.before`, there is no trimming.\n",
3257 - "type": "integer"
3258 - },
3259 - "trimmed_after": {
3260 - "description": "The timestamp at which trimming has been applied.\nIf this timestamp is greater or equal to `view.before`, there is no trimming.\n",
3261 - "type": "integer"
3262 - }
3263 - }
3454 + "msg": {
3455 + "description": "A human readable description of the error, if any. If `msg` is missing, or is the empty string `\"\"` or is `null`, there is no description associated with the current status.",
3456 + "type": "string"
3457 },
3265 - "points": {
3266 - "description": "The number of points in `result`.\n",
3267 - "type": "integer"
3458 + "ms": {
3459 + "description": "The time in milliseconds this node took to respond, or if the local agent responded for this node, the time it needed to execute the query. If `ms` is missing, the time that was required to query this node is unknown.",
3460 + "type": "number"
3461 + }
3462 + }
3463 + }
3464 + }
3465 + },
3466 + "nodeWithDataStatistics": {
3467 + "allOf": [
3468 + {
3469 + "$ref": "#/components/schemas/nodeBasic"
3470 + },
3471 + {
3472 + "type": "object",
3473 + "description": "`is` stands for instances, `ds` for dimensions, `al` for alerts, `sts` for statistics.\n",
3474 + "properties": {
3475 + "is": {
3476 + "$ref": "#/components/schemas/jsonwrap2_items_count"
3477 },
3269 - "units": {
3270 - "description": "The units of the query.\n",
3478 + "ds": {
3479 + "$ref": "#/components/schemas/jsonwrap2_items_count"
3480 + },
3481 + "al": {
3482 + "$ref": "#/components/schemas/jsonwrap2_alerts_count"
3483 + },
3484 + "sts": {
3485 "oneOf": [
3486 {
3273 - "type": "string"
3487 + "$ref": "#/components/schemas/jsonwrap2_sts"
3488 },
3489 {
3276 - "type": "array",
3277 - "items": {
3278 - "type": "string"
3279 - }
3490 + "$ref": "#/components/schemas/jsonwrap2_sts_raw"
3491 }
3492 ]
3282 - },
3283 - "chart_type": {
3284 - "description": "The default chart type of the query.\n",
3285 - "type": "string",
3286 - "enum": [
3287 - "line",
3288 - "area",
3289 - "stacked"
3290 - ]
3291 - },
3292 - "dimensions": {
3293 - "description": "Detailed information about the chart dimensions included in the `result`.\n",
3294 - "type": "object",
3295 - "properties": {
3296 - "grouped_by": {
3297 - "description": "An array with the order of the groupings performed.\n",
3298 - "type": "array",
3299 - "items": {
3300 - "type": "string",
3301 - "enum": [
3302 - "selected",
3303 - "dimension",
3304 - "instance",
3305 - "node",
3306 - "context",
3307 - "units",
3308 - "label:key1",
3309 - "label:key2",
3310 - "label:keyN"
3311 - ]
3312 - }
3313 - },
3314 - "ids": {
3315 - "description": "An array with the dimension ids that uniquely identify the dimensions for this query.\n",
3316 - "type": "array",
3317 - "items": {
3318 - "type": "string"
3319 - }
3320 - },
3321 - "names": {
3322 - "description": "An array with the dimension names to be presented to users. Names may be overlapping, but IDs are not.\n",
3323 - "type": "array",
3324 - "items": {
3325 - "type": "string"
3326 - }
3327 - },
3328 - "units": {
3329 - "description": "An array with the units each dimension has.\n",
3330 - "type": "array",
3331 - "items": {
3332 - "type": "string"
3333 - }
3334 - },
3335 - "priorities": {
3336 - "description": "An array with the relative priorities of the dimensions.\nNumbers may not be sequential or unique. The application is expected to order by this and then by name.\n",
3337 - "type": "array",
3338 - "items": {
3339 - "type": "integer"
3340 - }
3341 - },
3342 - "aggregated": {
3343 - "description": "An array with the number of source metrics aggregated into each dimension.\n",
3344 - "type": "array",
3345 - "items": {
3346 - "type": "integer"
3347 - }
3348 - },
3349 - "view_average_values": {
3350 - "description": "An array of the average value of each dimension across the entire query.\n",
3351 - "type": "array",
3352 - "items": {
3353 - "type": "number"
3354 - }
3355 - },
3356 - "view_latest_values": {
3357 - "description": "An array of the latest value of each dimension, included in this query.\n",
3358 - "type": "array",
3359 - "items": {
3360 - "type": "number"
3361 - }
3362 - },
3363 - "count": {
3364 - "description": "The number of dimensions in the `result`.\n",
3365 - "type": "integer"
3366 - },
3367 - "labels": {
3368 - "description": "The labels associated with each dimension in the query.\nThis object is only available when the `group-by-labels` option is given to the query.\n",
3369 - "type": "object",
3370 - "properties": {
3371 - "label_key1": {
3372 - "description": "An array having one entry for each of the dimensions of the query.\n",
3373 - "type": "array",
3374 - "items": {
3375 - "description": "An array having one entry for each of the values this label key has for the given dimension.\n",
3376 - "type": "array",
3377 - "items": {
3378 - "type": "string"
3379 - }
3380 - }
3381 - }
3382 - }
3383 - }
3384 - }
3385 - },
3386 - "min": {
3387 - "description": "The minimum value of all points included in the `result`.\n",
3388 - "type": "number"
3389 - },
3390 - "max": {
3391 - "description": "The maximum value of all points included in the `result`.\n",
3392 - "type": "number"
3493 }
3494 }
3495 + }
3496 + ]

This file is too large to show in full.

web/api/netdata-swagger.yaml
+1614 -1786
@@ -3,10 +3,123 @@ info:
3 title: Netdata API
4 description: Real-time performance and health monitoring.
5 version: "1.38"
6 + contact:
7 + name: Netdata Agent API
8 + email: info@netdata.cloud
9 + url: https://netdata.cloud
10 + license:
11 + name: GPL v3+
12 + url: https://github.com/netdata/netdata/blob/master/LICENSE
13 +servers:
14 + - url: https://registry.my-netdata.io
15 + - url: http://registry.my-netdata.io
16 + - url: http://localhost:19999
17 +tags:
18 + - name: nodes
19 + description: Everything related to monitored nodes
20 + - name: charts
21 + description: Everything related to chart instances - DO NOT USE IN NEW CODE - use contexts instead
22 + - name: contexts
23 + description: Everything related contexts - in new code, use this instead of charts
24 + - name: data
25 + description: Everything related to data queries
26 + - name: badges
27 + description: Everything related to dynamic badges based on metric data
28 + - name: weights
29 + description: Everything related to scoring / weighting metrics
30 + - name: functions
31 + description: Everything related to functions
32 + - name: alerts
33 + description: Everything related to alerts
34 + - name: management
35 + description: Everything related to managing netdata agents
36 paths:
37 + /api/v2/nodes:
38 + get:
39 + operationId: getNodes2
40 + tags:
41 + - nodes
42 + summary: Nodes Info v2
43 + description: |
44 + Get a list of all nodes hosted by this Netdata agent.
45 + parameters:
46 + - $ref: '#/components/parameters/scopeNodes'
47 + - $ref: '#/components/parameters/scopeContexts'
48 + - $ref: '#/components/parameters/filterNodes'
49 + - $ref: '#/components/parameters/filterContexts'
50 + responses:
51 + "200":
52 + description: OK
53 + content:
54 + application/json:
55 + schema:
56 + description: |
57 + `/api/v2/nodes` response for all nodes hosted by a Netdata agent.
58 + type: object
59 + properties:
60 + api:
61 + $ref: '#/components/schemas/api'
62 + agents:
63 + $ref: '#/components/schemas/agents'
64 + versions:
65 + $ref: '#/components/schemas/versions'
66 + nodes:
67 + type: array
68 + items:
69 + $ref: '#/components/schemas/nodeFull'
70 + /api/v2/contexts:
71 + get:
72 + operationId: getContexts2
73 + tags:
74 + - contexts
75 + summary: Contexts Info v2
76 + description: |
77 + Get a list of all contexts, across all nodes, hosted by this Netdata agent.
78 + parameters:
79 + - $ref: '#/components/parameters/scopeNodes'
80 + - $ref: '#/components/parameters/scopeContexts'
81 + - $ref: '#/components/parameters/filterNodes'
82 + - $ref: '#/components/parameters/filterContexts'
83 + responses:
84 + "200":
85 + description: OK
86 + content:
87 + application/json:
88 + schema:
89 + $ref: '#/components/schemas/contexts2'
90 + /api/v2/q:
91 + get:
92 + operationId: q2
93 + tags:
94 + - contexts
95 + summary: Full Text Search v2
96 + description: |
97 + Get a list of contexts, across all nodes, hosted by this Netdata agent, matching a string expression
98 + parameters:
99 + - name: q
100 + in: query
101 + description: The strings to search for, formatted as a simple pattern
102 + required: true
103 + schema:
104 + type: string
105 + format: simple pattern
106 + - $ref: '#/components/parameters/scopeNodes'
107 + - $ref: '#/components/parameters/scopeContexts'
108 + - $ref: '#/components/parameters/filterNodes'
109 + - $ref: '#/components/parameters/filterContexts'
110 + responses:
111 + "200":
112 + description: OK
113 + content:
114 + application/json:
115 + schema:
116 + $ref: '#/components/schemas/contexts2'
117 /api/v1/info:
118 get:
9 - summary: Get netdata basic information
119 + operationId: getNodeInfo1
120 + tags:
121 + - nodes
122 + summary: Node Info v1
123 description: |
124 The info endpoint returns basic information about netdata. It provides:
125 * netdata version
@@ -30,7 +143,10 @@ paths:
143 description: netdata daemon not ready (used for health checks).
144 /api/v1/charts:
145 get:
33 - summary: Get a list of all charts available at the server
146 + operationId: getNodeCharts1
147 + tags:
148 + - charts
149 + summary: List all charts v1 - EOL
150 description: The charts endpoint returns a summary about all charts stored in the
151 netdata server.
152 responses:
@@ -42,17 +158,13 @@ paths:
158 $ref: "#/components/schemas/chart_summary"
159 /api/v1/chart:
160 get:
45 - summary: Get info about a specific chart
161 + operationId: getNodeChart1
162 + tags:
163 + - charts
164 + summary: Get one chart v1 - EOL
165 description: The chart endpoint returns detailed information about a chart.
166 parameters:
48 - - name: chart
49 - in: query
50 - description: The id of the chart as returned by the /charts call.
51 - required: true
52 - schema:
53 - type: string
54 - format: as returned by /charts
55 - default: system.cpu
167 + - $ref: '#/components/parameters/chart'
168 responses:
169 "200":
170 description: A javascript object with detailed information about the chart.
@@ -66,68 +178,19 @@ paths:
178 description: No chart with the given id is found.
179 /api/v1/contexts:
180 get:
69 - summary: Get a list of all contexts available at the server
181 + operationId: getNodeContexts1
182 + tags:
183 + - contexts
184 + summary: Get a list of all node contexts available v1
185 description: The contexts endpoint returns a summary about all contexts stored in the
186 netdata server.
187 parameters:
73 - - name: options
74 - in: query
75 - description: Options that affect data generation.
76 - required: false
77 - allowEmptyValue: true
78 - schema:
79 - type: array
80 - items:
81 - type: string
82 - enum:
83 - - full
84 - - all
85 - - charts
86 - - dimensions
87 - - labels
88 - - uuids
89 - - queue
90 - - flags
91 - - deleted
92 - - deepscan
93 - default:
94 - - full
95 - - name: after
96 - in: query
97 - description: limit the results on context having data after this timestamp.
98 - required: false
99 - schema:
100 - type: number
101 - format: integer
102 - - name: before
103 - in: query
104 - description: limit the results on context having data before this timestamp.
105 - required: false
106 - schema:
107 - type: number
108 - format: integer
109 - - name: chart_label_key
110 - in: query
111 - description: a simple pattern matching charts label keys (use comma or pipe as separator)
112 - required: false
113 - allowEmptyValue: true
114 - schema:
115 - type: string
116 - - name: chart_labels_filter
117 - in: query
118 - description: "a simple pattern matching charts label key and values (use colon for equality, comma or pipe
119 - as separator)"
120 - required: false
121 - allowEmptyValue: true
122 - schema:
123 - type: string
124 - - name: dimensions
125 - in: query
126 - description: a simple pattern matching dimensions (use comma or pipe as separator)
127 - required: false
128 - allowEmptyValue: true
129 - schema:
130 - type: string
188 + - $ref: '#/components/parameters/dimensions'
189 + - $ref: '#/components/parameters/chart_label_key'
190 + - $ref: '#/components/parameters/chart_labels_filter'
191 + - $ref: '#/components/parameters/contextOptions1'
192 + - $ref: '#/components/parameters/after'
193 + - $ref: '#/components/parameters/before'
194 responses:
195 "200":
196 description: An array of contexts.
@@ -137,725 +200,345 @@ paths:
200 $ref: "#/components/schemas/context_summary"
201 /api/v1/context:
202 get:
203 + operationId: getNodeContext1
204 + tags:
205 + - contexts
206 summary: Get info about a specific context
141 - description: The context endpoint returns detailed information about a given context.
207 + description: |
208 + The context endpoint returns detailed information about a given context.
209 + The `context` parameter is required for this call.
210 parameters:
143 - - name: context
144 - in: query
145 - description: The id of the context as returned by the /contexts call.
146 - required: true
147 - schema:
148 - type: string
149 - format: as returned by /contexts
150 - default: system.cpu
151 - - name: options
211 + - $ref: '#/components/parameters/context'
212 + - $ref: '#/components/parameters/dimensions'
213 + - $ref: '#/components/parameters/chart_label_key'
214 + - $ref: '#/components/parameters/chart_labels_filter'
215 + - $ref: '#/components/parameters/contextOptions1'
216 + - $ref: '#/components/parameters/after'
217 + - $ref: '#/components/parameters/before'
218 + responses:
219 + "200":
220 + description: A javascript object with detailed information about the context.
221 + content:
222 + application/json:
223 + schema:
224 + $ref: "#/components/schemas/context"
225 + "400":
226 + description: No context id was supplied in the request.
227 + "404":
228 + description: No context with the given id is found.
229 + /api/v2/data:
230 + get:
231 + operationId: dataQuery2
232 + tags:
233 + - data
234 + summary: Data Query v2
235 + description: |
236 + Multi-node, multi-context, multi-instance, multi-dimension data queries, with time and metric aggregation.
237 + parameters:
238 + - name: group_by
239 in: query
153 - description: Options that affect data generation.
240 + description: |
241 + A comma separated list of the groupings required.
242 + All possible values can be combined together, except `selected`. If `selected` is given in the list, all others are ignored.
243 + The order they are placed in the list is currently ignored.
244 required: false
155 - allowEmptyValue: true
245 schema:
246 type: array
247 items:
248 type: string
249 enum:
161 - - full
162 - - all
163 - - charts
164 - - dimensions
165 - - labels
166 - - uuids
167 - - queue
168 - - flags
169 - - deleted
170 - - deepscan
250 + - dimension
251 + - instance
252 + - label
253 + - node
254 + - context
255 + - units
256 + - selected
257 default:
172 - - full
173 - - name: after
174 - in: query
175 - description: limit the results on context having data after this timestamp.
176 - required: false
177 - schema:
178 - type: number
179 - format: integer
180 - - name: before
181 - in: query
182 - description: limit the results on context having data before this timestamp.
183 - required: false
184 - schema:
185 - type: number
186 - format: integer
187 - - name: chart_label_key
188 - in: query
189 - description: a simple pattern matching charts label keys (use comma or pipe as separator)
190 - required: false
191 - allowEmptyValue: true
192 - schema:
193 - type: string
194 - - name: chart_labels_filter
258 + - dimension
259 + - name: group_by_label
260 in: query
196 - description: "a simple pattern matching charts label key and values (use colon for equality, comma or pipe
197 - as separator)"
261 + description: |
262 + A comma separated list of the label keys to group by their values. The order of the labels in the list is respected.
263 required: false
199 - allowEmptyValue: true
264 schema:
265 type: string
202 - - name: dimensions
266 + format: comma separated list of label keys to group by
267 + default: ""
268 + - name: aggregation
269 in: query
204 - description: a simple pattern matching dimensions (use comma or pipe as separator)
270 + description: |
271 + The aggregation function to apply when grouping metrics together.
272 + When option `raw` is given, `average` and `avg` behave like `sum` and the caller is expected to calculate the average.
273 required: false
206 - allowEmptyValue: true
274 schema:
275 type: string
276 + enum:
277 + - min
278 + - max
279 + - avg
280 + - average
281 + - sum
282 + default: average
283 + - $ref: '#/components/parameters/scopeNodes'
284 + - $ref: '#/components/parameters/scopeContexts'
285 + - $ref: '#/components/parameters/filterNodes'
286 + - $ref: '#/components/parameters/filterContexts'
287 + - $ref: '#/components/parameters/filterInstances'
288 + - $ref: '#/components/parameters/filterLabels'
289 + - $ref: '#/components/parameters/filterAlerts'
290 + - $ref: '#/components/parameters/filterDimensions'
291 + - $ref: '#/components/parameters/after'
292 + - $ref: '#/components/parameters/before'
293 + - $ref: '#/components/parameters/points'
294 + - $ref: '#/components/parameters/tier'
295 + - $ref: '#/components/parameters/dataQueryOptions'
296 + - $ref: '#/components/parameters/dataTimeGroup2'
297 + - $ref: '#/components/parameters/dataTimeGroupOptions2'
298 + - $ref: '#/components/parameters/dataTimeResampling2'
299 + - $ref: '#/components/parameters/dataFormat2'
300 + - $ref: '#/components/parameters/timeoutMS'
301 + - $ref: '#/components/parameters/callback'
302 + - $ref: '#/components/parameters/filename'
303 + - $ref: '#/components/parameters/tqx'
304 responses:
305 "200":
211 - description: A javascript object with detailed information about the context.
306 + description: |
307 + The call was successful. The response includes the data in the format requested.
308 content:
309 application/json:
310 schema:
215 - $ref: "#/components/schemas/context"
311 + oneOf:
312 + - $ref: '#/components/schemas/jsonwrap2'
313 + - $ref: '#/components/schemas/data_json_formats2'
314 + text/plain:
315 + schema:
316 + type: string
317 + format: according to the format requested.
318 + text/html:
319 + schema:
320 + type: string
321 + format: html
322 + application/x-javascript:
323 + schema:
324 + type: string
325 + format: javascript
326 "400":
217 - description: No context id was supplied in the request.
218 - "404":
219 - description: No context with the given id is found.
220 - /api/v1/alarm_variables:
327 + description: |
328 + Bad request - the body will include a message stating what is wrong.
329 + "500":
330 + description: |
331 + Internal server error. This usually means the server is out of memory.
332 + /api/v1/data:
333 get:
222 - summary: List variables available to configure alarms for a chart
223 - description: Returns the basic information of a chart and all the variables that can
224 - be used in alarm and template health configurations for the particular
225 - chart or family.
334 + operationId: dataQuery1
335 + tags:
336 + - data
337 + summary: Data Query v1 - Single node, single chart or context queries. without group-by.
338 + description: |
339 + Query metric data of a chart or context of a node and return a dataset having time-series data for all dimensions available.
340 + For group-by functionality, use `/api/v2/data`.
341 + At least a `chart` or a `context` have to be given for the data query to be executed.
342 parameters:
227 - - name: chart
228 - in: query
229 - description: The id of the chart as returned by the /charts call.
230 - required: true
231 - schema:
232 - type: string
233 - format: as returned by /charts
234 - default: system.cpu
343 + - $ref: '#/components/parameters/chart'
344 + - $ref: '#/components/parameters/context'
345 + - $ref: '#/components/parameters/dimension'
346 + - $ref: '#/components/parameters/chart_label_key'
347 + - $ref: '#/components/parameters/chart_labels_filter'
348 + - $ref: '#/components/parameters/after'
349 + - $ref: '#/components/parameters/before'
350 + - $ref: '#/components/parameters/points'
351 + - $ref: '#/components/parameters/tier'
352 + - $ref: '#/components/parameters/dataQueryOptions'
353 + - $ref: '#/components/parameters/dataFormat1'
354 + - $ref: '#/components/parameters/dataTimeGroup1'
355 + - $ref: '#/components/parameters/dataTimeGroupOptions1'
356 + - $ref: '#/components/parameters/dataTimeResampling1'
357 + - $ref: '#/components/parameters/timeoutMS'
358 + - $ref: '#/components/parameters/callback'
359 + - $ref: '#/components/parameters/filename'
360 + - $ref: '#/components/parameters/tqx'
361 responses:
362 "200":
237 - description: A javascript object with information about the chart and the
238 - available variables.
363 + description: |
364 + The call was successful. The response includes the data in the format requested.
365 content:
366 application/json:
367 schema:
242 - $ref: "#/components/schemas/alarm_variables"
368 + oneOf:
369 + - $ref: '#/components/schemas/jsonwrap1'
370 + - $ref: '#/components/schemas/data_json_formats1'
371 + text/plain:
372 + schema:
373 + type: string
374 + format: according to the format requested.
375 + text/html:
376 + schema:
377 + type: string
378 + format: html
379 + application/x-javascript:
380 + schema:
381 + type: string
382 + format: javascript
383 "400":
384 description: Bad request - the body will include a message stating what is wrong.
385 "404":
246 - description: No chart with the given id is found.
386 + description: Chart or context is not found. The supplied chart or context will be reported.
387 "500":
388 description: Internal server error. This usually means the server is out of
389 memory.
250 - /api/v2/data:
390 + /api/v1/allmetrics:
391 get:
252 - summary: Query metrics data
392 + operationId: allMetrics1
393 + tags:
394 + - data
395 + summary: All Metrics v1 - Fetch latest value for all metrics
396 description: |
254 - Multi-node, multi-context, multi-instance, multi-dimension data queries, with time and metric aggregation.
397 + The `allmetrics` endpoint returns the latest value of all metrics maintained for a netdata node.
398 parameters:
256 - - name: scope_nodes
399 + - name: format
400 in: query
258 - description: |
259 - A simple pattern limiting the nodes scope of the query. The scope controls both data and metadata response. The simple pattern is checked against the nodes' machine guid, node id, hostname. The default nodes scope is all nodes for which this agent has data for. Usually the nodes scope is used to slice the entire dashboard (e.g. the Global Nodes Selector at the Netdata Cloud overview dashboard). Both positive and negative simple pattern expressions are supported.
401 + description: The format of the response to be returned.
402 + required: true
403 + schema:
404 + type: string
405 + enum:
406 + - shell
407 + - prometheus
408 + - prometheus_all_hosts
409 + - json
410 + default: shell
411 + - name: filter
412 + in: query
413 + description: Allows to filter charts out using simple patterns.
414 required: false
415 schema:
416 type: string
263 - format: simple pattern
264 - default: "*"
265 - - name: scope_contexts
417 + format: any text
418 + - name: variables
419 in: query
420 description: |
268 - A simple pattern limiting the contexts scope of the query. The scope controls both data and metadata response. The default contexts scope is all contexts for which this agent has data for. Usually the contexts scope is used to slice charts of the dashboard (e.g. each context based chart has its own contexts scope, limiting the chart to all the instances of the selected contexts). Both positive and negative simple pattern expressions are supported.
421 + When enabled, netdata will expose various system configuration variables.
422 required: false
423 schema:
424 type: string
272 - format: simple pattern
273 - default: "*"
274 - - name: nodes
425 + enum:
426 + - yes
427 + - no
428 + default: no
429 + - name: help
430 in: query
431 description: |
277 - A simple pattern matching the nodes to be queried. This only controls the data response, not the metadata. The simple pattern is checked against the nodes' machine guid, node id, hostname. The default nodes selector is all the nodes matched by the nodes scope. Both positive and negative simple pattern expressions are supported.
432 + Enable or disable HELP lines in prometheus output.
433 required: false
434 schema:
435 type: string
281 - format: simple pattern
282 - default: "*"
283 - - name: contexts
436 + enum:
437 + - yes
438 + - no
439 + default: no
440 + - name: types
441 in: query
442 description: |
286 - A simple pattern matching the contexts to be queried. This only controls the data response, not the metadata. Both positive and negative simple pattern expressions are supported.
443 + Enable or disable TYPE lines in prometheus output.
444 required: false
445 schema:
446 type: string
290 - format: simple pattern
291 - default: "*"
292 - - name: instances
447 + enum:
448 + - yes
449 + - no
450 + default: no
451 + - name: timestamps
452 in: query
453 description: |
295 - A simple pattern matching the instances to be queried. The simple pattern is checked against the instance `id`, the instance `name`, the fully qualified name of the instance `id` and `name`, like `instance@machine_guid`, where `instance` is either its `id` or `name`. Both positive and negative simple pattern expressions are supported.
454 + Enable or disable timestamps in prometheus output.
455 required: false
456 schema:
457 type: string
299 - format: simple pattern
300 - default: "*"
301 - - name: labels
458 + enum:
459 + - yes
460 + - no
461 + default: yes
462 + - name: names
463 in: query
464 description: |
304 - A simple pattern matching the labels to be queried. The simple pattern is checked against `name:value` of all the labels of all the eligible instances (as filtered by all the above: scope nodes, scope contexts, nodes, contexts and instances). Negative simple patterns should not be used in this filter.
465 + When enabled netdata will report dimension names. When disabled netdata will report dimension IDs. The default is controlled in netdata.conf.
466 required: false
467 schema:
468 type: string
308 - format: simple pattern
309 - default: "*"
310 - - name: alerts
469 + enum:
470 + - yes
471 + - no
472 + default: yes
473 + - name: oldunits
474 in: query
475 description: |
313 - A simple pattern matching the alerts to be queried. The simple pattern is checked against the `name` of alerts and the combination of `name:status`, when status is one of `CLEAR`, `WARNING`, `CRITICAL`, `REMOVED`, `UNDEFINED`, `UNINITIALIZED`, of all the alerts of all the eligible instances (as filtered by all the above). A negative simple pattern will exclude the instances having the labels matched.
476 + When enabled, netdata will show metric names for the default `source=average` as they appeared before 1.12, by using the legacy unit naming conventions.
477 required: false
478 schema:
479 type: string
317 - format: simple pattern
318 - default: "*"
319 - - name: dimensions
480 + enum:
481 + - yes
482 + - no
483 + default: yes
484 + - name: hideunits
485 in: query
486 description: |
322 - A simple patterns matching the dimensions to be queried. The simple pattern is checked against and `id` and the `name` of the dimensions of the eligible instances (as filtered by all the above). Both positive and negative simple pattern expressions are supported.
487 + When enabled, netdata will not include the units in the metric names, for the default `source=average`.
488 required: false
489 schema:
490 type: string
326 - format: simple pattern
327 - default: "*"
328 - - name: before
491 + enum:
492 + - yes
493 + - no
494 + default: yes
495 + - name: server
496 in: query
497 description: |
331 - The end timestamp (unix epoch) of the data query, or a negative number specifying the number of seconds
332 - in the past relative now.
333 - required: false
334 - schema:
335 - type: number
336 - format: integer
337 - default: 0
338 - - name: after
339 - in: query
340 - description: |
341 - The start timestamp (unix epoch) of the data query, or a negative number specifying the number of seconds
342 - in the past relative to parameter `before`.
343 - required: false
344 - schema:
345 - type: number
346 - format: integer
347 - default: 0
348 - - name: points
349 - in: query
350 - description: |
351 - The number of points to be returned. If not given, or it is <= 0, or it is bigger than the points stored in the database for the given duration, all the available collected values for the given duration will be returned.
352 - required: false
353 - schema:
354 - type: number
355 - format: integer
356 - default: 0
357 - - name: group_by
358 - in: query
359 - description: |
360 - A comma separated list of the groupings required.
361 - All possible values can be combined together, except `selected`. If `selected` is given in the list, all others are ignored.
362 - The order they are placed in the list is currently ignored.
363 - required: false
364 - schema:
365 - type: array
366 - items:
367 - type: string
368 - enum:
369 - - dimension
370 - - instance
371 - - label
372 - - node
373 - - context
374 - - units
375 - - selected
376 - default:
377 - - dimension
378 - - name: group_by_label
379 - in: query
380 - description: |
381 - A comma separated list of the label keys to group by their values. The order of the labels in the list is respected.
382 - required: false
383 - schema:
384 - type: string
385 - format: comma separated list of label keys to group by
386 - default: ""
387 - - name: aggregation
388 - in: query
389 - description: |
390 - The aggregation function to apply when grouping metrics together.
391 - When option `raw` is given, `average` and `avg` behave like `sum` and the caller is expected to calculate the average.
392 - required: false
393 - schema:
394 - type: string
395 - enum:
396 - - min
397 - - max
398 - - avg
399 - - average
400 - - sum
401 - default: average
402 - - name: time_group
403 - in: query
404 - description: |
405 - Time aggregation function. If multiple collected values are to be grouped in order to return fewer points, this parameters defines the method of grouping. methods supported "min", "max", "average", "sum", "incremental-sum". "max" is actually calculated on the absolute value collected (so it works for both positive and negative dimensions to return the most extreme value in either direction).
406 - required: true
407 - schema:
408 - type: string
409 - enum:
410 - - min
411 - - max
412 - - avg
413 - - average
414 - - median
415 - - stddev
416 - - sum
417 - - incremental-sum
418 - - ses
419 - - des
420 - - cv
421 - - countif
422 - - percentile
423 - - percentile25
424 - - percentile50
425 - - percentile75
426 - - percentile80
427 - - percentile90
428 - - percentile95
429 - - percentile97
430 - - percentile98
431 - - percentile99
432 - - trimmed-mean
433 - - trimmed-mean1
434 - - trimmed-mean2
435 - - trimmed-mean3
436 - - trimmed-mean5
437 - - trimmed-mean10
438 - - trimmed-mean15
439 - - trimmed-mean20
440 - - trimmed-mean25
441 - - trimmed-median
442 - - trimmed-median1
443 - - trimmed-median2
444 - - trimmed-median3
445 - - trimmed-median5
446 - - trimmed-median10
447 - - trimmed-median15
448 - - trimmed-median20
449 - - trimmed-median25
450 - default: average
451 - - name: time_group_options
452 - in: query
453 - description: |
454 - When the group function supports additional parameters, this field can be used to pass them to it. Currently `countif`, `trimmed-mean`, `trimmed-median` and `percentile` support this. For `countif` the string may start with `<`, `<=`, `<:`, `<>`, `!=`, `>`, `>=`, `>:`. For all others just a number is expected.
455 - required: false
456 - schema:
457 - type: string
458 - - name: time_resampling
459 - in: query
460 - description: |
461 - For incremental values that are "per second", this value is used to resample them to "per minute` (60) or "per hour" (3600). It can only be used in conjunction with group=average.
462 - required: false
463 - schema:
464 - type: number
465 - format: integer
466 - default: 0
467 - - name: timeout
468 - in: query
469 - description: |
470 - Specify a timeout value in milliseconds after which the agent will abort the query and return a 503 error. A value of 0 indicates no timeout.
471 - required: false
472 - schema:
473 - type: number
474 - format: integer
475 - default: 0
476 - - name: format
477 - in: query
478 - description: |
479 - The format of the data to be returned.
480 - required: true
481 - allowEmptyValue: false
482 - schema:
483 - type: string
484 - enum:
485 - - json
486 - - json2
487 - - jsonp
488 - - csv
489 - - tsv
490 - - tsv-excel
491 - - ssv
492 - - ssvcomma
493 - - datatable
494 - - datasource
495 - - html
496 - - markdown
497 - - array
498 - - csvjsonarray
499 - default: json2
500 - - name: options
501 - in: query
502 - description: |
503 - Options that affect data generation.
504 - `raw` changes the output so that the values can be aggregated across multiple such queries.
505 - required: false
506 - allowEmptyValue: false
507 - schema:
508 - type: array
509 - items:
510 - type: string
511 - enum:
512 - - raw
513 - - nonzero
514 - - flip
515 - - min2max
516 - - seconds
517 - - milliseconds
518 - - abs
519 - - absolute
520 - - null2zero
521 - - percentage
522 - - unaligned
523 - - match-ids
524 - - match-names
525 - - anomaly-bit
526 - - group-by-labels
527 - default:
528 - - seconds
529 - - jsonwrap
530 - - name: tier
531 - in: query
532 - description: |
533 - Use only the specified database tier.
534 - required: false
535 - schema:
536 - type: number
537 - format: integer
538 - - name: callback
539 - in: query
540 - description: |
541 - For JSONP responses, the callback function name.
498 + Set a distinct name of the client querying prometheus metrics. Netdata will use the client IP if this is not set.
499 required: false
500 schema:
501 type: string
545 - - name: filename
502 + format: any text
503 + - name: prefix
504 in: query
505 description: |
548 - Add `Content-Disposition: attachment; filename=` header to the response, that will instruct the browser to save the response with the given filename."
506 + Prefix all prometheus metrics with this string.
507 required: false
508 schema:
509 type: string
552 - - name: tqx
510 + format: any text
511 + - name: data
512 in: query
513 description: |
555 - [Google Visualization API](https://developers.google.com/chart/interactive/docs/dev/implementing_data_source?hl=en) formatted parameter.
556 - required: false
557 - schema:
558 - type: string
559 - responses:
560 - "200":
561 - description: |
562 - The call was successful. The response includes the data in the format requested. Swagger2.0 does not process the discriminator field to show polymorphism. The response will be one of the sub-types of the data-schema according to the chosen format, e.g. json -> data_json.
563 - content:
564 - application/json:
565 - schema:
566 - $ref: "#/components/schemas/data_json2"
567 - "400":
568 - description: |
569 - Bad request - the body will include a message stating what is wrong.
570 - "500":
571 - description: |
572 - Internal server error. This usually means the server is out of memory.
573 - /api/v1/data:
574 - get:
575 - summary: Get collected data for a specific chart
576 - description: The data endpoint returns data stored in the round robin database of a
577 - chart.
578 - parameters:
579 - - name: chart
580 - in: query
581 - description: The id of the chart as returned by the /charts call. Note chart or context must be specified
582 - required: false
583 - allowEmptyValue: false
584 - schema:
585 - type: string
586 - format: as returned by /charts
587 - default: system.cpu
588 - - name: context
589 - in: query
590 - description: The context of the chart as returned by the /charts call. Note chart or context must be specified
591 - required: false
592 - allowEmptyValue: false
593 - schema:
594 - type: string
595 - format: as returned by /charts
596 - - name: dimension
597 - in: query
598 - description: Zero, one or more dimension ids or names, as returned by the /chart
599 - call, separated with comma or pipe. Netdata simple patterns are
600 - supported.
601 - required: false
602 - allowEmptyValue: false
603 - schema:
604 - type: array
605 - items:
606 - type: string
607 - format: as returned by /charts
608 - - name: after
609 - in: query
610 - description: "This parameter can either be an absolute timestamp specifying the
611 - starting point of the data to be returned, or a relative number of
612 - seconds (negative, relative to parameter: before). Netdata will
613 - assume it is a relative number if it is less that 3 years (in seconds).
614 - If not specified the default is -600 seconds. Netdata will adapt this
615 - parameter to the boundaries of the round robin database unless the allow_past
616 - option is specified."
617 - required: true
618 - allowEmptyValue: false
619 - schema:
620 - type: number
621 - format: integer
622 - default: -600
623 - - name: before
624 - in: query
625 - description: This parameter can either be an absolute timestamp specifying the
626 - ending point of the data to be returned, or a relative number of
627 - seconds (negative), relative to the last collected timestamp.
628 - Netdata will assume it is a relative number if it is less than 3
629 - years (in seconds). Netdata will adapt this parameter to the
630 - boundaries of the round robin database. The default is zero (i.e.
631 - the timestamp of the last value collected).
632 - required: false
633 - schema:
634 - type: number
635 - format: integer
636 - default: 0
637 - - name: points
638 - in: query
639 - description: The number of points to be returned. If not given, or it is <= 0, or
640 - it is bigger than the points stored in the round robin database for
641 - this chart for the given duration, all the available collected
642 - values for the given duration will be returned.
643 - required: true
644 - allowEmptyValue: false
645 - schema:
646 - type: number
647 - format: integer
648 - default: 20
649 - - name: chart_label_key
650 - in: query
651 - description: Specify the chart label keys that need to match for context queries as comma separated values.
652 - At least one matching key is needed to match the corresponding chart.
514 + Select the prometheus response data source. There is a setting in netdata.conf for the default.
515 required: false
654 - allowEmptyValue: false
655 - schema:
656 - type: string
657 - format: key1,key2,key3
658 - - name: chart_labels_filter
659 - in: query
660 - description: Specify the chart label keys and values to match for context queries. All keys/values need to
661 - match for the chart to be included in the query. The labels are specified as key1:value1,key2:value2
662 - required: false
663 - allowEmptyValue: false
664 - schema:
665 - type: string
666 - format: key1:value1,key2:value2,key3:value3
667 - - name: group
668 - in: query
669 - description: The grouping method. If multiple collected values are to be grouped
670 - in order to return fewer points, this parameters defines the method
671 - of grouping. methods supported "min", "max", "average", "sum",
672 - "incremental-sum". "max" is actually calculated on the absolute
673 - value collected (so it works for both positive and negative
674 - dimensions to return the most extreme value in either direction).
675 - required: true
676 - allowEmptyValue: false
516 schema:
517 type: string
518 enum:
680 - - min
681 - - max
519 + - as-collected
520 - average
683 - - median
684 - - stddev
521 - sum
686 - - incremental-sum
687 - - ses
688 - - des
689 - - cv
690 - - countif
691 - - percentile
692 - - percentile25
693 - - percentile50
694 - - percentile75
695 - - percentile80
696 - - percentile90
697 - - percentile95
698 - - percentile97
699 - - percentile98
700 - - percentile99
701 - - trimmed-mean
702 - - trimmed-mean1
703 - - trimmed-mean2
704 - - trimmed-mean3
705 - - trimmed-mean5
706 - - trimmed-mean10
707 - - trimmed-mean15
708 - - trimmed-mean20
709 - - trimmed-mean25
710 - - trimmed-median
711 - - trimmed-median1
712 - - trimmed-median2
713 - - trimmed-median3
714 - - trimmed-median5
715 - - trimmed-median10
716 - - trimmed-median15
717 - - trimmed-median20
718 - - trimmed-median25
522 default: average
720 - - name: group_options
721 - in: query
722 - description: When the group function supports additional parameters, this field
723 - can be used to pass them to it. Currently only "countif" supports this.
724 - required: false
725 - allowEmptyValue: false
726 - schema:
727 - type: string
728 - - name: gtime
729 - in: query
730 - description: The grouping number of seconds. This is used in conjunction with
731 - group=average to change the units of metrics (ie when the data is
732 - per-second, setting gtime=60 will turn them to per-minute).
733 - required: false
734 - allowEmptyValue: false
735 - schema:
736 - type: number
737 - format: integer
738 - default: 0
739 - - name: timeout
740 - in: query
741 - description: Specify a timeout value in milliseconds after which the agent will
742 - abort the query and return a 503 error. A value of 0 indicates no timeout.
743 - required: false
744 - allowEmptyValue: false
745 - schema:
746 - type: number
747 - format: integer
748 - default: 0
749 - - name: format
750 - in: query
751 - description: The format of the data to be returned.
752 - required: true
753 - allowEmptyValue: false
754 - schema:
755 - type: string
756 - enum:
757 - - json
758 - - jsonp
759 - - csv
760 - - tsv
761 - - tsv-excel
762 - - ssv
763 - - ssvcomma
764 - - datatable
765 - - datasource
766 - - html
767 - - markdown
768 - - array
769 - - csvjsonarray
770 - default: json
771 - - name: options
772 - in: query
773 - description: Options that affect data generation.
774 - required: false
775 - allowEmptyValue: false
776 - schema:
777 - type: array
778 - items:
779 - type: string
780 - enum:
781 - - nonzero
782 - - flip
783 - - jsonwrap
784 - - min2max
785 - - seconds
786 - - milliseconds
787 - - abs
788 - - absolute
789 - - absolute-sum
790 - - null2zero
791 - - objectrows
792 - - google_json
793 - - percentage
794 - - unaligned
795 - - match-ids
796 - - match-names
797 - - allow_past
798 - - anomaly-bit
799 - default:
800 - - seconds
801 - - jsonwrap
802 - - name: callback
803 - in: query
804 - description: For JSONP responses, the callback function name.
805 - required: false
806 - allowEmptyValue: true
807 - schema:
808 - type: string
809 - - name: filename
810 - in: query
811 - description: "Add Content-Disposition: attachment; filename= header to
812 - the response, that will instruct the browser to save the response
813 - with the given filename."
814 - required: false
815 - allowEmptyValue: true
816 - schema:
817 - type: string
818 - - name: tqx
819 - in: query
820 - description: "[Google Visualization
821 - API](https://developers.google.com/chart/interactive/docs/dev/imple\
822 - menting_data_source?hl=en) formatted parameter."
823 - required: false
824 - allowEmptyValue: true
825 - schema:
826 - type: string
523 responses:
524 "200":
829 - description: The call was successful. The response includes the data in the
830 - format requested. Swagger2.0 does not process the discriminator
831 - field to show polymorphism. The response will be one of the
832 - sub-types of the data-schema according to the chosen format, e.g.
833 - json -> data_json.
834 - content:
835 - application/json:
836 - schema:
837 - $ref: "#/components/schemas/data"
525 + description: All the metrics returned in the format requested.
526 "400":
839 - description: Bad request - the body will include a message stating what is wrong.
840 - "404":
841 - description: Chart or context is not found. The supplied chart or context will be reported.
842 - "500":
843 - description: Internal server error. This usually means the server is out of
844 - memory.
527 + description: The format requested is not supported.
528 /api/v1/badge.svg:
529 get:
530 + operationId: badge1
531 + tags:
532 + - badges
533 summary: Generate a badge in form of SVG image for a chart (or dimension)
534 description: Successful responses are SVG images.
535 parameters:
850 - - name: chart
851 - in: query
852 - description: The id of the chart as returned by the /charts call.
853 - required: true
854 - allowEmptyValue: false
855 - schema:
856 - type: string
857 - format: as returned by /charts
858 - default: system.cpu
536 + - $ref: '#/components/parameters/chart'
537 + - $ref: '#/components/parameters/dimension'
538 + - $ref: '#/components/parameters/after'
539 + - $ref: '#/components/parameters/before'
540 + - $ref: '#/components/parameters/dataTimeGroup1'
541 + - $ref: '#/components/parameters/dataQueryOptions'
542 - name: alarm
543 in: query
544 description: The name of an alarm linked to the chart.
@@ -864,120 +547,6 @@ paths:
547 schema:
548 type: string
549 format: any text
867 - - name: dimension
868 - in: query
869 - description: Zero, one or more dimension ids, as returned by the /chart call.
870 - required: false
871 - allowEmptyValue: false
872 - schema:
873 - type: array
874 - items:
875 - type: string
876 - format: as returned by /charts
877 - - name: after
878 - in: query
879 - description: This parameter can either be an absolute timestamp specifying the
880 - starting point of the data to be returned, or a relative number of
881 - seconds, to the last collected timestamp. Netdata will assume it is
882 - a relative number if it is smaller than the duration of the round
883 - robin database for this chart. So, if the round robin database is
884 - 3600 seconds, any value from -3600 to 3600 will trigger relative
885 - arithmetics. Netdata will adapt this parameter to the boundaries of
886 - the round robin database.
887 - required: true
888 - allowEmptyValue: false
889 - schema:
890 - type: number
891 - format: integer
892 - default: -600
893 - - name: before
894 - in: query
895 - description: This parameter can either be an absolute timestamp specifying the
896 - ending point of the data to be returned, or a relative number of
897 - seconds, to the last collected timestamp. Netdata will assume it is
898 - a relative number if it is smaller than the duration of the round
899 - robin database for this chart. So, if the round robin database is
900 - 3600 seconds, any value from -3600 to 3600 will trigger relative
901 - arithmetics. Netdata will adapt this parameter to the boundaries of
902 - the round robin database.
903 - required: false
904 - schema:
905 - type: number
906 - format: integer
907 - default: 0
908 - - name: group
909 - in: query
910 - description: The grouping method. If multiple collected values are to be grouped
911 - in order to return fewer points, this parameters defines the method
912 - of grouping. methods are supported "min", "max", "average", "sum",
913 - "incremental-sum". "max" is actually calculated on the absolute
914 - value collected (so it works for both positive and negative
915 - dimensions to return the most extreme value in either direction).
916 - required: true
917 - allowEmptyValue: false
918 - schema:
919 - type: string
920 - enum:
921 - - min
922 - - max
923 - - average
924 - - median
925 - - stddev
926 - - sum
927 - - incremental-sum
928 - - ses
929 - - des
930 - - cv
931 - - countif
932 - - percentile
933 - - percentile25
934 - - percentile50
935 - - percentile75
936 - - percentile80
937 - - percentile90
938 - - percentile95
939 - - percentile97
940 - - percentile98
941 - - percentile99
942 - - trimmed-mean
943 - - trimmed-mean1
944 - - trimmed-mean2
945 - - trimmed-mean3
946 - - trimmed-mean5
947 - - trimmed-mean10
948 - - trimmed-mean15
949 - - trimmed-mean20
950 - - trimmed-mean25
951 - - trimmed-median
952 - - trimmed-median1
953 - - trimmed-median2
954 - - trimmed-median3
955 - - trimmed-median5
956 - - trimmed-median10
957 - - trimmed-median15
958 - - trimmed-median20
959 - - trimmed-median25
960 - default: average
961 - - name: options
962 - in: query
963 - description: Options that affect data generation.
964 - required: false
965 - allowEmptyValue: true
966 - schema:
967 - type: array
968 - items:
969 - type: string
970 - enum:
971 - - abs
972 - - absolute
973 - - display-absolute
974 - - absolute-sum
975 - - null2zero
976 - - percentage
977 - - unaligned
978 - - anomaly-bit
979 - default:
980 - - absolute
550 - name: label
551 in: query
552 description: A text to be used as the label.
@@ -996,9 +565,8 @@ paths:
565 format: any text
566 - name: label_color
567 in: query
999 - description: "A color to be used for the background of the label side(left side) of the badge.
1000 - One of predefined colors or specific color in hex `RGB` or `RRGGBB` format (without preceding `#` character).
1001 - If value wrong or not given default color will be used."
568 + description: |
569 + A color to be used for the background of the label side(left side) of the badge. One of predefined colors or specific color in hex `RGB` or `RRGGBB` format (without preceding `#` character). If value wrong or not given default color will be used.
570 required: false
571 allowEmptyValue: true
572 schema:
@@ -1020,12 +588,8 @@ paths:
588 format: ^([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$
589 - name: value_color
590 in: query
1023 - description: "A color to be used for the background of the value *(right)* part of badge. You can set
1024 - multiple using a pipe with a condition each, like this:
1025 - `color<value|color:null` The following operators are
1026 - supported: >, <, >=, <=, =, :null (to check if no value exists).
1027 - Each color can be specified in same manner as for `label_color` parameter.
1028 - Currently only integers are supported as values."
591 + description: |
592 + A color to be used for the background of the value *(right)* part of badge. You can set multiple using a pipe with a condition each, like this: `color<value|color:null` The following operators are supported: >, <, >=, <=, =, :null (to check if no value exists). Each color can be specified in same manner as for `label_color` parameter. Currently only integers are supported as values.
593 required: false
594 allowEmptyValue: true
595 schema:
@@ -1033,9 +597,8 @@ paths:
597 format: any text
598 - name: text_color_lbl
599 in: query
1036 - description: "Font color for label *(left)* part of the badge. One of predefined colors or as HTML hexadecimal
1037 - color without preceding `#` character. Formats allowed `RGB` or `RRGGBB`. If no or wrong value given default
1038 - color will be used."
600 + description: |
601 + Font color for label *(left)* part of the badge. One of predefined colors or as HTML hexadecimal color without preceding `#` character. Formats allowed `RGB` or `RRGGBB`. If no or wrong value given default color will be used.
602 required: false
603 allowEmptyValue: true
604 schema:
@@ -1057,9 +620,8 @@ paths:
620 format: ^([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$
621 - name: text_color_val
622 in: query
1060 - description: "Font color for value *(right)* part of the badge. One of predefined colors or as HTML
1061 - hexadecimal color without preceding `#` character. Formats allowed `RGB` or `RRGGBB`. If no or wrong value
1062 - given default color will be used."
623 + description: |
624 + Font color for value *(right)* part of the badge. One of predefined colors or as HTML hexadecimal color without preceding `#` character. Formats allowed `RGB` or `RRGGBB`. If no or wrong value given default color will be used.
625 required: false
626 allowEmptyValue: true
627 schema:
@@ -1107,12 +669,8 @@ paths:
669 format: integer
670 - name: fixed_width_lbl
671 in: query
1110 - description: "This parameter overrides auto-sizing of badge and creates it with fixed width.
1111 - This parameter determines the size of the label's left side *(label/name)*.
1112 - You must set this parameter together with `fixed_width_val` otherwise it will be ignored.
1113 - You should set the label/value widths wide enough to provide space for all the possible values/contents of
1114 - the badge you're requesting. In case the text cannot fit the space given it will be clipped.
1115 - The `scale` parameter still applies on the values you give to `fixed_width_lbl` and `fixed_width_val`."
672 + description: |
673 + This parameter overrides auto-sizing of badge and creates it with fixed width. This parameter determines the size of the label's left side *(label/name)*. You must set this parameter together with `fixed_width_val` otherwise it will be ignored. You should set the label/value widths wide enough to provide space for all the possible values/contents of the badge you're requesting. In case the text cannot fit the space given it will be clipped. The `scale` parameter still applies on the values you give to `fixed_width_lbl` and `fixed_width_val`.
674 required: false
675 allowEmptyValue: false
676 schema:
@@ -1120,12 +678,8 @@ paths:
678 format: integer
679 - name: fixed_width_val
680 in: query
1123 - description: "This parameter overrides auto-sizing of badge and creates it with fixed width. This parameter
1124 - determines the size of the label's right side *(value)*. You must set this parameter together with
1125 - `fixed_width_lbl` otherwise it will be ignored. You should set the label/value widths wide enough to
1126 - provide space for all the possible values/contents of the badge you're requesting. In case the text cannot
1127 - fit the space given it will be clipped. The `scale` parameter still applies on the values you give to
1128 - `fixed_width_lbl` and `fixed_width_val`."
681 + description: |
682 + This parameter overrides auto-sizing of badge and creates it with fixed width. This parameter determines the size of the label's right side *(value)*. You must set this parameter together with `fixed_width_lbl` otherwise it will be ignored. You should set the label/value widths wide enough to provide space for all the possible values/contents of the badge you're requesting. In case the text cannot fit the space given it will be clipped. The `scale` parameter still applies on the values you give to `fixed_width_lbl` and `fixed_width_val`.
683 required: false
684 allowEmptyValue: false
685 schema:
@@ -1141,146 +695,171 @@ paths:
695 "500":
696 description: Internal server error. This usually means the server is out of
697 memory.
1144 - /api/v1/allmetrics:
698 + /api/v2/weights:
699 get:
1146 - summary: Get a value of all the metrics maintained by netdata
1147 - description: The allmetrics endpoint returns the latest value of all charts and
1148 - dimensions stored in the netdata server.
700 + operationId: weights2
701 + tags:
702 + - weights
703 + summary: Score or weight all or some of the metrics, across all nodes, according to various algorithms.
704 + description: |
705 + This endpoint goes through all metrics and scores them according to an algorithm.
706 parameters:
1150 - - name: format
1151 - in: query
1152 - description: The format of the response to be returned.
1153 - required: true
1154 - schema:
1155 - type: string
1156 - enum:
1157 - - shell
1158 - - prometheus
1159 - - prometheus_all_hosts
1160 - - json
1161 - default: shell
1162 - - name: filter
1163 - in: query
1164 - description: Allows to filter charts out using simple patterns.
1165 - required: false
1166 - schema:
1167 - type: string
1168 - format: any text
1169 - - name: variables
1170 - in: query
1171 - description: When enabled, netdata will expose various system
1172 - configuration metrics.
1173 - required: false
1174 - schema:
1175 - type: string
1176 - enum:
1177 - - yes
1178 - - no
1179 - default: no
1180 - - name: help
1181 - in: query
1182 - description: Enable or disable HELP lines in prometheus output.
1183 - required: false
1184 - schema:
1185 - type: string
1186 - enum:
1187 - - yes
1188 - - no
1189 - default: no
1190 - - name: types
1191 - in: query
1192 - description: Enable or disable TYPE lines in prometheus output.
1193 - required: false
1194 - schema:
1195 - type: string
1196 - enum:
1197 - - yes
1198 - - no
1199 - default: no
1200 - - name: timestamps
1201 - in: query
1202 - description: Enable or disable timestamps in prometheus output.
1203 - required: false
1204 - schema:
1205 - type: string
1206 - enum:
1207 - - yes
1208 - - no
1209 - default: yes
1210 - - name: names
1211 - in: query
1212 - description: When enabled netdata will report dimension names. When disabled
1213 - netdata will report dimension IDs. The default is controlled in
1214 - netdata.conf.
1215 - required: false
1216 - schema:
1217 - type: string
1218 - enum:
1219 - - yes
1220 - - no
1221 - default: yes
1222 - - name: oldunits
1223 - in: query
1224 - description: When enabled, netdata will show metric names for the default
1225 - source=average as they appeared before 1.12, by using the legacy
1226 - unit naming conventions.
1227 - required: false
1228 - schema:
1229 - type: string
1230 - enum:
1231 - - yes
1232 - - no
1233 - default: yes
1234 - - name: hideunits
1235 - in: query
1236 - description: When enabled, netdata will not include the units in the metric
1237 - names, for the default source=average.
1238 - required: false
1239 - schema:
1240 - type: string
1241 - enum:
1242 - - yes
1243 - - no
1244 - default: yes
1245 - - name: server
1246 - in: query
1247 - description: Set a distinct name of the client querying prometheus metrics.
1248 - Netdata will use the client IP if this is not set.
1249 - required: false
1250 - schema:
1251 - type: string
1252 - format: any text
1253 - - name: prefix
1254 - in: query
1255 - description: Prefix all prometheus metrics with this string.
1256 - required: false
1257 - schema:
1258 - type: string
1259 - format: any text
1260 - - name: data
707 + - $ref: '#/components/parameters/weightMethods'
708 + - $ref: '#/components/parameters/scopeNodes'
709 + - $ref: '#/components/parameters/scopeContexts'
710 + - $ref: '#/components/parameters/filterNodes'
711 + - $ref: '#/components/parameters/filterContexts'
712 + - $ref: '#/components/parameters/filterInstances'
713 + - $ref: '#/components/parameters/filterLabels'
714 + - $ref: '#/components/parameters/filterAlerts'
715 + - $ref: '#/components/parameters/filterDimensions'
716 + - $ref: '#/components/parameters/baselineAfter'
717 + - $ref: '#/components/parameters/baselineBefore'
718 + - $ref: '#/components/parameters/after'
719 + - $ref: '#/components/parameters/before'
720 + - $ref: '#/components/parameters/tier'
721 + - $ref: '#/components/parameters/points'
722 + - $ref: '#/components/parameters/timeoutMS'
723 + - $ref: '#/components/parameters/dataQueryOptions'
724 + - $ref: '#/components/parameters/dataTimeGroup2'
725 + - $ref: '#/components/parameters/dataTimeGroupOptions2'
726 + responses:
727 + "200":
728 + description: JSON object with weights for each context, chart and dimension.
729 + content:
730 + application/json:
731 + schema:
732 + $ref: "#/components/schemas/weights2"
733 + "400":
734 + description: The given parameters are invalid.
735 + "403":
736 + description: metrics correlations are not enabled on this Netdata Agent.
737 + "404":
738 + description: |
739 + No charts could be found, or the method that correlated the metrics did not produce any result.
740 + "504":
741 + description: Timeout - the query took too long and has been cancelled.
742 + /api/v1/weights:
743 + get:
744 + operationId: weights1
745 + tags:
746 + - weights
747 + summary: Score or weight all or some of the metrics of a single node, according to various algorithms.
748 + description: |
749 + This endpoint goes through all metrics and scores them according to an algorithm.
750 + parameters:
751 + - $ref: '#/components/parameters/weightMethods'
752 + - $ref: '#/components/parameters/context'
753 + - $ref: '#/components/parameters/baselineAfter'
754 + - $ref: '#/components/parameters/baselineBefore'
755 + - $ref: '#/components/parameters/after'
756 + - $ref: '#/components/parameters/before'
757 + - $ref: '#/components/parameters/tier'
758 + - $ref: '#/components/parameters/points'
759 + - $ref: '#/components/parameters/timeoutMS'
760 + - $ref: '#/components/parameters/dataQueryOptions'
761 + - $ref: '#/components/parameters/dataTimeGroup1'
762 + - $ref: '#/components/parameters/dataTimeGroupOptions1'
763 + responses:
764 + "200":
765 + description: JSON object with weights for each context, chart and dimension.
766 + content:
767 + application/json:
768 + schema:
769 + $ref: "#/components/schemas/weights"
770 + "400":
771 + description: The given parameters are invalid.
772 + "403":
773 + description: metrics correlations are not enabled on this Netdata Agent.
774 + "404":
775 + description: No charts could be found, or the method
776 + that correlated the metrics did not produce any result.
777 + "504":
778 + description: Timeout - the query took too long and has been cancelled.
779 + /api/v1/metric_correlations:
780 + get:
781 + operationId: metricCorrelations1
782 + tags:
783 + - weights
784 + summary: Analyze all the metrics to find their correlations - EOL
785 + description: |
786 + THIS ENDPOINT IS OBSOLETE. Use the /weights endpoint. Given two time-windows (baseline, highlight), it goes through all the available metrics, querying both windows and tries to find how these two windows relate to each other. It supports multiple algorithms to do so. The result is a list of all metrics evaluated, weighted for 0.0 (the two windows are more different) to 1.0 (the two windows are similar). The algorithm adjusts automatically the baseline window to be a power of two multiple of the highlighted (1, 2, 4, 8, etc).
787 + parameters:
788 + - $ref: '#/components/parameters/weightMethods'
789 + - $ref: '#/components/parameters/baselineAfter'
790 + - $ref: '#/components/parameters/baselineBefore'
791 + - $ref: '#/components/parameters/after'
792 + - $ref: '#/components/parameters/before'
793 + - $ref: '#/components/parameters/points'
794 + - $ref: '#/components/parameters/tier'
795 + - $ref: '#/components/parameters/timeoutMS'
796 + - $ref: '#/components/parameters/dataQueryOptions'
797 + - $ref: '#/components/parameters/dataTimeGroup1'
798 + - $ref: '#/components/parameters/dataTimeGroupOptions1'
799 + responses:
800 + "200":
801 + description: JSON object with weights for each chart and dimension.
802 + content:
803 + application/json:
804 + schema:
805 + $ref: "#/components/schemas/metric_correlations"
806 + "400":
807 + description: The given parameters are invalid.
808 + "403":
809 + description: metrics correlations are not enabled on this Netdata Agent.
810 + "404":
811 + description: No charts could be found, or the method
812 + that correlated the metrics did not produce any result.
813 + "504":
814 + description: Timeout - the query took too long and has been cancelled.
815 + /api/v1/function:
816 + get:
817 + operationId: function1
818 + tags:
819 + - functions
820 + description: "Execute a collector function."
821 + parameters:
822 + - name: function
823 in: query
1262 - description: Select the prometheus response data source. There is a setting in
1263 - netdata.conf for the default.
1264 - required: false
824 + description: The name of the function, as returned by the collector.
825 + required: true
826 + allowEmptyValue: false
827 schema:
828 type: string
1267 - enum:
1268 - - as-collected
1269 - - average
1270 - - sum
1271 - default: average
829 + - $ref: '#/components/parameters/timeoutSecs'
830 responses:
831 "200":
1274 - description: All the metrics returned in the format requested.
832 + description: The collector function has been executed successfully. Each collector may return a different type of content.
833 "400":
1276 - description: The format requested is not supported.
834 + description: The request was rejected by the collector.
835 + "404":
836 + description: The requested function is not found.
837 + "500":
838 + description: Other internal error, getting this error means there is a bug in Netdata.
839 + "503":
840 + description: The collector to execute the function is not currently available.
841 + "504":
842 + description: Timeout while waiting for the collector to execute the function.
843 + "591":
844 + description: The collector sent a response, but it was invalid or corrupted.
845 + /api/v1/functions:
846 + get:
847 + operationId: functions1
848 + tags:
849 + - functions
850 + summary: Get a list of all registered collector functions.
851 + description: Collector functions are programs that can be executed on demand.
852 + responses:
853 + "200":
854 + description: A JSON object containing one object per supported function.
855 /api/v1/alarms:
856 get:
857 + operationId: alerts1
858 + tags:
859 + - alerts
860 summary: Get a list of active or raised alarms on the server
1280 - description: The alarms endpoint returns the list of all raised or enabled alarms on
1281 - the netdata server. Called without any parameters, the raised alarms in
1282 - state WARNING or CRITICAL are returned. By passing "?all", all the
1283 - enabled alarms are returned.
861 + description: |
862 + The alarms endpoint returns the list of all raised or enabled alarms on the netdata server. Called without any parameters, the raised alarms in state WARNING or CRITICAL are returned. By passing "?all", all the enabled alarms are returned.
863 parameters:
864 - name: all
865 in: query
@@ -1305,13 +884,12 @@ paths:
884 $ref: "#/components/schemas/alarms"
885 /api/v1/alarms_values:
886 get:
887 + operationId: alertValues1
888 + tags:
889 + - alerts
890 summary: Get a list of active or raised alarms on the server
1309 - description: "The alarms_values endpoint returns the list of all raised or enabled alarms on
1310 - the netdata server. Called without any parameters, the raised alarms in
1311 - state WARNING or CRITICAL are returned. By passing '?all', all the
1312 - enabled alarms are returned.
1313 - This option output differs from `/alarms` in the number of variables delivered. This endpoint gives
1314 - to user `id`, `value`, `last_updated` time, and alarm `status`."
891 + description: |
892 + The alarms_values endpoint returns the list of all raised or enabled alarms on the netdata server. Called without any parameters, the raised alarms in state WARNING or CRITICAL are returned. By passing '?all', all the enabled alarms are returned. This option output differs from `/alarms` in the number of variables delivered. This endpoint gives to user `id`, `value`, `last_updated` time, and alarm `status`.
893 parameters:
894 - name: all
895 in: query
@@ -1336,17 +914,17 @@ paths:
914 $ref: "#/components/schemas/alarms_values"
915 /api/v1/alarm_log:
916 get:
917 + operationId: alertsLog1
918 + tags:
919 + - alerts
920 summary: Retrieves the entries of the alarm log
1340 - description: Returns an array of alarm_log entries, with historical information on
1341 - raised and cleared alarms.
921 + description: |
922 + Returns an array of alarm_log entries, with historical information on raised and cleared alarms.
923 parameters:
924 - name: after
925 in: query
1345 - description: Passing the parameter after=UNIQUEID returns all the events in the
1346 - alarm log that occurred after UNIQUEID. An automated series of calls
1347 - would call the interface once without after=, store the last
1348 - UNIQUEID of the returned set, and give it back to get incrementally
1349 - the next events.
926 + description: |
927 + Passing the parameter after=UNIQUEID returns all the events in the alarm log that occurred after UNIQUEID. An automated series of calls would call the interface once without after=, store the last UNIQUEID of the returned set, and give it back to get incrementally the next events.
928 required: false
929 schema:
930 type: integer
@@ -1361,23 +939,16 @@ paths:
939 $ref: "#/components/schemas/alarm_log_entry"
940 /api/v1/alarm_count:
941 get:
942 + operationId: alertsCount1
943 + tags:
944 + - alerts
945 summary: Get an overall status of the chart
1365 - description: Checks multiple charts with the same context and counts number of alarms
1366 - with given status.
946 + description: |
947 + Checks multiple charts with the same context and counts number of alarms with given status.
948 parameters:
1368 - - in: query
1369 - name: context
1370 - description: Specify context which should be checked.
1371 - required: false
1372 - allowEmptyValue: true
1373 - schema:
1374 - type: array
1375 - items:
1376 - type: string
1377 - default:
1378 - - system.cpu
1379 - - in: query
1380 - name: status
949 + - $ref: '#/components/parameters/context'
950 + - name: status
951 + in: query
952 description: Specify alarm status to count.
953 required: false
954 allowEmptyValue: true
@@ -1405,523 +976,635 @@ paths:
976 "500":
977 description: Internal server error. This usually means the server is out of
978 memory.
1408 - /api/v1/manage/health:
979 + /api/v1/alarm_variables:
980 get:
1410 - summary: "Accesses the health management API to control health checks and
1411 - notifications at runtime."
1412 - description: "Available from Netdata v1.12 and above, protected via bearer
1413 - authorization. Especially useful for maintenance periods, the API allows
1414 - you to disable health checks completely, silence alarm notifications, or
1415 - Disable/Silence specific alarms that match selectors on alarm/template
1416 - name, chart, context, host and family. For the simple disable/silence
1417 - all scenarios, only the cmd parameter is required. The other parameters
1418 - are used to define alarm selectors. For more information and examples,
1419 - refer to the netdata documentation."
981 + operationId: getNodeAlertVariables1
982 + tags:
983 + - alerts
984 + summary: List variables available to configure alarms for a chart
985 + description: |
986 + Returns the basic information of a chart and all the variables that can be used in alarm and template health configurations for the particular chart or family.
987 parameters:
1421 - - name: cmd
1422 - in: query
1423 - description: "DISABLE ALL: No alarm criteria are evaluated, nothing is written in
1424 - the alarm log. SILENCE ALL: No notifications are sent. RESET: Return
1425 - to the default state. DISABLE/SILENCE: Set the mode to be used for
1426 - the alarms matching the criteria of the alarm selectors. LIST: Show
1427 - active configuration."
1428 - required: false
1429 - schema:
1430 - type: string
1431 - enum:
1432 - - DISABLE ALL
1433 - - SILENCE ALL
1434 - - DISABLE
1435 - - SILENCE
1436 - - RESET
1437 - - LIST
1438 - - name: alarm
1439 - in: query
1440 - description: The expression provided will match both `alarm` and `template` names.
1441 - schema:
1442 - type: string
988 - name: chart
989 in: query
1445 - description: Chart ids/names, as shown on the dashboard. These will match the
1446 - `on` entry of a configured `alarm`.
1447 - schema:
1448 - type: string
1449 - - name: context
1450 - in: query
1451 - description: Chart context, as shown on the dashboard. These will match the `on`
1452 - entry of a configured `template`.
1453 - schema:
1454 - type: string
1455 - - name: hosts
1456 - in: query
1457 - description: The hostnames that will need to match.
1458 - schema:
1459 - type: string
1460 - - name: families
1461 - in: query
1462 - description: The alarm families.
1463 - schema:
1464 - type: string
1465 - responses:
1466 - "200":
1467 - description: A plain text response based on the result of the command.
1468 - "403":
1469 - description: Bearer authentication error.
1470 - /api/v1/aclk:
1471 - get:
1472 - summary: Get information about current ACLK state
1473 - description: "ACLK endpoint returns detailed information
1474 - about current state of ACLK (Agent to Cloud communication)."
1475 - responses:
1476 - "200":
1477 - description: JSON object with ACLK information.
1478 - content:
1479 - application/json:
1480 - schema:
1481 - $ref: "#/components/schemas/aclk_state"
1482 - /api/v1/metric_correlations:
1483 - get:
1484 - summary: "Analyze all the metrics to find their correlations"
1485 - description: "THIS ENDPOINT IS OBSOLETE. Use the /weights endpoint.
1486 - Given two time-windows (baseline, highlight), it goes
1487 - through all the available metrics, querying both windows and tries to find
1488 - how these two windows relate to each other. It supports
1489 - multiple algorithms to do so. The result is a list of all
1490 - metrics evaluated, weighted for 0.0 (the two windows are
1491 - more different) to 1.0 (the two windows are similar).
1492 - The algorithm adjusts automatically the baseline window to be
1493 - a power of two multiple of the highlighted (1, 2, 4, 8, etc)."
1494 - parameters:
1495 - - name: baseline_after
1496 - in: query
1497 - description: This parameter can either be an absolute timestamp specifying the
1498 - starting point of baseline window, or a relative number of
1499 - seconds (negative, relative to parameter baseline_before). Netdata will
1500 - assume it is a relative number if it is less that 3 years (in seconds).
1501 - required: false
1502 - allowEmptyValue: false
1503 - schema:
1504 - type: number
1505 - format: integer
1506 - default: -300
1507 - - name: baseline_before
1508 - in: query
1509 - description: This parameter can either be an absolute timestamp specifying the
1510 - ending point of the baseline window, or a relative number of
1511 - seconds (negative), relative to the last collected timestamp.
1512 - Netdata will assume it is a relative number if it is less than 3
1513 - years (in seconds).
1514 - required: false
1515 - schema:
1516 - type: number
1517 - format: integer
1518 - default: -60
1519 - - name: after
1520 - in: query
1521 - description: This parameter can either be an absolute timestamp specifying the
1522 - starting point of highlighted window, or a relative number of
1523 - seconds (negative, relative to parameter highlight_before). Netdata will
1524 - assume it is a relative number if it is less that 3 years (in seconds).
1525 - required: false
1526 - allowEmptyValue: false
1527 - schema:
1528 - type: number
1529 - format: integer
1530 - default: -60
1531 - - name: before
1532 - in: query
1533 - description: This parameter can either be an absolute timestamp specifying the
1534 - ending point of the highlighted window, or a relative number of
1535 - seconds (negative), relative to the last collected timestamp.
1536 - Netdata will assume it is a relative number if it is less than 3
1537 - years (in seconds).
1538 - required: false
1539 - schema:
1540 - type: number
1541 - format: integer
1542 - default: 0
1543 - - name: points
1544 - in: query
1545 - description: The number of points to be evaluated for the highlighted window.
1546 - The baseline window will be adjusted automatically to receive a proportional
1547 - amount of points.
1548 - required: false
1549 - allowEmptyValue: false
1550 - schema:
1551 - type: number
1552 - format: integer
1553 - default: 500
1554 - - name: method
1555 - in: query
1556 - description: the algorithm to run
1557 - required: false
1558 - schema:
1559 - type: string
1560 - enum:
1561 - - ks2
1562 - - volume
1563 - default: ks2
1564 - - name: timeout
1565 - in: query
1566 - description: Cancel the query if to takes more that this amount of milliseconds.
1567 - required: false
1568 - allowEmptyValue: false
1569 - schema:
1570 - type: number
1571 - format: integer
1572 - default: 60000
1573 - - name: options
1574 - in: query
1575 - description: Options that affect data generation.
1576 - required: false
1577 - allowEmptyValue: false
1578 - schema:
1579 - type: array
1580 - items:
1581 - type: string
1582 - enum:
1583 - - min2max
1584 - - abs
1585 - - absolute
1586 - - absolute-sum
1587 - - null2zero
1588 - - percentage
1589 - - unaligned
1590 - - allow_past
1591 - - nonzero
1592 - - anomaly-bit
1593 - - raw
1594 - default:
1595 - - null2zero
1596 - - allow_past
1597 - - nonzero
1598 - - unaligned
1599 - - name: group
1600 - in: query
1601 - description: The grouping method. If multiple collected values are to be grouped
1602 - in order to return fewer points, this parameters defines the method
1603 - of grouping. methods supported "min", "max", "average", "sum",
1604 - "incremental-sum". "max" is actually calculated on the absolute
1605 - value collected (so it works for both positive and negative
1606 - dimensions to return the most extreme value in either direction).
1607 - required: true
1608 - allowEmptyValue: false
1609 - schema:
1610 - type: string
1611 - enum:
1612 - - min
1613 - - max
1614 - - average
1615 - - median
1616 - - stddev
1617 - - sum
1618 - - incremental-sum
1619 - - ses
1620 - - des
1621 - - cv
1622 - - countif
1623 - - percentile
1624 - - percentile25
1625 - - percentile50
1626 - - percentile75
1627 - - percentile80
1628 - - percentile90
1629 - - percentile95
1630 - - percentile97
1631 - - percentile98
1632 - - percentile99
1633 - - trimmed-mean
1634 - - trimmed-mean1
1635 - - trimmed-mean2
1636 - - trimmed-mean3
1637 - - trimmed-mean5
1638 - - trimmed-mean10
1639 - - trimmed-mean15
1640 - - trimmed-mean20
1641 - - trimmed-mean25
1642 - - trimmed-median
1643 - - trimmed-median1
1644 - - trimmed-median2
1645 - - trimmed-median3
1646 - - trimmed-median5
1647 - - trimmed-median10
1648 - - trimmed-median15
1649 - - trimmed-median20
1650 - - trimmed-median25
1651 - default: average
1652 - - name: group_options
1653 - in: query
1654 - description: When the group function supports additional parameters, this field
1655 - can be used to pass them to it. Currently only "countif" supports this.
1656 - required: false
1657 - allowEmptyValue: false
1658 - schema:
1659 - type: string
1660 - responses:
1661 - "200":
1662 - description: JSON object with weights for each chart and dimension.
1663 - content:
1664 - application/json:
1665 - schema:
1666 - $ref: "#/components/schemas/metric_correlations"
1667 - "400":
1668 - description: The given parameters are invalid.
1669 - "403":
1670 - description: metrics correlations are not enabled on this Netdata Agent.
1671 - "404":
1672 - description: No charts could be found, or the method
1673 - that correlated the metrics did not produce any result.
1674 - "504":
1675 - description: Timeout - the query took too long and has been cancelled.
1676 - /api/v1/function:
1677 - get:
1678 - summary: "Execute a collector function."
1679 - parameters:
1680 - - name: function
1681 - in: query
1682 - description: The name of the function, as returned by the collector.
990 + description: The id of the chart as returned by the /charts call.
991 required: true
1684 - allowEmptyValue: false
1685 - schema:
1686 - type: string
1687 - - name: timeout
1688 - in: query
1689 - description: The timeout in seconds to wait for the function to complete.
1690 - required: false
1691 - schema:
1692 - type: number
1693 - format: integer
1694 - default: 10
1695 - responses:
1696 - "200":
1697 - description: The collector function has been executed successfully. Each collector may return a different type of content.
1698 - "400":
1699 - description: The request was rejected by the collector.
1700 - "404":
1701 - description: The requested function is not found.
1702 - "500":
1703 - description: Other internal error, getting this error means there is a bug in Netdata.
1704 - "503":
1705 - description: The collector to execute the function is not currently available.
1706 - "504":
1707 - description: Timeout while waiting for the collector to execute the function.
1708 - "591":
1709 - description: The collector sent a response, but it was invalid or corrupted.
1710 - /api/v1/functions:
1711 - get:
1712 - summary: Get a list of all registered collector functions.
1713 - description: Collector functions are programs that can be executed on demand.
1714 - responses:
1715 - "200":
1716 - description: A JSON object containing one object per supported function.
1717 - /api/v1/weights:
1718 - get:
1719 - summary: "Analyze all the metrics using an algorithm and score them accordingly"
1720 - description: "This endpoint goes through all metrics and scores them according to an algorithm."
1721 - parameters:
1722 - - name: baseline_after
1723 - in: query
1724 - description: This parameter can either be an absolute timestamp specifying the
1725 - starting point of baseline window, or a relative number of
1726 - seconds (negative, relative to parameter baseline_before). Netdata will
1727 - assume it is a relative number if it is less that 3 years (in seconds).
1728 - This parameter is used in KS2 and VOLUME algorithms.
1729 - required: false
1730 - allowEmptyValue: false
1731 - schema:
1732 - type: number
1733 - format: integer
1734 - default: -300
1735 - - name: baseline_before
1736 - in: query
1737 - description: This parameter can either be an absolute timestamp specifying the
1738 - ending point of the baseline window, or a relative number of
1739 - seconds (negative), relative to the last collected timestamp.
1740 - Netdata will assume it is a relative number if it is less than 3
1741 - years (in seconds).
1742 - This parameter is used in KS2 and VOLUME algorithms.
1743 - required: false
1744 - schema:
1745 - type: number
1746 - format: integer
1747 - default: -60
1748 - - name: after
1749 - in: query
1750 - description: This parameter can either be an absolute timestamp specifying the
1751 - starting point of highlighted window, or a relative number of
1752 - seconds (negative, relative to parameter highlight_before). Netdata will
1753 - assume it is a relative number if it is less that 3 years (in seconds).
1754 - required: false
1755 - allowEmptyValue: false
1756 - schema:
1757 - type: number
1758 - format: integer
1759 - default: -60
1760 - - name: before
1761 - in: query
1762 - description: This parameter can either be an absolute timestamp specifying the
1763 - ending point of the highlighted window, or a relative number of
1764 - seconds (negative), relative to the last collected timestamp.
1765 - Netdata will assume it is a relative number if it is less than 3
1766 - years (in seconds).
1767 - required: false
1768 - schema:
1769 - type: number
1770 - format: integer
1771 - default: 0
1772 - - name: context
1773 - in: query
1774 - description: A simple pattern matching the contexts to evaluate.
1775 - required: false
1776 - allowEmptyValue: false
1777 - schema:
1778 - type: string
1779 - - name: points
1780 - in: query
1781 - description: The number of points to be evaluated for the highlighted window.
1782 - The baseline window will be adjusted automatically to receive a proportional
1783 - amount of points.
1784 - This parameter is only used by the KS2 algorithm.
1785 - required: false
1786 - allowEmptyValue: false
992 schema:
1788 - type: number
1789 - format: integer
1790 - default: 500
1791 - - name: method
993 + type: string
994 + format: as returned by /charts
995 + default: system.cpu
996 + responses:
997 + "200":
998 + description: A javascript object with information about the chart and the
999 + available variables.
1000 + content:
1001 + application/json:
1002 + schema:
1003 + $ref: "#/components/schemas/alarm_variables"
1004 + "400":
1005 + description: Bad request - the body will include a message stating what is wrong.
1006 + "404":
1007 + description: No chart with the given id is found.
1008 + "500":
1009 + description: Internal server error. This usually means the server is out of
1010 + memory.
1011 + /api/v1/manage/health:
1012 + get:
1013 + operationId: health1
1014 + tags:
1015 + - management
1016 + summary: |
1017 + Accesses the health management API to control health checks and notifications at runtime.
1018 + description: |
1019 + Available from Netdata v1.12 and above, protected via bearer authorization. Especially useful for maintenance periods, the API allows you to disable health checks completely, silence alarm notifications, or Disable/Silence specific alarms that match selectors on alarm/template name, chart, context, host and family. For the simple disable/silence all scenarios, only the cmd parameter is required. The other parameters are used to define alarm selectors. For more information and examples, refer to the netdata documentation.
1020 + parameters:
1021 + - name: cmd
1022 in: query
1793 - description: the algorithm to run
1023 + description: |
1024 + DISABLE ALL: No alarm criteria are evaluated, nothing is written in the alarm log. SILENCE ALL: No notifications are sent. RESET: Return to the default state. DISABLE/SILENCE: Set the mode to be used for the alarms matching the criteria of the alarm selectors. LIST: Show active configuration.
1025 required: false
1026 schema:
1027 type: string
1028 enum:
1798 - - ks2
1799 - - volume
1800 - - anomaly-rate
1801 - default: anomaly-rate
1802 - - name: tier
1029 + - DISABLE ALL
1030 + - SILENCE ALL
1031 + - DISABLE
1032 + - SILENCE
1033 + - RESET
1034 + - LIST
1035 + - name: alarm
1036 in: query
1804 - description: Use the specified database tier
1805 - required: false
1806 - allowEmptyValue: false
1037 + description: The expression provided will match both `alarm` and `template` names.
1038 schema:
1808 - type: number
1809 - format: integer
1810 - - name: timeout
1039 + type: string
1040 + - name: chart
1041 in: query
1812 - description: Cancel the query if to takes more that this amount of milliseconds.
1813 - required: false
1814 - allowEmptyValue: false
1042 + description: Chart ids/names, as shown on the dashboard. These will match the
1043 + `on` entry of a configured `alarm`.
1044 schema:
1816 - type: number
1817 - format: integer
1818 - default: 60000
1819 - - name: options
1045 + type: string
1046 + - name: context
1047 in: query
1821 - description: Options that affect data generation.
1822 - required: false
1823 - allowEmptyValue: false
1048 + description: Chart context, as shown on the dashboard. These will match the `on`
1049 + entry of a configured `template`.
1050 schema:
1825 - type: array
1826 - items:
1827 - type: string
1828 - enum:
1829 - - min2max
1830 - - abs
1831 - - absolute
1832 - - absolute-sum
1833 - - null2zero
1834 - - percentage
1835 - - unaligned
1836 - - nonzero
1837 - - anomaly-bit
1838 - - raw
1839 - default:
1840 - - null2zero
1841 - - nonzero
1842 - - unaligned
1843 - - name: group
1051 + type: string
1052 + - name: hosts
1053 in: query
1845 - description: The grouping method. If multiple collected values are to be grouped
1846 - in order to return fewer points, this parameters defines the method
1847 - of grouping. methods supported "min", "max", "average", "sum",
1848 - "incremental-sum". "max" is actually calculated on the absolute
1849 - value collected (so it works for both positive and negative
1850 - dimensions to return the most extreme value in either direction).
1851 - required: true
1852 - allowEmptyValue: false
1054 + description: The hostnames that will need to match.
1055 schema:
1056 type: string
1855 - enum:
1856 - - min
1857 - - max
1858 - - average
1859 - - median
1860 - - stddev
1861 - - sum
1862 - - incremental-sum
1863 - - ses
1864 - - des
1865 - - cv
1866 - - countif
1867 - - percentile
1868 - - percentile25
1869 - - percentile50
1870 - - percentile75
1871 - - percentile80
1872 - - percentile90
1873 - - percentile95
1874 - - percentile97
1875 - - percentile98
1876 - - percentile99
1877 - - trimmed-mean
1878 - - trimmed-mean1
1879 - - trimmed-mean2
1880 - - trimmed-mean3
1881 - - trimmed-mean5
1882 - - trimmed-mean10
1883 - - trimmed-mean15
1884 - - trimmed-mean20
1885 - - trimmed-mean25
1886 - - trimmed-median
1887 - - trimmed-median1
1888 - - trimmed-median2
1889 - - trimmed-median3
1890 - - trimmed-median5
1891 - - trimmed-median10
1892 - - trimmed-median15
1893 - - trimmed-median20
1894 - - trimmed-median25
1895 - default: average
1896 - - name: group_options
1057 + - name: families
1058 in: query
1898 - description: When the group function supports additional parameters, this field
1899 - can be used to pass them to it. Currently only "countif" supports this.
1900 - required: false
1901 - allowEmptyValue: false
1059 + description: The alarm families.
1060 schema:
1061 type: string
1062 responses:
1063 "200":
1906 - description: JSON object with weights for each context, chart and dimension.
1064 + description: A plain text response based on the result of the command.
1065 + "403":
1066 + description: Bearer authentication error.
1067 + /api/v1/aclk:
1068 + get:
1069 + operationId: aclk1
1070 + tags:
1071 + - management
1072 + summary: Get information about current ACLK state
1073 + description: |
1074 + ACLK endpoint returns detailed information about current state of ACLK (Agent to Cloud communication).
1075 + responses:
1076 + "200":
1077 + description: JSON object with ACLK information.
1078 content:
1079 application/json:
1080 schema:
1910 - $ref: "#/components/schemas/weights"
1911 - "400":
1912 - description: The given parameters are invalid.
1913 - "403":
1914 - description: metrics correlations are not enabled on this Netdata Agent.
1915 - "404":
1916 - description: No charts could be found, or the method
1917 - that correlated the metrics did not produce any result.
1918 - "504":
1919 - description: Timeout - the query took too long and has been cancelled.
1920 -servers:
1921 - - url: https://registry.my-netdata.io
1922 - - url: http://registry.my-netdata.io
1923 - - url: http://localhost:19999
1081 + $ref: "#/components/schemas/aclk_state"
1082 components:
1083 + parameters:
1084 + scopeNodes:
1085 + name: scope_nodes
1086 + in: query
1087 + description: |
1088 + A simple pattern limiting the nodes scope of the query. The scope controls both data and metadata response. The simple pattern is checked against the nodes' machine guid, node id and hostname. The default nodes scope is all nodes for which this agent has data for. Usually the nodes scope is used to slice the entire dashboard (e.g. the Global Nodes Selector at the Netdata Cloud overview dashboard). Both positive and negative simple pattern expressions are supported.
1089 + required: false
1090 + schema:
1091 + type: string
1092 + format: simple pattern
1093 + default: "*"
1094 + scopeContexts:
1095 + name: scope_contexts
1096 + in: query
1097 + description: |
1098 + A simple pattern limiting the contexts scope of the query. The scope controls both data and metadata response. The default contexts scope is all contexts for which this agent has data for. Usually the contexts scope is used to slice data on the dashboard (e.g. each context based chart has its own contexts scope, limiting the chart to all the instances of the selected context). Both positive and negative simple pattern expressions are supported.
1099 + required: false
1100 + schema:
1101 + type: string
1102 + format: simple pattern
1103 + default: "*"
1104 + filterNodes:
1105 + name: nodes
1106 + in: query
1107 + description: |
1108 + A simple pattern matching the nodes to be queried. This only controls the data response, not the metadata. The simple pattern is checked against the nodes' machine guid, node id, hostname. The default nodes selector is all the nodes matched by the nodes scope. Both positive and negative simple pattern expressions are supported.
1109 + required: false
1110 + schema:
1111 + type: string
1112 + format: simple pattern
1113 + default: "*"
1114 + filterContexts:
1115 + name: contexts
1116 + in: query
1117 + description: |
1118 + A simple pattern matching the contexts to be queried. This only controls the data response, not the metadata. Both positive and negative simple pattern expressions are supported.
1119 + required: false
1120 + schema:
1121 + type: string
1122 + format: simple pattern
1123 + default: "*"
1124 + filterInstances:
1125 + name: instances
1126 + in: query
1127 + description: |
1128 + A simple pattern matching the instances to be queried. The simple pattern is checked against the instance `id`, the instance `name`, the fully qualified name of the instance `id` and `name`, like `instance@machine_guid`, where `instance` is either its `id` or `name`. Both positive and negative simple pattern expressions are supported.
1129 + required: false
1130 + schema:
1131 + type: string
1132 + format: simple pattern
1133 + default: "*"
1134 + filterLabels:
1135 + name: labels
1136 + in: query
1137 + description: |
1138 + A simple pattern matching the labels to be queried. The simple pattern is checked against `name:value` of all the labels of all the eligible instances (as filtered by all the above: scope nodes, scope contexts, nodes, contexts and instances). Negative simple patterns should not be used in this filter.
1139 + required: false
1140 + schema:
1141 + type: string
1142 + format: simple pattern
1143 + default: "*"
1144 + filterAlerts:
1145 + name: alerts
1146 + in: query
1147 + description: |
1148 + A simple pattern matching the alerts to be queried. The simple pattern is checked against the `name` of alerts and the combination of `name:status`, when status is one of `CLEAR`, `WARNING`, `CRITICAL`, `REMOVED`, `UNDEFINED`, `UNINITIALIZED`, of all the alerts of all the eligible instances (as filtered by all the above). A negative simple pattern will exclude the instances having the labels matched.
1149 + required: false
1150 + schema:
1151 + type: string
1152 + format: simple pattern
1153 + default: "*"
1154 + filterDimensions:
1155 + name: dimensions
1156 + in: query
1157 + description: |
1158 + A simple patterns matching the dimensions to be queried. The simple pattern is checked against and `id` and the `name` of the dimensions of the eligible instances (as filtered by all the above). Both positive and negative simple pattern expressions are supported.
1159 + required: false
1160 + schema:
1161 + type: string
1162 + format: simple pattern
1163 + default: "*"
1164 +
1165 + dataFormat1:
1166 + name: format
1167 + in: query
1168 + description: The format of the data to be returned.
1169 + allowEmptyValue: false
1170 + schema:
1171 + type: string
1172 + enum:
1173 + - json
1174 + - jsonp
1175 + - csv
1176 + - tsv
1177 + - tsv-excel
1178 + - ssv
1179 + - ssvcomma
1180 + - datatable
1181 + - datasource
1182 + - html
1183 + - markdown
1184 + - array
1185 + - csvjsonarray
1186 + default: json
1187 + dataFormat2:
1188 + name: format
1189 + in: query
1190 + description: The format of the data to be returned.
1191 + allowEmptyValue: false
1192 + schema:
1193 + type: string
1194 + enum:
1195 + - json
1196 + - json2
1197 + - jsonp
1198 + - csv
1199 + - tsv
1200 + - tsv-excel
1201 + - ssv
1202 + - ssvcomma
1203 + - datatable
1204 + - datasource
1205 + - html
1206 + - markdown
1207 + - array
1208 + - csvjsonarray
1209 + default: json2
1210 + dataQueryOptions:
1211 + name: options
1212 + in: query
1213 + description: |
1214 + Options that affect data generation.
1215 + * `jsonwrap` - Wrap the output in a JSON object with metadata about the query.
1216 + * `raw` - change the output so that it is aggregatable across multiple such queries. Supported by `/api/v2` data queries and `json2` format.
1217 + * `minify` - Remove unnecessary spaces and newlines from the output.
1218 + * `debug` - Provide additional information in `jsonwrap` output to help tracing issues.
1219 + * `nonzero` - Do not return dimensions that all their values are zero, to improve the visual appearance of charts. They will still be returned if all the dimensions are entirely zero.
1220 + * `null2zero` - Replace `null` values with `0`.
1221 + * `absolute` or `abs` - Traditionally Netdata returns select dimensions negative to improve visual appearance. This option turns this feature off.
1222 + * `display-absolute` - Only used by badges, to do color calculation using the signed value, but render the value without a sign.
1223 + * `flip` or `reversed` - Order the timestamps array in reverse order (newest to oldest).
1224 + * `min2max` - When flattening multi-dimensional data into a single metric format, use `max - min` instead of `sum`. This is EOL - use `/api/v2` to control aggregation across dimensions.
1225 + * `percentage` - Convert all values into a percentage vs the row total. When enabled, Netdata will query all dimensions, even the ones that have not been selected or are hidden, to find the row total, in order to calculate the percentage of each dimension selected.
1226 + * `seconds` - Output timestamps in seconds instead of dates.
1227 + * `milliseconds` or `ms` - Output timestamps in milliseconds instead of dates.
1228 + * `unaligned` - by default queries are aligned to the the view, so that as time passes past data returned do not change. When a data query will not be used for visualization, `unaligned` can be given to avoid aligning the query time-frame for visual precision.
1229 + * `match-ids`, `match-names`. By default filters match both IDs and names when they are available. Setting either of the two options will disable the other.
1230 + * `anomaly-bit` - query the anomaly information instead of metric values. This is EOL, use `/api/v2` and `json2` format which always returns this information and many more.
1231 + * `jw-anomaly-rates` - return anomaly rates as a separate result set in the same `json` format response. This is EOL, use `/api/v2` and `json2` format which always returns information and many more.
1232 + * `details` - `/api/v2/data` returns in `jsonwrap` the full tree of dimensions that have been matched by the query.
1233 + * `group-by-labels` - `/api/v2/data` returns in `jsonwrap` flattened labels per output dimension. These are used to identify the instances that have been aggregated into each dimension, making it possible to provide a map, like Netdata does for Kubernetes.
1234 + * `natural-points` - return timestamps as found in the database. The result is again fixed-step, but the query engine attempts to align them with the timestamps found in the database.
1235 + * `virtual-points` - return timestamps independent of the database alignment. This is needed aggregating data across multiple Netdata agents, to ensure that their outputs do not need to be interpolated to be merged.
1236 + * `selected-tier` - use data exclusively from the selected tier given with the `tier` parameter. This option is set automatically when the `tier` parameter is set.
1237 + * `all-dimensions` - In `/api/v1` `jsonwrap` include metadata for all candidate metrics examined. In `/api/v2` this is standard behavior and no option is needed.
1238 + * `label-quotes` - In `csv` output format, enclose each header label in quotes.
1239 + * `objectrows` - Each row of value should be an object, not an array (only for `json` format).
1240 + * `google_json` - Comply with google JSON/JSONP specs (only for `json` format).
1241 + required: false
1242 + allowEmptyValue: false
1243 + schema:
1244 + type: array
1245 + items:
1246 + type: string
1247 + enum:
1248 + - jsonwrap
1249 + - raw
1250 + - minify
1251 + - debug
1252 + - nonzero
1253 + - null2zero
1254 + - abs
1255 + - absolute
1256 + - display-absolute
1257 + - flip
1258 + - reversed
1259 + - min2max
1260 + - percentage
1261 + - seconds
1262 + - ms
1263 + - milliseconds
1264 + - unaligned
1265 + - match-ids
1266 + - match-names
1267 + - anomaly-bit
1268 + - jw-anomaly-rates
1269 + - details
1270 + - group-by-labels
1271 + - natural-points
1272 + - virtual-points
1273 + - selected-tier
1274 + - all-dimensions
1275 + - label-quotes
1276 + - objectrows
1277 + - google_json
1278 + default:
1279 + - seconds
1280 + - jsonwrap
1281 + dataTimeGroup1:
1282 + name: group
1283 + in: query
1284 + description: |
1285 + Time aggregation function. If multiple collected values are to be grouped in order to return fewer points, this parameters defines the method of grouping. If the `absolute` option is set, the values are turned positive before applying this calculation.
1286 + required: false
1287 + schema:
1288 + type: string
1289 + enum:
1290 + - min
1291 + - max
1292 + - avg
1293 + - average
1294 + - median
1295 + - stddev
1296 + - sum
1297 + - incremental-sum
1298 + - ses
1299 + - des
1300 + - cv
1301 + - countif
1302 + - percentile
1303 + - percentile25
1304 + - percentile50
1305 + - percentile75
1306 + - percentile80
1307 + - percentile90
1308 + - percentile95
1309 + - percentile97
1310 + - percentile98
1311 + - percentile99
1312 + - trimmed-mean
1313 + - trimmed-mean1
1314 + - trimmed-mean2
1315 + - trimmed-mean3
1316 + - trimmed-mean5
1317 + - trimmed-mean10
1318 + - trimmed-mean15
1319 + - trimmed-mean20
1320 + - trimmed-mean25
1321 + - trimmed-median
1322 + - trimmed-median1
1323 + - trimmed-median2
1324 + - trimmed-median3
1325 + - trimmed-median5
1326 + - trimmed-median10
1327 + - trimmed-median15
1328 + - trimmed-median20
1329 + - trimmed-median25
1330 + default: average
1331 + dataTimeGroup2:
1332 + name: time_group
1333 + in: query
1334 + description: |
1335 + Time aggregation function. If multiple collected values are to be grouped in order to return fewer points, this parameters defines the method of grouping. If the `absolute` option is set, the values are turned positive before applying this calculation.
1336 + required: false
1337 + schema:
1338 + type: string
1339 + enum:
1340 + - min
1341 + - max
1342 + - avg
1343 + - average
1344 + - median
1345 + - stddev
1346 + - sum
1347 + - incremental-sum
1348 + - ses
1349 + - des
1350 + - cv
1351 + - countif
1352 + - percentile
1353 + - percentile25
1354 + - percentile50
1355 + - percentile75
1356 + - percentile80
1357 + - percentile90
1358 + - percentile95
1359 + - percentile97
1360 + - percentile98
1361 + - percentile99
1362 + - trimmed-mean
1363 + - trimmed-mean1
1364 + - trimmed-mean2
1365 + - trimmed-mean3
1366 + - trimmed-mean5
1367 + - trimmed-mean10
1368 + - trimmed-mean15
1369 + - trimmed-mean20
1370 + - trimmed-mean25
1371 + - trimmed-median
1372 + - trimmed-median1
1373 + - trimmed-median2
1374 + - trimmed-median3
1375 + - trimmed-median5
1376 + - trimmed-median10
1377 + - trimmed-median15
1378 + - trimmed-median20
1379 + - trimmed-median25
1380 + default: average
1381 + dataTimeGroupOptions1:
1382 + name: group_options
1383 + in: query
1384 + description: |
1385 + When the time grouping function supports additional parameters, this field can be used to pass them to it. Currently `countif`, `trimmed-mean`, `trimmed-median` and `percentile` support this. For `countif` the string may start with `<`, `<=`, `<:`, `<>`, `!=`, `>`, `>=`, `>:`. For all others just a number is expected.
1386 + required: false
1387 + schema:
1388 + type: string
1389 + dataTimeGroupOptions2:
1390 + name: time_group_options
1391 + in: query
1392 + description: |
1393 + When the time grouping function supports additional parameters, this field can be used to pass them to it. Currently `countif`, `trimmed-mean`, `trimmed-median` and `percentile` support this. For `countif` the string may start with `<`, `<=`, `<:`, `<>`, `!=`, `>`, `>=`, `>:`. For all others just a number is expected.
1394 + required: false
1395 + schema:
1396 + type: string
1397 + dataTimeResampling1:
1398 + name: gtime
1399 + in: query
1400 + description: |
1401 + The grouping number of seconds. This is used in conjunction with group=average to change the units of metrics (ie when the data is per-second, setting gtime=60 will turn them to per-minute).
1402 + required: false
1403 + allowEmptyValue: false
1404 + schema:
1405 + type: number
1406 + format: integer
1407 + default: 0
1408 + dataTimeResampling2:
1409 + name: time_resampling
1410 + in: query
1411 + description: |
1412 + For incremental values that are "per second", this value is used to resample them to "per minute` (60) or "per hour" (3600). It can only be used in conjunction with group=average.
1413 + required: false
1414 + schema:
1415 + type: number
1416 + format: integer
1417 + default: 0
1418 + timeoutMS:
1419 + name: timeout
1420 + in: query
1421 + description: |
1422 + Specify a timeout value in milliseconds after which the agent will abort the query and return a 503 error. A value of 0 indicates no timeout.
1423 + required: false
1424 + schema:
1425 + type: number
1426 + format: integer
1427 + default: 0
1428 + timeoutSecs:
1429 + name: timeout
1430 + in: query
1431 + description: |
1432 + Specify a timeout value in seconds after which the agent will abort the query and return a 504 error. A value of 0 indicates no timeout, but some endpoints, like `weights`, do not accept infinite timeouts (they have a predefined default), so to disable the timeout it must be set to a really high value.
1433 + required: false
1434 + schema:
1435 + type: number
1436 + format: integer
1437 + default: 0
1438 + before:
1439 + name: before
1440 + in: query
1441 + description: |
1442 + `after` and `before` define the time-frame of a query. `before` can be a negative number of seconds, up to 3 years (-94608000), relative to current clock. If not set, it is assumed to be the current clock time. When `before` is positive, it is assumed to be a unix epoch timestamp. When non-data endpoints support the `after` and `before`, they use the time-frame to limit their response for objects having data retention within the time-frame given.
1443 + required: false
1444 + schema:
1445 + type: integer
1446 + default: 0
1447 + after:
1448 + name: after
1449 + in: query
1450 + description: |
1451 + `after` and `before` define the time-frame of a query. `after` can be a negative number of seconds, up to 3 years (-94608000), relative to `before`. If not set, it is usually assumed to be -600. When non-data endpoints support the `after` and `before`, they use the time-frame to limit their response for objects having data retention within the time-frame given.
1452 + required: false
1453 + schema:
1454 + type: integer
1455 + default: -600
1456 + baselineBefore:
1457 + name: baseline_before
1458 + in: query
1459 + description: |
1460 + `baseline_after` and `baseline_before` define the baseline time-frame of a comparative query. `baseline_before` can be a negative number of seconds, up to 3 years (-94608000), relative to current clock. If not set, it is assumed to be the current clock time. When `baseline_before` is positive, it is assumed to be a unix epoch timestamp.
1461 + required: false
1462 + schema:
1463 + type: integer
1464 + default: 0
1465 + baselineAfter:
1466 + name: baseline_after
1467 + in: query
1468 + description: |
1469 + `baseline_after` and `baseline_before` define the baseline time-frame of a comparative query. `baseline_after` can be a negative number of seconds, up to 3 years (-94608000), relative to `baseline_before`. If not set, it is usually assumed to be -300.
1470 + required: false
1471 + schema:
1472 + type: integer
1473 + default: -600
1474 + points:
1475 + name: points
1476 + in: query
1477 + description: |
1478 + The number of points to be returned. If not given, or it is <= 0, or it is bigger than the points stored in the database for the given duration, all the available collected values for the given duration will be returned. For `weights` endpoints that do statistical analysis, the `points` define the detail of this analysis (the default is 500).
1479 + required: false
1480 + schema:
1481 + type: number
1482 + format: integer
1483 + default: 0
1484 + tier:
1485 + name: tier
1486 + in: query
1487 + description: |
1488 + Use only the given dbengine tier for executing the query. Setting this parameters automatically sets the option `selected-tier` for the query.
1489 + required: false
1490 + schema:
1491 + type: number
1492 + format: integer
1493 + callback:
1494 + name: callback
1495 + in: query
1496 + description: |
1497 + For JSONP responses, the callback function name.
1498 + required: false
1499 + schema:
1500 + type: string
1501 + filename:
1502 + name: filename
1503 + in: query
1504 + description: |
1505 + Add `Content-Disposition: attachment; filename=` header to the response, that will instruct the browser to save the response with the given filename."
1506 + required: false
1507 + schema:
1508 + type: string
1509 + tqx:
1510 + name: tqx
1511 + in: query
1512 + description: |
1513 + [Google Visualization API](https://developers.google.com/chart/interactive/docs/dev/implementing_data_source?hl=en) formatted parameter.
1514 + required: false
1515 + schema:
1516 + type: string
1517 + contextOptions1:
1518 + name: options
1519 + in: query
1520 + description: Options that affect data generation.
1521 + required: false
1522 + schema:
1523 + type: array
1524 + items:
1525 + type: string
1526 + enum:
1527 + - full
1528 + - all
1529 + - charts
1530 + - dimensions
1531 + - labels
1532 + - uuids
1533 + - queue
1534 + - flags
1535 + - deleted
1536 + - deepscan
1537 + chart:
1538 + name: chart
1539 + in: query
1540 + description: The id of the chart as returned by the `/api/v1/charts` call.
1541 + required: false
1542 + allowEmptyValue: false
1543 + schema:
1544 + type: string
1545 + format: as returned by `/api/v1/charts`
1546 + context:
1547 + name: context
1548 + in: query
1549 + description: The context of the chart as returned by the /charts call.
1550 + required: false
1551 + allowEmptyValue: false
1552 + schema:
1553 + type: string
1554 + format: as returned by /charts
1555 + dimension:
1556 + name: dimension
1557 + in: query
1558 + description: Zero, one or more dimension ids or names, as returned by the /chart
1559 + call, separated with comma or pipe. Netdata simple patterns are
1560 + supported.
1561 + required: false
1562 + allowEmptyValue: false
1563 + schema:
1564 + type: array
1565 + items:
1566 + type: string
1567 + format: as returned by /charts
1568 + dimensions:
1569 + name: dimensions
1570 + in: query
1571 + description: a simple pattern matching dimensions (use comma or pipe as separator)
1572 + required: false
1573 + allowEmptyValue: true
1574 + schema:
1575 + type: string
1576 + chart_label_key:
1577 + name: chart_label_key
1578 + in: query
1579 + description: |
1580 + Specify the chart label keys that need to match for context queries as comma separated values. At least one matching key is needed to match the corresponding chart.
1581 + required: false
1582 + allowEmptyValue: false
1583 + schema:
1584 + type: string
1585 + format: key1,key2,key3
1586 + chart_labels_filter:
1587 + name: chart_labels_filter
1588 + in: query
1589 + description: |
1590 + Specify the chart label keys and values to match for context queries. All keys/values need to match for the chart to be included in the query. The labels are specified as key1:value1,key2:value2
1591 + required: false
1592 + allowEmptyValue: false
1593 + schema:
1594 + type: string
1595 + format: key1:value1,key2:value2,key3:value3
1596 + weightMethods:
1597 + name: method
1598 + in: query
1599 + description: The weighting / scoring algorithm.
1600 + required: false
1601 + schema:
1602 + type: string
1603 + enum:
1604 + - ks2
1605 + - volume
1606 + - anomaly-rate
1607 + - value
1608 schemas:
1609 info:
1610 type: object
@@ -2181,10 +1864,8 @@ components:
1864 amount of time is kept in the round robin database.
1865 dimensions:
1866 type: object
2184 - description: "An object containing all the chart dimensions available for the
2185 - chart. This is used as an indexed array. For each pair in the
2186 - dictionary: the key is the id of the dimension and the value is a
2187 - dictionary containing the name."
1867 + description: |
1868 + An object containing all the chart dimensions available for the chart. This is used as an indexed array. For each pair in the dictionary: the key is the id of the dimension and the value is a dictionary containing the name."
1869 additionalProperties:
1870 type: object
1871 properties:
@@ -2322,119 +2003,17 @@ components:
2003 varname2:
2004 type: number
2005 format: float
2325 - data:
2326 - type: object
2327 - discriminator:
2328 - propertyName: format
2329 - description: Response will contain the appropriate subtype, e.g. data_json depending
2330 - on the requested format.
2331 - properties:
2332 - api:
2333 - type: number
2334 - description: The API version this conforms to, currently 1.
2335 - id:
2336 - type: string
2337 - description: The unique id of the chart.
2338 - name:
2339 - type: string
2340 - description: The name of the chart.
2341 - update_every:
2342 - type: number
2343 - description: The update frequency of this chart, in seconds. One value every this
2344 - amount of time is kept in the round robin database (independently of
2345 - the current view).
2346 - view_update_every:
2347 - type: number
2348 - description: The current view appropriate update frequency of this chart, in
2349 - seconds. There is no point to request chart refreshes, using the
2350 - same settings, more frequently than this.
2351 - first_entry:
2352 - type: number
2353 - description: The UNIX timestamp of the first entry (the oldest) in the round
2354 - robin database (independently of the current view).
2355 - last_entry:
2356 - type: number
2357 - description: The UNIX timestamp of the latest entry in the round robin database
2358 - (independently of the current view).
2359 - after:
2360 - type: number
2361 - description: The UNIX timestamp of the first entry (the oldest) returned in this
2362 - response.
2363 - before:
2364 - type: number
2365 - description: The UNIX timestamp of the latest entry returned in this response.
2366 - min:
2367 - type: number
2368 - description: The minimum value returned in the current view. This can be used to
2369 - size the y-series of the chart.
2370 - max:
2371 - type: number
2372 - description: The maximum value returned in the current view. This can be used to
2373 - size the y-series of the chart.
2374 - dimension_names:
2375 - description: The dimension names of the chart as returned in the current view.
2376 - type: array
2377 - items:
2378 - type: string
2379 - dimension_ids:
2380 - description: The dimension IDs of the chart as returned in the current view.
2381 - type: array
2382 - items:
2383 - type: string
2384 - latest_values:
2385 - description: The latest values collected for the chart (independently of the
2386 - current view).
2387 - type: array
2388 - items:
2389 - type: string
2390 - view_latest_values:
2391 - description: The latest values returned with this response.
2392 - type: array
2393 - items:
2394 - type: string
2395 - dimensions:
2396 - type: number
2397 - description: The number of dimensions returned.
2398 - points:
2399 - type: number
2400 - description: The number of rows / points returned.
2401 - format:
2402 - type: string
2403 - description: The format of the result returned.
2404 - chart_variables:
2405 - type: object
2406 - additionalProperties:
2407 - $ref: "#/components/schemas/chart_variables"
2408 - data_json2:
2006 + jsonwrap2:
2007 description: |
2008 Data response with `format=json2`
2009 type: object
2010 properties:
2011 + api:
2012 + $ref: '#/components/schemas/api'
2013 + agents:
2014 + $ref: '#/components/schemas/agents'
2015 versions:
2414 - description: |
2415 - Hashes that allow the caller to detect important database changes of Netdata agents.
2416 - type: object
2417 - properties:
2418 - nodes_hard_hash:
2419 - description: |
2420 - An auto-increment value that reflects the number of changes to the number of nodes maintained by the server. Everytime a node is added or removed, this number gets incremented.
2421 - type: integer
2422 - contexts_hard_hash:
2423 - description: |
2424 - An auto-increment value that reflects the number of changes to the number of contexts maintained by the server. Everytime a context is added or removed, this number gets incremented.
2425 - type: integer
2426 - contexts_soft_hash:
2427 - description: |
2428 - An auto-increment value that reflects the number of changes to the queue that sends contexts updates to Netdata Cloud. Everytime the contents of a context are updated, this number gets incremented.
2429 - type: integer
2430 - alerts_hard_hash:
2431 - description: |
2432 - An auto-increment value that reflects the number of changes to the number of alerts. Everytime an alert is added or removed, this number gets incremented.
2433 - type: integer
2434 - alerts_soft_hash:
2435 - description: |
2436 - An auto-increment value that reflects the number of alerts transitions. Everytime an alert transitions to a new state, this number gets incremented.
2437 - type: integer
2016 + $ref: '#/components/schemas/versions'
2017 summary:
2018 description: |
2019 Summarized information about nodes, contexts, instances, labels, alerts, and dimensions. The items returned are determined by the scope of the query only, however the statistical data in them are influenced by the filters of the query. Using this information the dashboard allows users to slice and dice the data by filtering and grouping.
@@ -2443,34 +2022,7 @@ components:
2022 nodes:
2023 type: array
2024 items:
2446 - type: object
2447 - description: |
2448 - An object describing a node. `is` stands for instances, `ds` for dimensions, `al` for alerts, `sts` for statistics.
2449 - properties:
2450 - ni:
2451 - description: the node index id, a number that uniquely identifies this node for this query.
2452 - type: integer
2453 - mg:
2454 - description: the machine guid of the node.
2455 - type: string
2456 - format: UUID
2457 - nd:
2458 - description: the node id of the node.
2459 - type: string
2460 - format: UUID
2461 - nm:
2462 - description: the name (hostname) of the node.
2463 - type: string
2464 - is:
2465 - $ref: "#/components/schemas/data_json2_items_count"
2466 - ds:
2467 - $ref: "#/components/schemas/data_json2_items_count"
2468 - al:
2469 - $ref: "#/components/schemas/data_json2_alerts_count"
2470 - sts:
2471 - oneOf:
2472 - - $ref: "#/components/schemas/data_json2_sts"
2473 - - $ref: "#/components/schemas/data_json2_sts_raw"
2025 + $ref: '#/components/schemas/nodeWithDataStatistics'
2026 contexts:
2027 type: array
2028 items:
@@ -2482,15 +2034,15 @@ components:
2034 description: the context id.
2035 type: string
2036 is:
2485 - $ref: "#/components/schemas/data_json2_items_count"
2037 + $ref: "#/components/schemas/jsonwrap2_items_count"
2038 ds:
2487 - $ref: "#/components/schemas/data_json2_items_count"
2039 + $ref: "#/components/schemas/jsonwrap2_items_count"
2040 al:
2489 - $ref: "#/components/schemas/data_json2_alerts_count"
2041 + $ref: "#/components/schemas/jsonwrap2_alerts_count"
2042 sts:
2043 oneOf:
2492 - - $ref: "#/components/schemas/data_json2_sts"
2493 - - $ref: "#/components/schemas/data_json2_sts_raw"
2044 + - $ref: "#/components/schemas/jsonwrap2_sts"
2045 + - $ref: "#/components/schemas/jsonwrap2_sts_raw"
2046 instances:
2047 type: array
2048 items:
@@ -2507,13 +2059,13 @@ components:
2059 ni:
2060 description: the node index id this instance belongs to. The UI uses this to compone the fully qualified name of the instance, using the node hostname to present it to users and its machine guid to add it to filters.
2061 ds:
2510 - $ref: "#/components/schemas/data_json2_items_count"
2062 + $ref: "#/components/schemas/jsonwrap2_items_count"
2063 al:
2512 - $ref: "#/components/schemas/data_json2_alerts_count"
2064 + $ref: "#/components/schemas/jsonwrap2_alerts_count"
2065 sts:
2066 oneOf:
2515 - - $ref: "#/components/schemas/data_json2_sts"
2516 - - $ref: "#/components/schemas/data_json2_sts_raw"
2067 + - $ref: "#/components/schemas/jsonwrap2_sts"
2068 + - $ref: "#/components/schemas/jsonwrap2_sts_raw"
2069 dimensions:
2070 type: array
2071 items:
@@ -2528,11 +2080,11 @@ components:
2080 description: the name of the dimension (may be absent when it is the same with the id)
2081 type: string
2082 ds:
2531 - $ref: "#/components/schemas/data_json2_items_count"
2083 + $ref: "#/components/schemas/jsonwrap2_items_count"
2084 sts:
2085 oneOf:
2534 - - $ref: "#/components/schemas/data_json2_sts"
2535 - - $ref: "#/components/schemas/data_json2_sts_raw"
2086 + - $ref: "#/components/schemas/jsonwrap2_sts"
2087 + - $ref: "#/components/schemas/jsonwrap2_sts_raw"
2088 labels:
2089 type: array
2090 items:
@@ -2544,11 +2096,11 @@ components:
2096 description: the key of the label.
2097 type: string
2098 ds:
2547 - $ref: "#/components/schemas/data_json2_items_count"
2099 + $ref: "#/components/schemas/jsonwrap2_items_count"
2100 sts:
2101 oneOf:
2550 - - $ref: "#/components/schemas/data_json2_sts"
2551 - - $ref: "#/components/schemas/data_json2_sts_raw"
2102 + - $ref: "#/components/schemas/jsonwrap2_sts"
2103 + - $ref: "#/components/schemas/jsonwrap2_sts_raw"
2104 vl:
2105 description: |
2106 An array of values for this key.
@@ -2560,32 +2112,32 @@ components:
2112 description: The value string
2113 type: string
2114 ds:
2563 - $ref: "#/components/schemas/data_json2_items_count"
2115 + $ref: "#/components/schemas/jsonwrap2_items_count"
2116 sts:
2117 oneOf:
2566 - - $ref: "#/components/schemas/data_json2_sts"
2567 - - $ref: "#/components/schemas/data_json2_sts_raw"
2118 + - $ref: "#/components/schemas/jsonwrap2_sts"
2119 + - $ref: "#/components/schemas/jsonwrap2_sts_raw"
2120 alerts:
2121 description: |
2122 An array of all the unique alerts running, grouped by alert name (`nm` is available here)
2123 type: array
2124 items:
2573 - $ref: "#/components/schemas/data_json2_alerts_count"
2125 + $ref: "#/components/schemas/jsonwrap2_alerts_count"
2126 totals:
2127 type: object
2128 properties:
2129 nodes:
2578 - $ref: "#/components/schemas/data_json2_items_count"
2130 + $ref: "#/components/schemas/jsonwrap2_items_count"
2131 contexts:
2580 - $ref: "#/components/schemas/data_json2_items_count"
2132 + $ref: "#/components/schemas/jsonwrap2_items_count"
2133 instances:
2582 - $ref: "#/components/schemas/data_json2_items_count"
2134 + $ref: "#/components/schemas/jsonwrap2_items_count"
2135 dimensions:
2584 - $ref: "#/components/schemas/data_json2_items_count"
2136 + $ref: "#/components/schemas/jsonwrap2_items_count"
2137 label_keys:
2586 - $ref: "#/components/schemas/data_json2_items_count"
2138 + $ref: "#/components/schemas/jsonwrap2_items_count"
2139 label_key_values:
2588 - $ref: "#/components/schemas/data_json2_items_count"
2140 + $ref: "#/components/schemas/jsonwrap2_items_count"
2141 functions:
2142 type: array
2143 items:
@@ -2648,17 +2200,17 @@ components:
2200 type: string
2201 format:
2202 description: |
2651 - The format the `result` top level member has.
2203 + The format the `result` top level member has. Available on when `debug` flag is set.
2204 type: string
2205 options:
2206 description: |
2655 - An array presenting all the options given to the query.
2207 + An array presenting all the options given to the query. Available on when `debug` flag is set.
2208 type: array
2209 items:
2210 type: string
2211 time_group:
2212 description: |
2661 - The same as the parameter `time_group`.
2213 + The same as the parameter `time_group`. Available on when `debug` flag is set.
2214 type: string
2215 after:
2216 description: |
@@ -2672,6 +2224,7 @@ components:
2224 description: |
2225 Information related to trimming of the last few points of the `result`, that was required to remove (increasing) partial data.
2226 Trimming is disabled when the `raw` option is given to the query.
2227 + This object is available only when the `debug` flag is set.
2228 type: object
2229 properties:
2230 max_update_every:
@@ -2690,7 +2243,7 @@ components:
2243 If this timestamp is greater or equal to `view.before`, there is no trimming.
2244 points:
2245 description: |
2693 - The number of points in `result`.
2246 + The number of points in `result`. Available only when `raw` is given.
2247 type: integer
2248 units:
2249 description: |
@@ -2760,34 +2313,83 @@ components:
2313 type: array
2314 items:
2315 type: integer
2763 - view_minimum_values:
2316 + min:
2317 description: |
2318 An array of the minimum value of each dimension across the entire query.
2319 type: array
2320 items:
2321 type: number
2769 - view_maximum_values:
2322 + max:
2323 description: |
2324 An array of the maximum value of each dimension across the entire query.
2325 type: array
2326 items:
2327 type: number
2775 - view_average_values:
2328 + avg:
2329 description: |
2330 An array of the average value of each dimension across the entire query.
2331 type: array
2332 items:
2333 type: number
2781 - view_latest_values:
2782 - description: |
2783 - An array of the latest value of each dimension, included in this query.
2784 - type: array
2785 - items:
2786 - type: number
2787 - count:
2334 + sts:
2335 description: |
2789 - The number of dimensions in the `result`.
2790 - type: integer
2336 + Statistics about the data collection points used for each dimension.
2337 + type: object
2338 + properties:
2339 + min:
2340 + description: |
2341 + An array with the minimum data collection value aggregated to each dimension.
2342 + type: array
2343 + items:
2344 + type: number
2345 + max:
2346 + description: |
2347 + An array with the maximum data collection value aggregated to each dimension.
2348 + type: array
2349 + items:
2350 + type: number
2351 + sum:
2352 + description: |
2353 + An array with the sum of all data collection values aggregated to each dimension.
2354 + This member exists only when option `raw` is given.
2355 + type: array
2356 + items:
2357 + type: number
2358 + cnt:
2359 + description: |
2360 + An array with the count of the data collection values aggregated to each dimension.
2361 + This member exists only when option `raw` is given.
2362 + type: array
2363 + items:
2364 + type: number
2365 + ars:
2366 + description: |
2367 + An array with the anomaly rate sum of all data collection values aggregated to each dimension.
2368 + This member exists only when option `raw` is given.
2369 + type: array
2370 + items:
2371 + type: number
2372 + avg:
2373 + description: |
2374 + An array with the average of all data collection values aggregated to each dimension.
2375 + This member exists only when option `raw` is not given. When option `raw` is given, the average can be calculated by dividing `sum` with `cnt`.
2376 + type: array
2377 + items:
2378 + type: number
2379 + arp:
2380 + description: |
2381 + An array with the average anomaly rate of all data collection values aggregated to each dimension.
2382 + This member exists only when option `raw` is not given. When option `raw` is given, the average can be calculated by dividing `ars` with `cnt`.
2383 + type: array
2384 + items:
2385 + type: number
2386 + con:
2387 + description: |
2388 + An array with the contribution % of all data collection values aggregated to each dimension.
2389 + This member exists only when option `raw` is not given. When option `raw` is given, the contribution can be calculated by multiplying `ABS(sum)` with 100.0 and dividing it with the total of the ABS(sum) of all dimensions.
2390 + type: array
2391 + items:
2392 + type: number
2393 labels:
2394 description: |
2395 The labels associated with each dimension in the query.
@@ -2813,51 +2415,10 @@ components:
2415 The maximum value of all points included in the `result`.
2416 type: number
2417 result:
2816 - description: |
2817 - The result of the query.
2818 - The format explained here is `json2`.
2819 - type: object
2820 - properties:
2821 - labels:
2822 - description: |
2823 - The IDs of the dimensions returned. The first is always `time`.
2824 - type: array
2825 - items:
2826 - type: string
2827 - point:
2828 - description: |
2829 - The format of each point returned.
2830 - type: object
2831 - properties:
2832 - value:
2833 - description: |
2834 - The index of the value in each point.
2835 - type: integer
2836 - ar:
2837 - description: |
2838 - The index of the anomaly rate in each point.
2839 - type: integer
2840 - pa:
2841 - description: |
2842 - The index of the point annotations in each point.
2843 - This is a bitmap. `EMPTY = 1`, `RESET = 2`, `PARTIAL = 4`.
2844 - `EMPTY` means the point has no value.
2845 - `RESET` means that at least one metric aggregated experienced an overflow (a counter that wrapped).
2846 - `PARTIAL` means that this point should have more metrics aggregated into it, but not all metrics had data.
2847 - type: integer
2848 - count:
2849 - description: |
2850 - The number of metrics aggregated into this point. This exists only when the option `raw` is given to the query.
2851 - type: integer
2852 - data:
2853 - type: array
2854 - items:
2855 - allOf:
2856 - - type: integer
2857 - - type: array
2418 + $ref: '#/components/schemas/data_json_formats2'
2419 timings:
2420 type: object
2860 - data_json2_sts:
2421 + jsonwrap2_sts:
2422 description: |
2423 Statistical values
2424 type: object
@@ -2877,7 +2438,7 @@ components:
2438 con:
2439 description: The contribution percentage of all the metrics aggregated
2440 type: number
2880 - data_json2_sts_raw:
2441 + jsonwrap2_sts_raw:
2442 description: |
2443 Statistical values when `raw` option is given.
2444 type: object
@@ -2900,7 +2461,7 @@ components:
2461 cnt:
2462 description: The count of all metrics aggregated
2463 type: integer
2903 - data_json2_items_count:
2464 + jsonwrap2_items_count:
2465 description: |
2466 Depending on the placement of this object, `items` may be `nodes`, `contexts`, `instances`, `dimensions`, `label keys`, `label key-value pairs`. Furthermore, if the whole object is missing it should be assumed that all its members are zero.
2467 type: object
@@ -2917,7 +2478,7 @@ components:
2478 fl:
2479 description: The number of items (from `selected`) that `failed` to be queried. If absent it is zero.
2480 type: integer
2920 - data_json2_alerts_count:
2481 + jsonwrap2_alerts_count:
2482 description: |
2483 Counters about alert statuses. If this object is missing, it is assumed that all its members are zero.
2484 type: object
@@ -2938,99 +2499,365 @@ components:
2499 description: |
2500 The number of alerts that are not CLEAR, WARNING, CRITICAL (so, they are "other"). If absent, it is zero.
2501 type: integer
2941 - data_json:
2942 - description: Data response in json format.
2502 + api:
2503 + description: The version of the API used.
2504 + type: integer
2505 + agents:
2506 + description: |
2507 + An array of agent definitions consulted to compose this response.
2508 + type: array
2509 + items:
2510 + type: object
2511 + properties:
2512 + mg:
2513 + description: The agent machine GUID.
2514 + type: string
2515 + format: uuid
2516 + nd:
2517 + description: The agent cloud node ID.
2518 + type: string
2519 + format: uuid
2520 + nm:
2521 + description: The agent hostname.
2522 + type: string
2523 + ai:
2524 + description: The agent index ID for this agent, in this response.
2525 + type: integer
2526 + now:
2527 + description: The current unix epoch timestamp of this agent.
2528 + type: integer
2529 + versions:
2530 + description: |
2531 + Hashes that allow the caller to detect important database changes of Netdata agents.
2532 + type: object
2533 + properties:
2534 + nodes_hard_hash:
2535 + description: |
2536 + An auto-increment value that reflects the number of changes to the number of nodes maintained by the server. Everytime a node is added or removed, this number gets incremented.
2537 + type: integer
2538 + contexts_hard_hash:
2539 + description: |
2540 + An auto-increment value that reflects the number of changes to the number of contexts maintained by the server. Everytime a context is added or removed, this number gets incremented.
2541 + type: integer
2542 + contexts_soft_hash:
2543 + description: |
2544 + An auto-increment value that reflects the number of changes to the queue that sends contexts updates to Netdata Cloud. Everytime the contents of a context are updated, this number gets incremented.
2545 + type: integer
2546 + alerts_hard_hash:
2547 + description: |
2548 + An auto-increment value that reflects the number of changes to the number of alerts. Everytime an alert is added or removed, this number gets incremented.
2549 + type: integer
2550 + alerts_soft_hash:
2551 + description: |
2552 + An auto-increment value that reflects the number of alerts transitions. Everytime an alert transitions to a new state, this number gets incremented.
2553 + type: integer
2554 + nodeBasic:
2555 + type: object
2556 + description: Basic information about a node.
2557 + required:
2558 + - ni
2559 + - st
2560 + properties:
2561 + mg:
2562 + description: The machine guid of the node. May not be available if the request is served by the Netdata Cloud.
2563 + type: string
2564 + format: UUID
2565 + nd:
2566 + description: The node id of the node. May not be available if the node is not registered to Netdata Cloud.
2567 + type: string
2568 + format: UUID
2569 + nm:
2570 + description: The name (hostname) of the node.
2571 + type: string
2572 + ni:
2573 + description: The node index id, a number that uniquely identifies this node for this query.
2574 + type: integer
2575 + st:
2576 + description: Status information about the communication with this node.
2577 + type: object
2578 + properties:
2579 + ai:
2580 + description: The agent index id that has been contacted for this node.
2581 + type: integer
2582 + code:
2583 + description: The HTTP response code of the response for this node. When working directly with an agent, this is always 200. If the `code` is missing, it should be assumed to be 200.
2584 + type: integer
2585 + msg:
2586 + description: A human readable description of the error, if any. If `msg` is missing, or is the empty string `""` or is `null`, there is no description associated with the current status.
2587 + type: string
2588 + ms:
2589 + description: The time in milliseconds this node took to respond, or if the local agent responded for this node, the time it needed to execute the query. If `ms` is missing, the time that was required to query this node is unknown.
2590 + type: number
2591 + nodeWithDataStatistics:
2592 allOf:
2944 - - $ref: "#/components/schemas/data"
2945 - - properties:
2946 - result:
2947 - type: object
2948 - properties:
2949 - labels:
2950 - description: The dimensions retrieved from the chart.
2951 - type: array
2952 - items:
2953 - type: string
2954 - data:
2955 - description: |
2956 - The data requested, one element per sample with each element containing the values of the dimensions described in the labels value.
2957 - type: array
2958 - items:
2959 - type: number
2960 - description: The result requested, in the format requested.
2961 - data_flat:
2962 - description: Data response in csv / tsv / tsv-excel / ssv / ssv-comma / markdown /
2963 - html formats.
2593 + - $ref: '#/components/schemas/nodeBasic'
2594 + - type: object
2595 + description: |
2596 + `is` stands for instances, `ds` for dimensions, `al` for alerts, `sts` for statistics.
2597 + properties:
2598 + is:
2599 + $ref: "#/components/schemas/jsonwrap2_items_count"
2600 + ds:
2601 + $ref: "#/components/schemas/jsonwrap2_items_count"
2602 + al:
2603 + $ref: "#/components/schemas/jsonwrap2_alerts_count"
2604 + sts:
2605 + oneOf:
2606 + - $ref: "#/components/schemas/jsonwrap2_sts"
2607 + - $ref: "#/components/schemas/jsonwrap2_sts_raw"
2608 + nodeFull:
2609 allOf:
2965 - - $ref: "#/components/schemas/data"
2966 - - properties:
2967 - result:
2610 + - $ref: '#/components/schemas/nodeBasic'
2611 + - type: object
2612 + properties:
2613 + version:
2614 + description: The version of the Netdata Agent the node runs.
2615 type: string
2616 + hops:
2617 + description: How many hops away from the origin node, the queried one is. 0 means the agent itself is the origin node.
2618 + type: integer
2619 + state:
2620 + description: The current state of the node on this agent.
2621 + type: string
2622 + enum:
2623 + - reachable
2624 + - stale
2625 + - offline
2626 + context2Basic:
2627 + type: object
2628 + properties:
2629 + family:
2630 + type: string
2631 + priority:
2632 + type: integer
2633 + first_entry:
2634 + type: integer
2635 + last_entry:
2636 + type: integer
2637 + live:
2638 + type: boolean
2639 + contexts2:
2640 + description: |
2641 + `/api/v2/contexts` and `/api/v2/q` response about multi-node contexts hosted by a Netdata agent.
2642 + type: object
2643 + properties:
2644 + api:
2645 + $ref: '#/components/schemas/api'
2646 + agents:
2647 + $ref: '#/components/schemas/agents'
2648 + versions:
2649 + $ref: '#/components/schemas/versions'
2650 + contexts:
2651 + additionalProperties:
2652 + $ref: '#/components/schemas/context2Basic'
2653 + jsonwrap1:
2654 + type: object
2655 + discriminator:
2656 + propertyName: format
2657 + description: Response will contain the appropriate subtype, e.g. data_json depending
2658 + on the requested format.
2659 + properties:
2660 + api:
2661 + type: number
2662 + description: The API version this conforms to.
2663 + id:
2664 + type: string
2665 + description: The unique id of the chart.
2666 + name:
2667 + type: string
2668 + description: The name of the chart.
2669 + update_every:
2670 + type: number
2671 + description: The update frequency of this chart, in seconds. One value every this
2672 + amount of time is kept in the round robin database (independently of
2673 + the current view).
2674 + view_update_every:
2675 + type: number
2676 + description: The current view appropriate update frequency of this chart, in
2677 + seconds. There is no point to request chart refreshes, using the
2678 + same settings, more frequently than this.
2679 + first_entry:
2680 + type: number
2681 + description: The UNIX timestamp of the first entry (the oldest) in the round
2682 + robin database (independently of the current view).
2683 + last_entry:
2684 + type: number
2685 + description: The UNIX timestamp of the latest entry in the round robin database
2686 + (independently of the current view).
2687 + after:
2688 + type: number
2689 + description: The UNIX timestamp of the first entry (the oldest) returned in this
2690 + response.
2691 + before:
2692 + type: number
2693 + description: The UNIX timestamp of the latest entry returned in this response.
2694 + min:
2695 + type: number
2696 + description: The minimum value returned in the current view. This can be used to
2697 + size the y-series of the chart.
2698 + max:
2699 + type: number
2700 + description: The maximum value returned in the current view. This can be used to
2701 + size the y-series of the chart.
2702 + dimension_names:
2703 + description: The dimension names of the chart as returned in the current view.
2704 + type: array
2705 + items:
2706 + type: string
2707 + dimension_ids:
2708 + description: The dimension IDs of the chart as returned in the current view.
2709 + type: array
2710 + items:
2711 + type: string
2712 + latest_values:
2713 + description: The latest values collected for the chart (independently of the
2714 + current view).
2715 + type: array
2716 + items:
2717 + type: string
2718 + view_latest_values:
2719 + description: The latest values returned with this response.
2720 + type: array
2721 + items:
2722 + type: string
2723 + dimensions:
2724 + type: number
2725 + description: The number of dimensions returned.
2726 + points:
2727 + type: number
2728 + description: The number of rows / points returned.
2729 + format:
2730 + type: string
2731 + description: The format of the result returned.
2732 + chart_variables:
2733 + type: object
2734 + additionalProperties:
2735 + $ref: '#/components/schemas/chart_variables'
2736 + result:
2737 + $ref: '#/components/schemas/data_json_formats1'
2738 + data_json_formats1:
2739 + description: |
2740 + Depending on the `format` given to a data query, any of the following may be returned.
2741 + oneOf:
2742 + - $ref: '#/components/schemas/data_json'
2743 + - $ref: '#/components/schemas/data_datatable'
2744 + - $ref: '#/components/schemas/data_csvjsonarray'
2745 + - $ref: '#/components/schemas/data_array'
2746 + - $ref: '#/components/schemas/data_txt'
2747 + data_json_formats2:
2748 + description: |
2749 + Depending on the `format` given to a data query, any of the following may be returned.
2750 + oneOf:
2751 + - $ref: '#/components/schemas/data_json2'
2752 + - $ref: '#/components/schemas/data_json_formats1'
2753 + data_json2:
2754 + type: object
2755 + properties:
2756 + labels:
2757 + description: |
2758 + The IDs of the dimensions returned. The first is always `time`.
2759 + type: array
2760 + items:
2761 + type: string
2762 + point:
2763 + description: |
2764 + The format of each point returned.
2765 + type: object
2766 + properties:
2767 + value:
2768 + description: |
2769 + The index of the value in each point.
2770 + type: integer
2771 + arp:
2772 + description: |
2773 + The index of the anomaly rate in each point.
2774 + type: integer
2775 + pa:
2776 + description: |
2777 + The index of the point annotations in each point.
2778 + This is a bitmap. `EMPTY = 1`, `RESET = 2`, `PARTIAL = 4`.
2779 + `EMPTY` means the point has no value.
2780 + `RESET` means that at least one metric aggregated experienced an overflow (a counter that wrapped).
2781 + `PARTIAL` means that this point should have more metrics aggregated into it, but not all metrics had data.
2782 + type: integer
2783 + count:
2784 + description: |
2785 + The number of metrics aggregated into this point. This exists only when the option `raw` is given to the query.
2786 + type: integer
2787 + data:
2788 + type: array
2789 + items:
2790 + allOf:
2791 + - type: integer
2792 + - type: array
2793 + data_json:
2794 + description: Data response in `json` format.
2795 + type: object
2796 + properties:
2797 + labels:
2798 + description: The dimensions retrieved from the chart.
2799 + type: array
2800 + items:
2801 + type: string
2802 + data:
2803 + description: |
2804 + The data requested, one element per sample with each element containing the values of the dimensions described in the labels value.
2805 + type: array
2806 + items:
2807 + type: number
2808 + data_txt:
2809 + description: |
2810 + Data response in `csv`, `tsv`, `tsv-excel`, `ssv`, `ssv-comma`, `markdown`, `html` formats.
2811 + type: string
2812 data_array:
2970 - description: Data response in array format.
2971 - allOf:
2972 - - $ref: "#/components/schemas/data"
2973 - - properties:
2974 - result:
2975 - type: array
2976 - items:
2977 - type: number
2813 + description: Data response in `array` format.
2814 + type: array
2815 + items:
2816 + type: number
2817 data_csvjsonarray:
2979 - description: Data response in csvjsonarray format.
2980 - allOf:
2981 - - $ref: "#/components/schemas/data"
2982 - - properties:
2983 - result:
2984 - description: The first inner array contains strings showing the labels of
2985 - each column, each subsequent array contains the values for each
2986 - point in time.
2987 - type: array
2988 - items:
2989 - type: array
2990 - items: {}
2818 + description: |
2819 + The first inner array contains strings showing the labels of each column, each subsequent array contains the values for each point in time.
2820 + type: array
2821 + items:
2822 + type: array
2823 + items: {}
2824 data_datatable:
2992 - description: Data response in datatable / datasource formats (suitable for Google
2993 - Charts).
2994 - allOf:
2995 - - $ref: "#/components/schemas/data"
2996 - - properties:
2997 - result:
2998 - type: object
2999 - properties:
3000 - cols:
3001 - type: array
3002 - items:
3003 - type: object
3004 - properties:
3005 - id:
3006 - description: Always empty - for future use.
3007 - label:
3008 - description: The dimension returned from the chart.
3009 - pattern:
3010 - description: Always empty - for future use.
3011 - type:
3012 - description: The type of data in the column / chart-dimension.
3013 - p:
3014 - description: Contains any annotations for the column.
3015 - required:
3016 - - id
3017 - - label
3018 - - pattern
3019 - - type
3020 - rows:
3021 - type: array
3022 - items:
3023 - type: object
3024 - properties:
3025 - c:
3026 - type: array
3027 - items:
3028 - properties:
3029 - v:
3030 - description: "Each value in the row is represented by an
3031 - object named `c` with five v fields: data, null,
3032 - null, 0, the value. This format is fixed by the
3033 - Google Charts API."
2825 + description: |
2826 + Data response in datatable / datasource formats (suitable for Google Charts).
2827 + type: object
2828 + properties:
2829 + cols:
2830 + type: array
2831 + items:
2832 + type: object
2833 + properties:
2834 + id:
2835 + description: Always empty - for future use.
2836 + label:
2837 + description: The dimension returned from the chart.
2838 + pattern:
2839 + description: Always empty - for future use.
2840 + type:
2841 + description: The type of data in the column / chart-dimension.
2842 + p:
2843 + description: Contains any annotations for the column.
2844 + required:
2845 + - id
2846 + - label
2847 + - pattern
2848 + - type
2849 + rows:
2850 + type: array
2851 + items:
2852 + type: object
2853 + properties:
2854 + c:
2855 + type: array
2856 + items:
2857 + properties:
2858 + v:
2859 + description: |
2860 + Each value in the row is represented by an object named `c` with five v fields: data, null, null, 0, the value. This format is fixed by the Google Charts API."
2861 alarms:
2862 type: object
2863 properties:
@@ -3275,9 +3102,8 @@ components:
3102 properties:
3103 aclk-available:
3104 type: string
3278 - description: "Describes whether this agent is capable of connection to the Cloud.
3279 - False means agent has been built without ACLK component either on purpose (user choice)
3280 - or due to missing dependency."
3105 + description: |
3106 + Describes whether this agent is capable of connection to the Cloud. False means agent has been built without ACLK component either on purpose (user choice) or due to missing dependency.
3107 aclk-version:
3108 type: integer
3109 description: Describes which ACLK version is currently used.
@@ -3385,6 +3211,8 @@ components:
3211 type: number
3212 dimension2-name:
3213 type: number
3214 + weights2:
3215 + type: object
3216 weights:
3217 type: object
3218 properties:
web/api/queries/query.c
+101 -153
@@ -772,7 +772,7 @@ static inline NETDATA_DOUBLE *UNUSED_FUNCTION(rrdr_line_values)(RRDR *r, long rr
772 return &r->v[ rrdr_line * r->d ];
773 }
774
775 -static inline long rrdr_line_init(RRDR *r, time_t t, long rrdr_line) {
775 +static inline long rrdr_line_init(RRDR *r __maybe_unused, time_t t __maybe_unused, long rrdr_line) {
776 rrdr_line++;
777
778 internal_fatal(rrdr_line >= (long)r->n,
@@ -1034,6 +1034,7 @@ typedef struct query_engine_ops {
1034 size_t group_points_non_zero;
1035 size_t group_points_added;
1036 STORAGE_POINT group_point; // aggregates min, max, sum, count, anomaly count for each group point
1037 + STORAGE_POINT query_point; // aggregates min, max, sum, count, anomaly count across the whole query
1038 RRDR_VALUE_FLAGS group_value_flags;
1039
1040 // statistics
@@ -1223,18 +1224,17 @@ static bool query_plan(QUERY_ENGINE_OPS *ops, time_t after_wanted, time_t before
1224
1225 // put our selected tier as the first plan
1226 size_t selected_tier;
1227 + bool switch_tiers = true;
1228
1227 - if(ops->r->view.options & RRDR_OPTION_SELECTED_TIER
1229 + if((ops->r->internal.qt->window.options & RRDR_OPTION_SELECTED_TIER)
1230 && ops->r->internal.qt->window.tier < storage_tiers
1231 && query_metric_is_valid_tier(qm, ops->r->internal.qt->window.tier)) {
1232 selected_tier = ops->r->internal.qt->window.tier;
1233 + switch_tiers = false;
1234 }
1235 else {
1236 selected_tier = query_metric_best_tier_for_timeframe(qm, after_wanted, before_wanted, points_wanted);
1237
1235 - if(ops->r->view.options & RRDR_OPTION_SELECTED_TIER)
1236 - ops->r->view.options &= ~RRDR_OPTION_SELECTED_TIER;
1237 -
1238 if(!query_metric_is_valid_tier(qm, selected_tier))
1239 return false;
1240
@@ -1248,7 +1248,7 @@ static bool query_plan(QUERY_ENGINE_OPS *ops, time_t after_wanted, time_t before
1248 qm->plan.array[0].after = (qm->tiers[selected_tier].db_first_time_s < after_wanted) ? after_wanted : qm->tiers[selected_tier].db_first_time_s;
1249 qm->plan.array[0].before = (qm->tiers[selected_tier].db_last_time_s > before_wanted) ? before_wanted : qm->tiers[selected_tier].db_last_time_s;
1250
1251 - if(!(ops->r->view.options & RRDR_OPTION_SELECTED_TIER)) {
1251 + if(switch_tiers) {
1252 // the selected tier
1253 time_t selected_tier_first_time_s = qm->plan.array[0].after;
1254 time_t selected_tier_last_time_s = qm->plan.array[0].before;
@@ -1375,8 +1375,9 @@ static bool query_plan(QUERY_ENGINE_OPS *ops, time_t after_wanted, time_t before
1375 \
1376 (ops)->grouping_add(r, (point).value); \
1377 \
1378 + storage_point_merge_to((ops)->group_point, (point).sp); \
1379 if(!(point).added) \
1379 - storage_point_merge_to((ops)->group_point, (point).sp); \
1380 + storage_point_merge_to((ops)->query_point, (point).sp); \
1381 } \
1382 \
1383 (ops)->group_points_added++; \
@@ -1441,10 +1442,10 @@ static void rrd2rrdr_query_execute(RRDR *r, size_t dim_id_in_rrdr, QUERY_ENGINE_
1442 QUERY_TARGET *qt = r->internal.qt;
1443 QUERY_METRIC *qm = ops->qm;
1444
1444 - r->drs[dim_id_in_rrdr] = STORAGE_POINT_UNSET;
1445 ops->group_point = STORAGE_POINT_UNSET;
1446 + ops->query_point = STORAGE_POINT_UNSET;
1447
1447 - RRDR_OPTIONS options = qt->request.options;
1448 + RRDR_OPTIONS options = qt->window.options;
1449 size_t points_wanted = qt->window.points;
1450 time_t after_wanted = qt->window.after;
1451 time_t before_wanted = qt->window.before; (void)before_wanted;
@@ -1456,7 +1457,7 @@ static void rrd2rrdr_query_execute(RRDR *r, size_t dim_id_in_rrdr, QUERY_ENGINE_
1457 size_t points_added = 0;
1458
1459 long rrdr_line = -1;
1459 - bool use_anomaly_bit_as_value = (r->view.options & RRDR_OPTION_ANOMALY_BIT) ? true : false;
1460 + bool use_anomaly_bit_as_value = (r->internal.qt->window.options & RRDR_OPTION_ANOMALY_BIT) ? true : false;
1461
1462 NETDATA_DOUBLE min = r->view.min, max = r->view.max;
1463
@@ -1763,7 +1764,7 @@ static void rrd2rrdr_query_execute(RRDR *r, size_t dim_id_in_rrdr, QUERY_ENGINE_
1764 NETDATA_DOUBLE group_value = ops->grouping_flush(r, rrdr_value_options_ptr);
1765 r->v[rrdr_o_v_index] = group_value;
1766
1766 - NETDATA_DOUBLE group_ar = r->ar[rrdr_o_v_index] = storage_point_anomaly_rate(ops->group_point);
1767 + r->ar[rrdr_o_v_index] = storage_point_anomaly_rate(ops->group_point);
1768
1769 if(likely(points_added || r->internal.queries_count)) {
1770 // find the min/max across all dimensions
@@ -1778,32 +1779,10 @@ static void rrd2rrdr_query_execute(RRDR *r, size_t dim_id_in_rrdr, QUERY_ENGINE_
1779 min = max = group_value;
1780 }
1781
1781 - // for volume contribution calculation we need the absolute value
1782 - NETDATA_DOUBLE stats_value = group_value < 0 ? -group_value : group_value;
1783 -
1784 - if(unlikely(!points_added)) {
1785 - qm->query_stats.min = stats_value;
1786 - qm->query_stats.max = stats_value;
1787 - }
1788 - else {
1789 - if(stats_value < qm->query_stats.min)
1790 - qm->query_stats.min = stats_value;
1791 -
1792 - if(stats_value > qm->query_stats.max)
1793 - qm->query_stats.max = stats_value;
1794 - }
1795 -
1796 - qm->query_stats.anomaly_sum += group_ar;
1797 - qm->query_stats.sum += stats_value;
1798 - qm->query_stats.volume += stats_value * (NETDATA_DOUBLE)ops->view_update_every;
1799 - qm->query_stats.group_points++;
1800 -
1782 points_added++;
1783 ops->group_points_added = 0;
1784 ops->group_value_flags = RRDR_VALUE_NOTHING;
1785 ops->group_points_non_zero = 0;
1805 -
1806 - storage_point_merge_to(r->drs[dim_id_in_rrdr], ops->group_point);
1786 ops->group_point = STORAGE_POINT_UNSET;
1787
1788 now_end_time += ops->view_update_every;
@@ -1816,6 +1795,8 @@ static void rrd2rrdr_query_execute(RRDR *r, size_t dim_id_in_rrdr, QUERY_ENGINE_
1795 }
1796 query_planer_finalize_remaining_plans(ops);
1797
1798 + qm->query_points = ops->query_point;
1799 +
1800 // fill the rest of the points with empty values
1801 while (points_added < points_wanted) {
1802 rrdr_line++;
@@ -2075,7 +2056,7 @@ bool query_target_calculate_window(QUERY_TARGET *qt) {
2056 time_t before_requested = qt->request.before;
2057 RRDR_TIME_GROUPING group_method = qt->request.time_group_method;
2058 time_t resampling_time_requested = qt->request.resampling_time;
2078 - RRDR_OPTIONS options = qt->request.options;
2059 + RRDR_OPTIONS options = qt->window.options;
2060 size_t tier = qt->request.tier;
2061 time_t update_every = qt->db.minimum_latest_update_every_s ? qt->db.minimum_latest_update_every_s : 1;
2062
@@ -2337,8 +2318,8 @@ bool query_target_calculate_window(QUERY_TARGET *qt) {
2318 qt->window.relative = relative_period_requested;
2319 qt->window.points = points_wanted;
2320 qt->window.group = group;
2340 - qt->window.group_method = group_method;
2341 - qt->window.group_options = qt->request.time_group_options;
2321 + qt->window.time_group_method = group_method;
2322 + qt->window.time_group_options = qt->request.time_group_options;
2323 qt->window.query_granularity = query_granularity;
2324 qt->window.resampling_group = resampling_group;
2325 qt->window.resampling_divisor = resampling_divisor;
@@ -2349,23 +2330,6 @@ bool query_target_calculate_window(QUERY_TARGET *qt) {
2330 return true;
2331 }
2332
2352 -void query_target_merge_data_statistics(struct query_data_statistics *d, struct query_data_statistics *s) {
2353 - if(!d->group_points)
2354 - *d = *s;
2355 - else {
2356 - d->group_points += s->group_points;
2357 - d->sum += s->sum;
2358 - d->anomaly_sum += s->anomaly_sum;
2359 - d->volume += s->volume;
2360 -
2361 - if(s->min < d->min)
2362 - d->min = s->min;
2363 -
2364 - if(s->max > d->max)
2365 - d->max = s->max;
2366 - }
2367 -}
2368 -
2333 // ----------------------------------------------------------------------------
2334 // group by
2335
@@ -2443,10 +2407,9 @@ static void rrd2rrdr_set_timestamps(RRDR *r) {
2407 internal_fatal(qt->window.points != r->n, "QUERY: mismatch to the number of points in qt and r");
2408
2409 r->view.group = qt->window.group;
2446 - r->view.update_every = (int) (qt->window.group * qt->window.query_granularity);
2410 + r->view.update_every = (int) query_view_update_every(qt);
2411 r->view.before = qt->window.before;
2412 r->view.after = qt->window.after;
2449 - r->view.options = qt->window.options;
2413
2414 r->time_grouping.points_wanted = qt->window.points;
2415 r->time_grouping.resampling_group = qt->window.resampling_group;
@@ -2456,7 +2419,7 @@ static void rrd2rrdr_set_timestamps(RRDR *r) {
2419
2420 size_t points_wanted = qt->window.points;
2421 time_t after_wanted = qt->window.after;
2459 - time_t before_wanted = qt->window.before;
2422 + time_t before_wanted = qt->window.before; (void)before_wanted;
2423
2424 time_t view_update_every = r->view.update_every;
2425 time_t query_granularity = (time_t)(r->view.update_every / r->view.group);
@@ -2477,7 +2440,7 @@ static void rrd2rrdr_set_timestamps(RRDR *r) {
2440 }
2441
2442 static RRDR *rrd2rrdr_group_by_initialize(ONEWAYALLOC *owa, QUERY_TARGET *qt) {
2480 - RRDR_OPTIONS options = qt->request.options;
2443 + RRDR_OPTIONS options = qt->window.options;
2444
2445 if(qt->request.group_by == RRDR_GROUP_BY_NONE) {
2446 RRDR *r = rrdr_create(owa, qt, qt->query.used, qt->window.points);
@@ -2746,28 +2709,6 @@ static RRDR *rrd2rrdr_group_by_initialize(ONEWAYALLOC *owa, QUERY_TARGET *qt) {
2709 rrdlabels_traversal_cb_to_group_by_label_key, entries[pos].dl);
2710 }
2711
2749 - // check if we have multiple units
2750 - bool multiple_units = false;
2751 - for(int i = 1; i < added ; i++) {
2752 - if(entries[i].units != entries[0].units) {
2753 - multiple_units = true;
2754 - break;
2755 - }
2756 - }
2757 -
2758 - if(multiple_units) {
2759 - // include the units into the id and name of the dimensions
2760 - for(int i = 0; i < added ; i++) {
2761 - buffer_flush(key);
2762 - buffer_strcat(key, string2str(entries[i].id));
2763 - buffer_fast_strcat(key, ",", 1);
2764 - buffer_strcat(key, string2str(entries[i].units));
2765 - STRING *u = string_strdupz(buffer_tostring(key));
2766 - string_freez(entries[i].id);
2767 - entries[i].id = u;
2768 - }
2769 - }
2770 -
2712 RRDR *r = rrdr_create(owa, qt, added, qt->window.points);
2713 if(!r) {
2714 internal_error(true, "QUERY: cannot create group by RRDR for %s, after=%ld, before=%ld, dimensions=%d, points=%zu",
@@ -2786,11 +2727,10 @@ static RRDR *rrd2rrdr_group_by_initialize(ONEWAYALLOC *owa, QUERY_TARGET *qt) {
2727 rrd2rrdr_set_timestamps(r->group_by.r);
2728
2729 r->dp = onewayalloc_callocz(r->internal.owa, r->d, sizeof(*r->dp));
2789 - r->dv = onewayalloc_callocz(r->internal.owa, r->d, sizeof(*r->dv));
2790 - r->dmin = onewayalloc_callocz(r->internal.owa, r->d, sizeof(*r->dmin));
2791 - r->dmax = onewayalloc_callocz(r->internal.owa, r->d, sizeof(*r->dmax));
2730 + r->dview = onewayalloc_callocz(r->internal.owa, r->d, sizeof(*r->dview));
2731 r->dgbc = onewayalloc_callocz(r->internal.owa, r->d, sizeof(*r->dgbc));
2732 r->gbc = onewayalloc_callocz(r->internal.owa, r->n * r->d, sizeof(*r->gbc));
2733 + r->dqp = onewayalloc_callocz(r->internal.owa, r->d, sizeof(STORAGE_POINT));
2734
2735 if(options & RRDR_OPTION_GROUP_BY_LABELS) {
2736 r->dl = onewayalloc_callocz(r->internal.owa, r->d, sizeof(DICTIONARY *));
@@ -2815,7 +2755,7 @@ static RRDR *rrd2rrdr_group_by_initialize(ONEWAYALLOC *owa, QUERY_TARGET *qt) {
2755 // initialize partial trimming
2756 r->partial_data_trimming.max_update_every = update_every_max;
2757 r->partial_data_trimming.expected_after =
2818 - (!(qt->request.options & RRDR_OPTION_RETURN_RAW) && qt->window.before >= qt->window.now - update_every_max) ?
2758 + (!(qt->window.options & RRDR_OPTION_RETURN_RAW) && qt->window.before >= qt->window.now - update_every_max) ?
2759 qt->window.before - update_every_max :
2760 qt->window.before;
2761 r->partial_data_trimming.trimmed_after = qt->window.before;
@@ -2862,7 +2802,7 @@ static void rrd2rrdr_group_by_add_metric(RRDR *r, size_t query_metric_id) {
2802 return;
2803
2804 QUERY_TARGET *qt = r->internal.qt;
2865 - RRDR_OPTIONS options = qt->request.options;
2805 + RRDR_OPTIONS options = qt->window.options;
2806 RRDR *r_tmp = r->group_by.r;
2807
2808 QUERY_METRIC *qm = query_metric(qt, query_metric_id);
@@ -2912,12 +2852,12 @@ static void rrd2rrdr_group_by_add_metric(RRDR *r, size_t query_metric_id) {
2852 break;
2853
2854 case RRDR_GROUP_BY_FUNCTION_MIN:
2915 - if(n_tmp < *cn)
2855 + if(!*gbc || n_tmp < *cn)
2856 *cn = n_tmp;
2857 break;
2858
2859 case RRDR_GROUP_BY_FUNCTION_MAX:
2920 - if(n_tmp > *cn)
2860 + if(!*gbc || n_tmp > *cn)
2861 *cn = n_tmp;
2862 break;
2863 }
@@ -2928,23 +2868,7 @@ static void rrd2rrdr_group_by_add_metric(RRDR *r, size_t query_metric_id) {
2868 }
2869 }
2870
2931 - for(size_t d_tmp = 0; d_tmp < r_tmp->d ; d_tmp++) {
2932 - if (unlikely(!(r_tmp->od[d_tmp] & RRDR_DIMENSION_QUERIED)))
2933 - continue;
2934 -
2935 - switch(qt->request.group_by_aggregate_function) {
2936 - case RRDR_GROUP_BY_FUNCTION_SUM:
2937 - storage_point_add_to(r->drs[d], r_tmp->drs[d_tmp]);
2938 - break;
2939 -
2940 - default:
2941 - case RRDR_GROUP_BY_FUNCTION_AVERAGE:
2942 - case RRDR_GROUP_BY_FUNCTION_MIN:
2943 - case RRDR_GROUP_BY_FUNCTION_MAX:
2944 - storage_point_merge_to(r->drs[d], r_tmp->drs[d_tmp]);
2945 - break;
2946 - }
2947 - }
2871 + storage_point_merge_to(r->dqp[d], qm->query_points);
2872 }
2873
2874 static void rrdr2rrdr_group_by_partial_trimming(RRDR *r) {
@@ -3017,7 +2941,7 @@ static void rrd2rrdr_convert_to_percentage(RRDR *r) {
2941 r->view.min = global_min;
2942 r->view.max = global_max;
2943
3020 - if(!r->dv || !r->dmin || !r->dmax)
2944 + if(!r->dview)
2945 // v1 query
2946 return;
2947
@@ -3028,7 +2952,7 @@ static void rrd2rrdr_convert_to_percentage(RRDR *r) {
2952 continue;
2953
2954 size_t count = 0;
3031 - NETDATA_DOUBLE min = 0, max = 0, sum = 0;
2955 + NETDATA_DOUBLE min = 0.0, max = 0.0, sum = 0.0, ars = 0.0;
2956 for(size_t i = 0; i != r->rows ;i++) { // we use r->rows to respect trimming
2957 size_t idx = i * r->d + d;
2958
@@ -3037,6 +2961,9 @@ static void rrd2rrdr_convert_to_percentage(RRDR *r) {
2961 if (o & RRDR_VALUE_EMPTY)
2962 continue;
2963
2964 + NETDATA_DOUBLE ar = r->ar[ idx ];
2965 + ars += ar;
2966 +
2967 NETDATA_DOUBLE n = r->v[ idx ];
2968 sum += n;
2969
@@ -3050,15 +2977,19 @@ static void rrd2rrdr_convert_to_percentage(RRDR *r) {
2977 }
2978 }
2979
3053 - r->dv[d] = (count) ? sum / (NETDATA_DOUBLE )count : 0.0;
3054 - r->dmin[d] = min;
3055 - r->dmax[d] = max;
2980 + r->dview[d] = (STORAGE_POINT) {
2981 + .sum = sum,
2982 + .count = count,
2983 + .min = min,
2984 + .max = max,
2985 + .anomaly_count = (size_t)(ars * (NETDATA_DOUBLE)count),
2986 + };
2987 }
2988 }
2989
2990 static void rrd2rrdr_group_by_finalize(RRDR *r) {
2991 QUERY_TARGET *qt = r->internal.qt;
3061 - RRDR_OPTIONS options = qt->request.options;
2992 + RRDR_OPTIONS options = qt->window.options;
2993
2994 if(!r->group_by.r) {
2995 // v1 query
@@ -3078,14 +3009,14 @@ static void rrd2rrdr_group_by_finalize(RRDR *r) {
3009
3010 // apply averaging, remove RRDR_VALUE_EMPTY, find the non-zero dimensions, min and max
3011 size_t global_min_max_values = 0;
3012 + size_t dimensions_nonzero = 0;
3013 NETDATA_DOUBLE global_min = NAN, global_max = NAN;
3014 for (size_t d = 0; d < r->d; d++) {
3015 if (unlikely(!(r->od[d] & RRDR_DIMENSION_QUERIED)))
3016 continue;
3017
3086 - size_t non_zero = 0;
3087 -
3088 - NETDATA_DOUBLE min = 0, max = 0, sum = 0;
3018 + size_t points_nonzero = 0;
3019 + NETDATA_DOUBLE min = 0, max = 0, sum = 0, ars = 0;
3020 size_t count = 0;
3021
3022 for(size_t i = 0; i != r->n ;i++) {
@@ -3105,6 +3036,7 @@ static void rrd2rrdr_group_by_finalize(RRDR *r) {
3036 NETDATA_DOUBLE n;
3037
3038 sum += *cn;
3039 + ars += *ar;
3040
3041 if(qt->request.group_by_aggregate_function == RRDR_GROUP_BY_FUNCTION_AVERAGE && !query_target_aggregatable(qt))
3042 n = (*cn /= gbc);
@@ -3115,7 +3047,7 @@ static void rrd2rrdr_group_by_finalize(RRDR *r) {
3047 *ar /= gbc;
3048
3049 if(islessgreater(n, 0.0))
3118 - non_zero++;
3050 + points_nonzero++;
3051
3052 if(unlikely(!count))
3053 min = max = n;
@@ -3141,17 +3073,29 @@ static void rrd2rrdr_group_by_finalize(RRDR *r) {
3073 }
3074 }
3075
3144 - if(non_zero)
3076 + if(points_nonzero) {
3077 r->od[d] |= RRDR_DIMENSION_NONZERO;
3078 + dimensions_nonzero++;
3079 + }
3080
3147 - r->dv[d] = (count) ? sum / (NETDATA_DOUBLE)count : 0.0;
3148 - r->dmin[d] = min;
3149 - r->dmax[d] = max;
3081 + r->dview[d] = (STORAGE_POINT) {
3082 + .sum = sum,
3083 + .count = count,
3084 + .min = min,
3085 + .max = max,
3086 + .anomaly_count = (size_t)(ars * RRDR_DVIEW_ANOMALY_COUNT_MULTIPLIER / 100.0),
3087 + };
3088 }
3089
3090 r->view.min = global_min;
3091 r->view.max = global_max;
3092
3093 + if(!dimensions_nonzero && (qt->window.options & RRDR_OPTION_NONZERO)) {
3094 + // all dimensions are zero
3095 + // remove the nonzero option
3096 + qt->window.options &= ~RRDR_OPTION_NONZERO;
3097 + }
3098 +
3099 if(options & RRDR_OPTION_PERCENTAGE)
3100 rrd2rrdr_convert_to_percentage(r);
3101
@@ -3242,10 +3186,10 @@ RRDR *rrd2rrdr(ONEWAYALLOC *owa, QUERY_TARGET *qt) {
3186
3187 // -------------------------------------------------------------------------
3188 // assign the processor functions
3245 - rrdr_set_grouping_function(r_tmp, qt->window.group_method);
3189 + rrdr_set_grouping_function(r_tmp, qt->window.time_group_method);
3190
3191 // allocate any memory required by the grouping method
3248 - r_tmp->time_grouping.create(r_tmp, qt->window.group_options);
3192 + r_tmp->time_grouping.create(r_tmp, qt->window.time_group_options);
3193
3194 // -------------------------------------------------------------------------
3195 // do the work for each dimension
@@ -3254,11 +3198,6 @@ RRDR *rrd2rrdr(ONEWAYALLOC *owa, QUERY_TARGET *qt) {
3198 size_t max_rows = 0;
3199
3200 long dimensions_used = 0, dimensions_nonzero = 0;
3257 - struct timeval query_start_time;
3258 - struct timeval query_current_time;
3259 - if (qt->request.timeout_ms)
3260 - now_realtime_timeval(&query_start_time);
3261 -
3201 size_t last_db_points_read = 0;
3202 size_t last_result_points_generated = 0;
3203
@@ -3277,6 +3216,10 @@ RRDR *rrd2rrdr(ONEWAYALLOC *owa, QUERY_TARGET *qt) {
3216 queries_prepared++;
3217 }
3218
3219 + QUERY_NODE *last_qn = NULL;
3220 + usec_t last_ut = now_monotonic_usec();
3221 + usec_t last_qn_ut = last_ut;
3222 +
3223 for(size_t d = 0; d < qt->query.used ; d++) {
3224 QUERY_METRIC *qm = query_metric(qt, d);
3225 QUERY_DIMENSION *qd = query_dimension(qt, qm->link.query_dimension_id);
@@ -3284,6 +3227,15 @@ RRDR *rrd2rrdr(ONEWAYALLOC *owa, QUERY_TARGET *qt) {
3227 QUERY_CONTEXT *qc = query_context(qt, qm->link.query_context_id);
3228 QUERY_NODE *qn = query_node(qt, qm->link.query_node_id);
3229
3230 + usec_t now_ut = last_ut;
3231 + if(qn != last_qn) {
3232 + if(last_qn)
3233 + last_qn->duration_ut = now_ut - last_qn_ut;
3234 +
3235 + last_qn = qn;
3236 + last_qn_ut = now_ut;
3237 + }
3238 +
3239 if(queries_prepared < qt->query.used) {
3240 // preload another query
3241 ops[queries_prepared] = rrd2rrdr_query_ops_prep(r_tmp, queries_prepared);
@@ -3302,6 +3254,10 @@ RRDR *rrd2rrdr(ONEWAYALLOC *owa, QUERY_TARGET *qt) {
3254 rrd2rrdr_query_execute(r_tmp, dim_in_rrdr_tmp, ops[d]);
3255 r_tmp->od[dim_in_rrdr_tmp] |= RRDR_DIMENSION_QUERIED;
3256
3257 + now_ut = now_monotonic_usec();
3258 + qm->duration_ut = now_ut - last_ut;
3259 + last_ut = now_ut;
3260 +
3261 if(r_tmp != r) {
3262 // copy back whatever got updated from the temporary r
3263
@@ -3329,10 +3285,13 @@ RRDR *rrd2rrdr(ONEWAYALLOC *owa, QUERY_TARGET *qt) {
3285 qm->status |= RRDR_DIMENSION_QUERIED;
3286
3287 if(qt->request.version >= 2) {
3332 - query_target_merge_data_statistics(&qi->query_stats, &qm->query_stats);
3333 - query_target_merge_data_statistics(&qc->query_stats, &qm->query_stats);
3334 - query_target_merge_data_statistics(&qn->query_stats, &qm->query_stats);
3335 - query_target_merge_data_statistics(&qt->query_stats, &qm->query_stats);
3288 + // we need to make the query points positive now
3289 + // since we will aggregate it across multiple dimensions
3290 + storage_point_make_positive(qm->query_points);
3291 + storage_point_merge_to(qi->query_points, qm->query_points);
3292 + storage_point_merge_to(qc->query_points, qm->query_points);
3293 + storage_point_merge_to(qn->query_points, qm->query_points);
3294 + storage_point_merge_to(qt->query_points, qm->query_points);
3295 }
3296 }
3297 else {
@@ -3355,9 +3314,6 @@ RRDR *rrd2rrdr(ONEWAYALLOC *owa, QUERY_TARGET *qt) {
3314 last_db_points_read = r_tmp->stats.db_points_read;
3315 last_result_points_generated = r_tmp->stats.result_points_generated;
3316
3358 - if (qt->request.timeout_ms)
3359 - now_realtime_timeval(&query_current_time);
3360 -
3317 if(qm->status & RRDR_DIMENSION_NONZERO)
3318 dimensions_nonzero++;
3319
@@ -3398,10 +3354,10 @@ RRDR *rrd2rrdr(ONEWAYALLOC *owa, QUERY_TARGET *qt) {
3354 log_access("QUERY INTERRUPTED");
3355 }
3356
3401 - if (qt->request.timeout_ms && ((NETDATA_DOUBLE)dt_usec(&query_start_time, &query_current_time) / 1000.0) > (NETDATA_DOUBLE)qt->request.timeout_ms) {
3357 + if (qt->request.timeout_ms && ((NETDATA_DOUBLE)(now_ut - qt->timings.received_ut) / 1000.0) > (NETDATA_DOUBLE)qt->request.timeout_ms) {
3358 cancel = true;
3359 log_access("QUERY CANCELED RUNTIME EXCEEDED %0.2f ms (LIMIT %lld ms)",
3404 - (NETDATA_DOUBLE)dt_usec(&query_start_time, &query_current_time) / 1000.0, (long long)qt->request.timeout_ms);
3360 + (NETDATA_DOUBLE)(now_ut - qt->timings.received_ut) / 1000.0, (long long)qt->request.timeout_ms);
3361 }
3362
3363 if(cancel) {
@@ -3427,20 +3383,20 @@ RRDR *rrd2rrdr(ONEWAYALLOC *owa, QUERY_TARGET *qt) {
3383 #ifdef NETDATA_INTERNAL_CHECKS
3384 if (dimensions_used && !(r->view.flags & RRDR_RESULT_FLAG_CANCEL)) {
3385 if(r->internal.log)
3430 - rrd2rrdr_log_request_response_metadata(r, qt->window.options, qt->window.group_method, qt->window.aligned, qt->window.group, qt->request.resampling_time, qt->window.resampling_group,
3386 + rrd2rrdr_log_request_response_metadata(r, qt->window.options, qt->window.time_group_method, qt->window.aligned, qt->window.group, qt->request.resampling_time, qt->window.resampling_group,
3387 qt->window.after, qt->request.after, qt->window.before, qt->request.before,
3388 qt->request.points, qt->window.points, /*after_slot, before_slot,*/
3389 r->internal.log);
3390
3391 if(r->rows != qt->window.points)
3436 - rrd2rrdr_log_request_response_metadata(r, qt->window.options, qt->window.group_method, qt->window.aligned, qt->window.group, qt->request.resampling_time, qt->window.resampling_group,
3392 + rrd2rrdr_log_request_response_metadata(r, qt->window.options, qt->window.time_group_method, qt->window.aligned, qt->window.group, qt->request.resampling_time, qt->window.resampling_group,
3393 qt->window.after, qt->request.after, qt->window.before, qt->request.before,
3394 qt->request.points, qt->window.points, /*after_slot, before_slot,*/
3395 "got 'points' is not wanted 'points'");
3396
3441 - if(qt->window.aligned && (r->view.before % (qt->window.group * qt->window.query_granularity)) != 0)
3442 - rrd2rrdr_log_request_response_metadata(r, qt->window.options, qt->window.group_method, qt->window.aligned, qt->window.group, qt->request.resampling_time, qt->window.resampling_group,
3443 - qt->window.after, qt->request.after, qt->window.before,qt->request.before,
3397 + if(qt->window.aligned && (r->view.before % query_view_update_every(qt)) != 0)
3398 + rrd2rrdr_log_request_response_metadata(r, qt->window.options, qt->window.time_group_method, qt->window.aligned, qt->window.group, qt->request.resampling_time, qt->window.resampling_group,
3399 + qt->window.after, qt->request.after, qt->window.before, qt->request.before,
3400 qt->request.points, qt->window.points, /*after_slot, before_slot,*/
3401 "'before' is not aligned but alignment is required");
3402
@@ -3449,20 +3405,20 @@ RRDR *rrd2rrdr(ONEWAYALLOC *owa, QUERY_TARGET *qt) {
3405 // rrd2rrdr_log_request_response_metadata(r, qt->window.options, qt->window.group_method, qt->window.aligned, qt->window.group, qt->request.resampling_time, qt->window.resampling_group, qt->window.after, after_requested, before_wanted, before_requested, points_requested, points_wanted, after_slot, before_slot, "'after' is not aligned but alignment is required");
3406
3407 if(r->view.before != qt->window.before)
3452 - rrd2rrdr_log_request_response_metadata(r, qt->window.options, qt->window.group_method, qt->window.aligned, qt->window.group, qt->request.resampling_time, qt->window.resampling_group,
3408 + rrd2rrdr_log_request_response_metadata(r, qt->window.options, qt->window.time_group_method, qt->window.aligned, qt->window.group, qt->request.resampling_time, qt->window.resampling_group,
3409 qt->window.after, qt->request.after, qt->window.before, qt->request.before,
3410 qt->request.points, qt->window.points, /*after_slot, before_slot,*/
3411 "chart is not aligned to requested 'before'");
3412
3413 if(r->view.before != qt->window.before)
3458 - rrd2rrdr_log_request_response_metadata(r, qt->window.options, qt->window.group_method, qt->window.aligned, qt->window.group, qt->request.resampling_time, qt->window.resampling_group,
3414 + rrd2rrdr_log_request_response_metadata(r, qt->window.options, qt->window.time_group_method, qt->window.aligned, qt->window.group, qt->request.resampling_time, qt->window.resampling_group,
3415 qt->window.after, qt->request.after, qt->window.before, qt->request.before,
3416 qt->request.points, qt->window.points, /*after_slot, before_slot,*/
3417 "got 'before' is not wanted 'before'");
3418
3419 // reported 'after' varies, depending on group
3420 if(r->view.after != qt->window.after)
3465 - rrd2rrdr_log_request_response_metadata(r, qt->window.options, qt->window.group_method, qt->window.aligned, qt->window.group, qt->request.resampling_time, qt->window.resampling_group,
3421 + rrd2rrdr_log_request_response_metadata(r, qt->window.options, qt->window.time_group_method, qt->window.aligned, qt->window.group, qt->request.resampling_time, qt->window.resampling_group,
3422 qt->window.after, qt->request.after, qt->window.before, qt->request.before,
3423 qt->request.points, qt->window.points, /*after_slot, before_slot,*/
3424 "got 'after' is not wanted 'after'");
@@ -3480,19 +3436,11 @@ RRDR *rrd2rrdr(ONEWAYALLOC *owa, QUERY_TARGET *qt) {
3436
3437 onewayalloc_freez(owa, ops);
3438
3483 - if(likely(dimensions_used)) {
3439 + if(likely(dimensions_used && (qt->window.options & RRDR_OPTION_NONZERO) && !dimensions_nonzero))
3440 // when all the dimensions are zero, we should return all of them
3485 - if (unlikely((qt->window.options & RRDR_OPTION_NONZERO) && !dimensions_nonzero &&
3486 - !(r->view.flags & RRDR_RESULT_FLAG_CANCEL))) {
3487 - // all the dimensions are zero
3488 - // mark them as NONZERO to send them all
3489 - for (size_t d = 0; d < r->d; d++) {
3490 - if (unlikely(r->od[d] & RRDR_DIMENSION_HIDDEN)) continue;
3491 - if (unlikely(!(r->od[d] & RRDR_DIMENSION_QUERIED))) continue;
3492 - r->od[d] |= RRDR_DIMENSION_NONZERO;
3493 - }
3494 - }
3495 - }
3441 + qt->window.options &= ~RRDR_OPTION_NONZERO;
3442 +
3443 + qt->timings.executed_ut = now_monotonic_usec();
3444
3445 return r;
3446 }
web/api/queries/query.h
-3
@@ -78,9 +78,6 @@ typedef enum rrdr_group_by_function {
78 RRDR_GROUP_BY_FUNCTION group_by_aggregate_function_parse(const char *s);
79 const char *group_by_aggregate_function_to_string(RRDR_GROUP_BY_FUNCTION group_by_function);
80
81 -struct query_data_statistics;
82 -void query_target_merge_data_statistics(struct query_data_statistics *d, struct query_data_statistics *s);
83 -
81 #ifdef __cplusplus
82 }
83 #endif
web/api/queries/rrdr.c
+2 -5
@@ -77,10 +77,8 @@ inline void rrdr_free(ONEWAYALLOC *owa, RRDR *r) {
77 onewayalloc_freez(owa, r->dn);
78 onewayalloc_freez(owa, r->du);
79 onewayalloc_freez(owa, r->dp);
80 - onewayalloc_freez(owa, r->dv);
81 - onewayalloc_freez(owa, r->dmin);
82 - onewayalloc_freez(owa, r->dmax);
83 - onewayalloc_freez(owa, r->drs);
80 + onewayalloc_freez(owa, r->dview);
81 + onewayalloc_freez(owa, r->dqp);
82 onewayalloc_freez(owa, r->ar);
83 onewayalloc_freez(owa, r->gbc);
84 onewayalloc_freez(owa, r->dgbc);
@@ -137,7 +135,6 @@ RRDR *rrdr_create(ONEWAYALLOC *owa, QUERY_TARGET *qt, size_t dimensions, size_t
135 r->di = onewayalloc_callocz(owa, dimensions, sizeof(STRING *));
136 r->dn = onewayalloc_callocz(owa, dimensions, sizeof(STRING *));
137 r->du = onewayalloc_callocz(owa, dimensions, sizeof(STRING *));
140 - r->drs = onewayalloc_callocz(owa, dimensions, sizeof(STORAGE_POINT));
138 }
139
140 r->view.group = 1;
web/api/queries/rrdr.h
+4 -5
@@ -92,6 +92,8 @@ struct rrdr_group_by_entry {
92 DICTIONARY *dl;
93 };
94
95 +#define RRDR_DVIEW_ANOMALY_COUNT_MULTIPLIER 1000.0
96 +
97 typedef struct rrdresult {
98 size_t d; // the number of dimensions
99 size_t n; // the number of values in the arrays (number of points per dimension)
@@ -104,11 +106,9 @@ typedef struct rrdresult {
106 STRING **du; // array of d dimension units
107 uint32_t *dgbc; // array of d dimension units - NOT ALLOCATED when RRDR is created
108 uint32_t *dp; // array of d dimension priority - NOT ALLOCATED when RRDR is created
107 - NETDATA_DOUBLE *dv; // array of d dimension averages - NOT ALLOCATED when RRDR is created
108 - NETDATA_DOUBLE *dmin; // array of d dimension minimums - NOT ALLOCATED when RRDR is created
109 - NETDATA_DOUBLE *dmax; // array of d dimension maximums - NOT ALLOCATED when RRDR is created
109 DICTIONARY **dl; // array of d dimension labels - NOT ALLOCATED when RRDR is created
111 - STORAGE_POINT *drs; // array of d dimensions raw statistics (storage points)
110 + STORAGE_POINT *dqp; // array of d dimensions query points - NOT ALLOCATED when RRDR is created
111 + STORAGE_POINT *dview; // array of d dimensions group by view - NOT ALLOCATED when RRDR is created
112
113 DICTIONARY *label_keys;
114
@@ -126,7 +126,6 @@ typedef struct rrdresult {
126 NETDATA_DOUBLE min;
127 NETDATA_DOUBLE max;
128 RRDR_RESULT_FLAGS flags; // RRDR_RESULT_FLAG_*
129 - RRDR_OPTIONS options; // RRDR_OPTION_* (as run by the query)
129 } view;
130
131 struct {
web/api/queries/weights.c
+173 -92
@@ -64,6 +64,7 @@ struct register_result {
64 NETDATA_DOUBLE value;
65 STORAGE_POINT highlighted;
66 STORAGE_POINT baseline;
67 + usec_t duration_ut;
68 };
69
70 static DICTIONARY *register_result_init() {
@@ -75,17 +76,10 @@ static void register_result_destroy(DICTIONARY *results) {
76 dictionary_destroy(results);
77 }
78
78 -static void register_result(DICTIONARY *results,
79 - RRDHOST *host,
80 - RRDCONTEXT_ACQUIRED *rca,
81 - RRDINSTANCE_ACQUIRED *ria,
82 - RRDMETRIC_ACQUIRED *rma,
83 - NETDATA_DOUBLE value,
84 - RESULT_FLAGS flags,
85 - STORAGE_POINT *highlighted,
86 - STORAGE_POINT *baseline,
87 - WEIGHTS_STATS *stats,
88 - bool register_zero) {
79 +static void register_result(DICTIONARY *results, RRDHOST *host, RRDCONTEXT_ACQUIRED *rca, RRDINSTANCE_ACQUIRED *ria,
80 + RRDMETRIC_ACQUIRED *rma, NETDATA_DOUBLE value, RESULT_FLAGS flags,
81 + STORAGE_POINT *highlighted, STORAGE_POINT *baseline, WEIGHTS_STATS *stats,
82 + bool register_zero, usec_t duration_ut) {
83
84 if(!netdata_double_isnumber(value)) return;
85
@@ -107,6 +101,7 @@ static void register_result(DICTIONARY *results,
101 .ria = ria,
102 .rma = rma,
103 .value = v,
104 + .duration_ut = duration_ut,
105 };
106
107 if(highlighted)
@@ -132,7 +127,6 @@ static void results_header_to_json(DICTIONARY *results __maybe_unused, BUFFER *w
127 size_t examined_dimensions __maybe_unused, usec_t duration,
128 WEIGHTS_STATS *stats) {
129
135 - buffer_json_initialize(wb, "\"", "\"", 0, true, options & RRDR_OPTION_MINIFY);
130 buffer_json_member_add_time_t(wb, "after", after);
131 buffer_json_member_add_time_t(wb, "before", before);
132 buffer_json_member_add_time_t(wb, "duration", before - after);
@@ -175,6 +169,8 @@ static size_t registered_results_to_json_charts(DICTIONARY *results, BUFFER *wb,
169 size_t examined_dimensions, usec_t duration,
170 WEIGHTS_STATS *stats) {
171
172 + buffer_json_initialize(wb, "\"", "\"", 0, true, options & RRDR_OPTION_MINIFY);
173 +
174 results_header_to_json(results, wb, after, before, baseline_after, baseline_before,
175 points, method, group, options, shifts, examined_dimensions, duration, stats);
176
@@ -225,6 +221,8 @@ static size_t registered_results_to_json_contexts(DICTIONARY *results, BUFFER *w
221 size_t examined_dimensions, usec_t duration,
222 WEIGHTS_STATS *stats) {
223
224 + buffer_json_initialize(wb, "\"", "\"", 0, true, options & RRDR_OPTION_MINIFY);
225 +
226 results_header_to_json(results, wb, after, before, baseline_after, baseline_before,
227 points, method, group, options, shifts, examined_dimensions, duration, stats);
228
@@ -316,15 +314,25 @@ static inline void storage_point_to_json(BUFFER *wb, WEIGHTS_POINT_TYPE type, ss
314 buffer_json_add_array_item_array(wb);
315
316 buffer_json_add_array_item_uint64(wb, type); // "type"
319 - buffer_json_add_array_item_array(wb);
320 - if(type == WPT_DIMENSION)
321 - buffer_json_add_array_item_int64(wb, di);
322 - if(type == WPT_DIMENSION || type == WPT_INSTANCE)
323 - buffer_json_add_array_item_int64(wb, ii);
324 - if(type == WPT_CONTEXT)
325 - buffer_json_add_array_item_int64(wb, ci);
317 buffer_json_add_array_item_int64(wb, ni);
327 - buffer_json_array_close(wb);
318 + if(type != WPT_NODE) {
319 + buffer_json_add_array_item_int64(wb, ci);
320 + if(type != WPT_CONTEXT) {
321 + buffer_json_add_array_item_int64(wb, ii);
322 + if(type != WPT_INSTANCE)
323 + buffer_json_add_array_item_int64(wb, di);
324 + else
325 + buffer_json_add_array_item_string(wb, NULL);
326 + } else {
327 + buffer_json_add_array_item_string(wb, NULL);
328 + buffer_json_add_array_item_string(wb, NULL);
329 + }
330 + }
331 + else {
332 + buffer_json_add_array_item_string(wb, NULL);
333 + buffer_json_add_array_item_string(wb, NULL);
334 + buffer_json_add_array_item_string(wb, NULL);
335 + }
336 buffer_json_add_array_item_double(wb, weight); // "weight"
337
338 buffer_json_add_array_item_array(wb);
@@ -351,76 +359,118 @@ static inline void storage_point_to_json(BUFFER *wb, WEIGHTS_POINT_TYPE type, ss
359 }
360
361 static void multinode_data_schema(BUFFER *wb, RRDR_OPTIONS options __maybe_unused, const char *key, bool baseline) {
354 - size_t idx = 0;
362 buffer_json_member_add_object(wb, key); // schema
363
357 - buffer_json_member_add_object(wb, "type");
358 - buffer_json_member_add_uint64(wb, "idx", idx++);
359 - buffer_json_object_close(wb); // type
364 + buffer_json_member_add_string(wb, "type", "array");
365 + buffer_json_member_add_array(wb, "items");
366 +
367 + buffer_json_add_array_item_object(wb);
368 + buffer_json_member_add_string(wb, "name", "row_type");
369 + buffer_json_member_add_string(wb, "type", "integer");
370 + buffer_json_member_add_array(wb, "value");
371 + buffer_json_add_array_item_string(wb, "dimension");
372 + buffer_json_add_array_item_string(wb, "instance");
373 + buffer_json_add_array_item_string(wb, "context");
374 + buffer_json_add_array_item_string(wb, "node");
375 + buffer_json_array_close(wb);
376 + buffer_json_object_close(wb);
377
361 - buffer_json_member_add_object(wb, "link");
362 - buffer_json_member_add_uint64(wb, "idx", idx++);
363 - buffer_json_member_add_object(wb, "dimension");
378 + buffer_json_add_array_item_object(wb);
379 {
365 - buffer_json_member_add_uint64(wb, "type", WPT_DIMENSION);
366 - size_t pidx = 0;
367 - buffer_json_member_add_uint64(wb, "di", pidx++);
368 - buffer_json_member_add_uint64(wb, "ii", pidx++);
369 - buffer_json_member_add_uint64(wb, "ni", pidx++);
380 + buffer_json_member_add_string(wb, "name", "ni");
381 + buffer_json_member_add_string(wb, "type", "integer");
382 + buffer_json_member_add_string(wb, "dictionary", "nodes");
383 }
371 - buffer_json_object_close(wb); // dimension
372 - buffer_json_member_add_object(wb, "instance");
384 + buffer_json_object_close(wb);
385 +
386 + buffer_json_add_array_item_object(wb);
387 {
374 - buffer_json_member_add_uint64(wb, "type", WPT_INSTANCE);
375 - size_t pidx = 0;
376 - buffer_json_member_add_uint64(wb, "ii", pidx++);
377 - buffer_json_member_add_uint64(wb, "ni", pidx++);
388 + buffer_json_member_add_string(wb, "name", "ci");
389 + buffer_json_member_add_string(wb, "type", "integer");
390 + buffer_json_member_add_string(wb, "dictionary", "contexts");
391 }
379 - buffer_json_object_close(wb); // context
380 - buffer_json_member_add_object(wb, "context");
392 + buffer_json_object_close(wb);
393 +
394 + buffer_json_add_array_item_object(wb);
395 {
382 - buffer_json_member_add_uint64(wb, "type", WPT_CONTEXT);
383 - size_t pidx = 0;
384 - buffer_json_member_add_uint64(wb, "ci", pidx++);
385 - buffer_json_member_add_uint64(wb, "ni", pidx++);
396 + buffer_json_member_add_string(wb, "name", "ii");
397 + buffer_json_member_add_string(wb, "type", "integer");
398 + buffer_json_member_add_string(wb, "dictionary", "instances");
399 }
387 - buffer_json_object_close(wb); // context
388 - buffer_json_member_add_object(wb, "node");
400 + buffer_json_object_close(wb);
401 +
402 + buffer_json_add_array_item_object(wb);
403 {
390 - buffer_json_member_add_uint64(wb, "type", WPT_NODE);
391 - size_t pidx = 0;
392 - buffer_json_member_add_uint64(wb, "ni", pidx++);
404 + buffer_json_member_add_string(wb, "name", "di");
405 + buffer_json_member_add_string(wb, "type", "integer");
406 + buffer_json_member_add_string(wb, "dictionary", "dimensions");
407 }
394 - buffer_json_object_close(wb); // node
395 - buffer_json_object_close(wb); // link
408 + buffer_json_object_close(wb);
409
397 - buffer_json_member_add_object(wb, "weight");
398 - buffer_json_member_add_uint64(wb, "idx", idx++);
399 - buffer_json_object_close(wb); // weight
410 + buffer_json_add_array_item_object(wb);
411 + {
412 + buffer_json_member_add_string(wb, "name", "weight");
413 + buffer_json_member_add_string(wb, "type", "number");
414 + }
415 + buffer_json_object_close(wb);
416
401 - for(size_t i = 0; i < ((baseline) ? 2 : 1) ; i++) {
402 - if(i == 0)
403 - buffer_json_member_add_object(wb, "highlighted");
404 - else
405 - buffer_json_member_add_object(wb, "baseline");
406 -
407 - buffer_json_member_add_uint64(wb, "idx", idx++);
408 - size_t pidx = 0;
409 - buffer_json_member_add_uint64(wb, "min", pidx++);
410 - buffer_json_member_add_uint64(wb, "avg", pidx++);
411 - buffer_json_member_add_uint64(wb, "max", pidx++);
412 - buffer_json_member_add_uint64(wb, "sum", pidx++);
413 - buffer_json_member_add_uint64(wb, "count", pidx++);
414 - buffer_json_member_add_uint64(wb, "anomaly_count", pidx++);
415 - buffer_json_object_close(wb); // point
417 + buffer_json_add_array_item_object(wb);
418 + {
419 + buffer_json_member_add_string(wb, "name", "timeframe");
420 + buffer_json_member_add_string(wb, "type", "array");
421 + buffer_json_member_add_array(wb, "labels");
422 + {
423 + buffer_json_add_array_item_string(wb, "min");
424 + buffer_json_add_array_item_string(wb, "avg");
425 + buffer_json_add_array_item_string(wb, "max");
426 + buffer_json_add_array_item_string(wb, "sum");
427 + buffer_json_add_array_item_string(wb, "count");
428 + buffer_json_add_array_item_string(wb, "anomaly_count");
429 + }
430 + buffer_json_array_close(wb);
431 + buffer_json_member_add_object(wb, "calculations");
432 + buffer_json_member_add_string(wb, "anomaly rate", "anomaly_count * 100 / count");
433 + buffer_json_object_close(wb);
434 + }
435 + buffer_json_object_close(wb);
436 +
437 + if(baseline) {
438 + buffer_json_add_array_item_object(wb);
439 + {
440 + buffer_json_member_add_string(wb, "name", "baseline timeframe");
441 + buffer_json_member_add_string(wb, "type", "array");
442 + buffer_json_member_add_array(wb, "labels");
443 + {
444 + buffer_json_add_array_item_string(wb, "min");
445 + buffer_json_add_array_item_string(wb, "avg");
446 + buffer_json_add_array_item_string(wb, "max");
447 + buffer_json_add_array_item_string(wb, "sum");
448 + buffer_json_add_array_item_string(wb, "count");
449 + buffer_json_add_array_item_string(wb, "anomaly_count");
450 + }
451 + buffer_json_array_close(wb);
452 + buffer_json_member_add_object(wb, "calculations");
453 + buffer_json_member_add_string(wb, "anomaly rate", "anomaly_count * 100 / count");
454 + buffer_json_object_close(wb);
455 + }
456 + buffer_json_object_close(wb);
457 }
458
459 + buffer_json_array_close(wb); // items
460 buffer_json_object_close(wb); // schema
461 }
462
421 -struct dict_unique_name {
463 +struct dict_unique_node {
464 + bool existing;
465 + uint32_t i;
466 + RRDHOST *host;
467 + usec_t duration_ut;
468 +};
469 +
470 +struct dict_unique_name_units {
471 bool existing;
472 uint32_t i;
473 + const char *units;
474 };
475
476 struct dict_unique_id_name {
@@ -430,9 +480,22 @@ struct dict_unique_id_name {
480 const char *name;
481 };
482
433 -static inline ssize_t dict_unique_name_add(DICTIONARY *dict, const char *name, ssize_t *max_id) {
434 - struct dict_unique_name *dun = dictionary_set(dict, name, NULL, sizeof(struct dict_unique_name));
483 +static inline struct dict_unique_node *dict_unique_node_add(DICTIONARY *dict, RRDHOST *host, ssize_t *max_id) {
484 + struct dict_unique_node *dun = dictionary_set(dict, host->machine_guid, NULL, sizeof(struct dict_unique_node));
485 if(!dun->existing) {
486 + dun->existing = true;
487 + dun->host = host;
488 + dun->i = *max_id;
489 + (*max_id)++;
490 + }
491 +
492 + return dun;
493 +}
494 +
495 +static inline ssize_t dict_unique_name_units_add(DICTIONARY *dict, const char *name, const char *units, ssize_t *max_id) {
496 + struct dict_unique_name_units *dun = dictionary_set(dict, name, NULL, sizeof(struct dict_unique_name_units));
497 + if(!dun->existing) {
498 + dun->units = units;
499 dun->existing = true;
500 dun->i = *max_id;
501 (*max_id)++;
@@ -464,6 +527,10 @@ static size_t registered_results_to_json_multinode(DICTIONARY *results, BUFFER *
527 size_t examined_dimensions, usec_t duration,
528 WEIGHTS_STATS *stats,
529 struct query_versions *versions) {
530 + buffer_json_initialize(wb, "\"", "\"", 0, true, options & RRDR_OPTION_MINIFY);
531 + buffer_json_member_add_uint64(wb, "api", 2);
532 + buffer_json_agents_array_v2(wb, 0);
533 +
534 results_header_to_json(results, wb, after, before, baseline_after, baseline_before,
535 points, method, group, options, shifts, examined_dimensions, duration, stats);
536
@@ -472,12 +539,12 @@ static size_t registered_results_to_json_multinode(DICTIONARY *results, BUFFER *
539 bool baseline = method == WEIGHTS_METHOD_MC_KS2 || method == WEIGHTS_METHOD_MC_VOLUME;
540 multinode_data_schema(wb, options, "schema", baseline);
541
475 - DICTIONARY *dict_nodes = dictionary_create_advanced(DICT_OPTION_SINGLE_THREADED | DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_FIXED_SIZE, NULL, sizeof(struct dict_unique_name));
476 - DICTIONARY *dict_contexts = dictionary_create_advanced(DICT_OPTION_SINGLE_THREADED | DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_FIXED_SIZE, NULL, sizeof(struct dict_unique_name));
542 + DICTIONARY *dict_nodes = dictionary_create_advanced(DICT_OPTION_SINGLE_THREADED | DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_FIXED_SIZE, NULL, sizeof(struct dict_unique_node));
543 + DICTIONARY *dict_contexts = dictionary_create_advanced(DICT_OPTION_SINGLE_THREADED | DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_FIXED_SIZE, NULL, sizeof(struct dict_unique_name_units));
544 DICTIONARY *dict_instances = dictionary_create_advanced(DICT_OPTION_SINGLE_THREADED | DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_FIXED_SIZE, NULL, sizeof(struct dict_unique_id_name));
545 DICTIONARY *dict_dimensions = dictionary_create_advanced(DICT_OPTION_SINGLE_THREADED | DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_FIXED_SIZE, NULL, sizeof(struct dict_unique_id_name));
546
480 - buffer_json_member_add_array(wb, "points");
547 + buffer_json_member_add_array(wb, "result");
548
549 size_t total_dimensions = 0, node_dims = 0, context_dims = 0, instance_dims = 0;
550 NETDATA_DOUBLE context_total_weight = 0.0, instance_total_weight = 0.0, node_total_weight = 0.0;
@@ -487,6 +554,7 @@ static size_t registered_results_to_json_multinode(DICTIONARY *results, BUFFER *
554 RRDHOST *last_host = NULL;
555 RRDCONTEXT_ACQUIRED *last_rca = NULL;
556 RRDINSTANCE_ACQUIRED *last_ria = NULL;
557 + struct dict_unique_node *node_dun = NULL;
558 ssize_t di = -1, ii = -1, ci = -1, ni = -1;
559 ssize_t di_max = 0, ii_max = 0, ci_max = 0, ni_max = 0;
560 dfe_start_read(results, t) {
@@ -522,13 +590,15 @@ static size_t registered_results_to_json_multinode(DICTIONARY *results, BUFFER *
590 // open node
591 if(t->host != last_host) {
592 last_host = t->host;
525 - ni = dict_unique_name_add(dict_nodes, t->host->machine_guid, &ni_max);
593 + node_dun = dict_unique_node_add(dict_nodes, t->host, &ni_max);
594 + ni = node_dun->i;
595 }
596
597 // open context
598 if(t->rca != last_rca) {
599 last_rca = t->rca;
531 - ci = dict_unique_name_add(dict_contexts, rrdcontext_acquired_id(t->rca), &ci_max);
600 + ci = dict_unique_name_units_add(dict_contexts, rrdcontext_acquired_id(t->rca),
601 + rrdcontext_acquired_units(t->rca), &ci_max);
602 }
603
604 // open instance
@@ -544,6 +614,8 @@ static size_t registered_results_to_json_multinode(DICTIONARY *results, BUFFER *
614 context_total_weight += t->value;
615 node_total_weight += t->value;
616
617 + node_dun->duration_ut += t->duration_ut;
618 +
619 storage_point_merge_to(instance_hsp, t->highlighted);
620 storage_point_merge_to(context_hsp, t->highlighted);
621 storage_point_merge_to(node_hsp, t->highlighted);
@@ -575,13 +647,13 @@ static size_t registered_results_to_json_multinode(DICTIONARY *results, BUFFER *
647
648 buffer_json_array_close(wb); // points
649
650 + buffer_json_member_add_object(wb, "dictionaries");
651 buffer_json_member_add_array(wb, "nodes");
652 {
580 - struct dict_unique_name *dun;
653 + struct dict_unique_node *dun;
654 dfe_start_read(dict_nodes, dun) {
655 buffer_json_add_array_item_object(wb);
583 - buffer_json_member_add_string(wb, "mg", dun_dfe.name);
584 - buffer_json_member_add_int64(wb, "ni", dun->i);
656 + buffer_json_node_add_v2(wb, dun->host, dun->i, dun->duration_ut);
657 buffer_json_object_close(wb);
658 }
659 dfe_done(dun);
@@ -590,10 +662,11 @@ static size_t registered_results_to_json_multinode(DICTIONARY *results, BUFFER *
662
663 buffer_json_member_add_array(wb, "contexts");
664 {
593 - struct dict_unique_name *dun;
665 + struct dict_unique_name_units *dun;
666 dfe_start_read(dict_contexts, dun) {
667 buffer_json_add_array_item_object(wb);
668 buffer_json_member_add_string(wb, "id", dun_dfe.name);
669 + buffer_json_member_add_string(wb, "units", dun->units);
670 buffer_json_member_add_int64(wb, "ci", dun->i);
671 buffer_json_object_close(wb);
672 }
@@ -631,6 +704,8 @@ static size_t registered_results_to_json_multinode(DICTIONARY *results, BUFFER *
704 }
705 buffer_json_array_close(wb);
706
707 + buffer_json_object_close(wb); //dictionaries
708 +
709 buffer_json_member_add_uint64(wb, "correlated_dimensions", total_dimensions);
710 buffer_json_member_add_uint64(wb, "total_dimensions_count", examined_dimensions);
711 buffer_json_finalize(wb);
@@ -856,8 +931,9 @@ NETDATA_DOUBLE *rrd2rrdr_ks2(
931 for(size_t tr = 0; tr < storage_tiers ; tr++)
932 stats->db_points_per_tier[tr] += r->internal.qt->db.tiers[tr].points;
933
859 - if(r->d != 1) {
860 - error("WEIGHTS: on query '%s' expected 1 dimension in RRDR but got %zu", r->internal.qt->id, r->d);
934 + if(r->d != 1 || r->internal.qt->query.used != 1) {
935 + error("WEIGHTS: on query '%s' expected 1 dimension in RRDR but got %zu r->d and %zu qt->query.used",
936 + r->internal.qt->id, r->d, (size_t)r->internal.qt->query.used);
937 goto cleanup;
938 }
939
@@ -877,7 +953,7 @@ NETDATA_DOUBLE *rrd2rrdr_ks2(
953 ret = onewayalloc_mallocz(owa, sizeof(NETDATA_DOUBLE) * rrdr_rows(r));
954
955 if(sp)
880 - *sp = r->drs[0];
956 + *sp = r->internal.qt->query.array[0].query_points;
957
958 // copy the points of the dimension to a contiguous array
959 // there is no need to check for empty values, since empty values are already zero
@@ -903,6 +979,7 @@ static void rrdset_metric_correlations_ks2(
979
980 options |= RRDR_OPTION_NATURAL_POINTS;
981
982 + usec_t started_ut = now_monotonic_usec();
983 ONEWAYALLOC *owa = onewayalloc_create(16 * 1024);
984
985 size_t high_points = 0;
@@ -938,9 +1015,12 @@ static void rrdset_metric_correlations_ks2(
1015 prob = 1.0;
1016 }
1017
1018 + usec_t ended_ut = now_monotonic_usec();
1019 +
1020 // to spread the results evenly, 0.0 needs to be the less correlated and 1.0 the most correlated
1021 // so, we flip the result of kstwo()
943 - register_result(results, host, rca, ria, rma, 1.0 - prob, RESULT_IS_BASE_HIGH_RATIO, &highlighted_sp, &baseline_sp, stats, register_zero);
1022 + register_result(results, host, rca, ria, rma, 1.0 - prob, RESULT_IS_BASE_HIGH_RATIO, &highlighted_sp,
1023 + &baseline_sp, stats, register_zero, ended_ut - started_ut);
1024 }
1025
1026 cleanup:
@@ -1021,7 +1101,8 @@ static void rrdset_metric_correlations_volume(
1101 pcent = highlight_countif.value;
1102 }
1103
1024 - register_result(results, host, rca, ria, rma, pcent, flags, &highlight_average.sp, &baseline_average.sp, stats, register_zero);
1104 + register_result(results, host, rca, ria, rma, pcent, flags, &highlight_average.sp, &baseline_average.sp, stats,
1105 + register_zero, baseline_average.duration_ut + highlight_average.duration_ut + highlight_countif.duration_ut);
1106 }
1107
1108 // ----------------------------------------------------------------------------
@@ -1045,7 +1126,7 @@ static void rrdset_weights_value(
1126 merge_query_value_to_stats(&qv, stats, 1);
1127
1128 if(netdata_double_isnumber(qv.value))
1048 - register_result(results, host, rca, ria, rma, qv.value, 0, &qv.sp, NULL, stats, register_zero);
1129 + register_result(results, host, rca, ria, rma, qv.value, 0, &qv.sp, NULL, stats, register_zero, qv.duration_ut);
1130 }
1131
1132 struct query_weights_data {
@@ -1124,7 +1205,7 @@ static void rrdset_weights_multi_dimensional_value(struct query_weights_data *qw
1205
1206 qv.value = cn[d];
1207 qv.anomaly_rate = ar[d];
1127 - qv.sp = *r->drs;
1208 + storage_point_merge_to(qv.sp, r->internal.qt->query.array[d].query_points);
1209
1210 if(netdata_double_isnumber(qv.value)) {
1211 QUERY_METRIC *qm = query_metric(r->internal.qt, d);
@@ -1134,7 +1215,7 @@ static void rrdset_weights_multi_dimensional_value(struct query_weights_data *qw
1215 QUERY_NODE *qn = query_node(r->internal.qt, qm->link.query_node_id);
1216
1217 register_result(qwd->results, qn->rrdhost, qc->rca, qi->ria, qd->rma, qv.value, 0, &qv.sp,
1137 - NULL, &qwd->stats, qwd->register_zero);
1218 + NULL, &qwd->stats, qwd->register_zero, qm->duration_ut);
1219 }
1220
1221 queries++;
@@ -1238,7 +1319,7 @@ static ssize_t weights_for_rrdmetric(void *data, RRDHOST *host, RRDCONTEXT_ACQUI
1319 struct query_weights_data *qwd = data;
1320 QUERY_WEIGHTS_REQUEST *qwr = qwd->qwr;
1321
1241 - qwd->now_us = now_realtime_usec();
1322 + qwd->now_us = now_monotonic_usec();
1323 if(qwd->now_us - qwd->started_us > qwd->timeout_us) {
1324 qwd->timed_out = true;
1325 return -1;
@@ -1375,7 +1456,7 @@ int web_api_v12_weights(BUFFER *wb, QUERY_WEIGHTS_REQUEST *qwr) {
1456 .labels_sp = string_to_simple_pattern(qwr->labels),
1457 .alerts_sp = string_to_simple_pattern(qwr->alerts),
1458 .timeout_us = qwr->timeout_ms * USEC_PER_MS,
1378 - .started_us = now_realtime_usec(),
1459 + .started_us = now_monotonic_usec(),
1460 .timed_out = false,
1461 .examined_dimensions = 0,
1462 .register_zero = true,
@@ -1499,7 +1580,7 @@ int web_api_v12_weights(BUFFER *wb, QUERY_WEIGHTS_REQUEST *qwr) {
1580 if(!(qwr->options & RRDR_OPTION_RETURN_RAW) && qwr->method != WEIGHTS_METHOD_VALUE)
1581 spread_results_evenly(qwd.results, &qwd.stats);
1582
1502 - usec_t ended_usec = now_realtime_usec();
1583 + usec_t ended_usec = now_monotonic_usec();
1584
1585 // generate the json output we need
1586 buffer_flush(wb);
web/api/web_api_v1.c
+1
@@ -46,6 +46,7 @@ static struct {
46 , {"plan" , 0 , RRDR_OPTION_DEBUG}
47 , {"minify" , 0 , RRDR_OPTION_MINIFY}
48 , {"group-by-labels" , 0 , RRDR_OPTION_GROUP_BY_LABELS}
49 + , {"label-quotes" , 0 , RRDR_OPTION_LABEL_QUOTES}
50 , {NULL , 0 , 0}
51 };
52