@cryptotaxi247 / netdata-1 / commits / 13f5a7764

support prometheus Pushgateway, by eliminating timestamps; fixes #3526

Costa Tsaousis (ktsaou) committed Mar 11, 2018 at 16:30 UTC 13f5a7764db30f48459ef94e100325941f70e774
5 files changed +901 -714
src/backend_prometheus.c
+80 -41
@@ -102,7 +102,7 @@ static inline char *prometheus_units_copy(char *d, const char *s, size_t usable)
102 #define PROMETHEUS_ELEMENT_MAX 256
103 #define PROMETHEUS_LABELS_MAX 1024
104
105 -static void rrd_stats_api_v1_charts_allmetrics_prometheus(RRDHOST *host, BUFFER *wb, const char *prefix, uint32_t options, time_t after, time_t before, int allhosts, int help, int types, int names) {
105 +static void rrd_stats_api_v1_charts_allmetrics_prometheus(RRDHOST *host, BUFFER *wb, const char *prefix, uint32_t options, time_t after, time_t before, int allhosts, int help, int types, int names, int timestamps) {
106 rrdhost_rdlock(host);
107
108 char hostname[PROMETHEUS_ELEMENT_MAX + 1];
@@ -207,18 +207,31 @@ static void rrd_stats_api_v1_charts_allmetrics_prometheus(RRDHOST *host, BUFFER
207 , t
208 );
209
210 - buffer_sprintf(wb
211 - , "%s_%s%s{chart=\"%s\",family=\"%s\",dimension=\"%s\"%s} " COLLECTED_NUMBER_FORMAT " %llu\n"
212 - , prefix
213 - , context
214 - , suffix
215 - , chart
216 - , family
217 - , dimension
218 - , labels
219 - , rd->last_collected_value
220 - , timeval_msec(&rd->last_collected_time)
221 - );
210 + if(timestamps)
211 + buffer_sprintf(wb
212 + , "%s_%s%s{chart=\"%s\",family=\"%s\",dimension=\"%s\"%s} " COLLECTED_NUMBER_FORMAT " %llu\n"
213 + , prefix
214 + , context
215 + , suffix
216 + , chart
217 + , family
218 + , dimension
219 + , labels
220 + , rd->last_collected_value
221 + , timeval_msec(&rd->last_collected_time)
222 + );
223 + else
224 + buffer_sprintf(wb
225 + , "%s_%s%s{chart=\"%s\",family=\"%s\",dimension=\"%s\"%s} " COLLECTED_NUMBER_FORMAT "\n"
226 + , prefix
227 + , context
228 + , suffix
229 + , chart
230 + , family
231 + , dimension
232 + , labels
233 + , rd->last_collected_value
234 + );
235 }
236 else {
237 // the dimensions of the chart, do not have the same algorithm, multiplier or divisor
@@ -253,18 +266,31 @@ static void rrd_stats_api_v1_charts_allmetrics_prometheus(RRDHOST *host, BUFFER
266 , t
267 );
268
256 - buffer_sprintf(wb
257 - , "%s_%s_%s%s{chart=\"%s\",family=\"%s\"%s} " COLLECTED_NUMBER_FORMAT " %llu\n"
258 - , prefix
259 - , context
260 - , dimension
261 - , suffix
262 - , chart
263 - , family
264 - , labels
265 - , rd->last_collected_value
266 - , timeval_msec(&rd->last_collected_time)
267 - );
269 + if(timestamps)
270 + buffer_sprintf(wb
271 + , "%s_%s_%s%s{chart=\"%s\",family=\"%s\"%s} " COLLECTED_NUMBER_FORMAT " %llu\n"
272 + , prefix
273 + , context
274 + , dimension
275 + , suffix
276 + , chart
277 + , family
278 + , labels
279 + , rd->last_collected_value
280 + , timeval_msec(&rd->last_collected_time)
281 + );
282 + else
283 + buffer_sprintf(wb
284 + , "%s_%s_%s%s{chart=\"%s\",family=\"%s\"%s} " COLLECTED_NUMBER_FORMAT "\n"
285 + , prefix
286 + , context
287 + , dimension
288 + , suffix
289 + , chart
290 + , family
291 + , labels
292 + , rd->last_collected_value
293 + );
294 }
295 }
296 else {
@@ -302,18 +328,31 @@ static void rrd_stats_api_v1_charts_allmetrics_prometheus(RRDHOST *host, BUFFER
328 , suffix
329 );
330
305 - buffer_sprintf(wb, "%s_%s%s%s{chart=\"%s\",family=\"%s\",dimension=\"%s\"%s} " CALCULATED_NUMBER_FORMAT " %llu\n"
306 - , prefix
307 - , context
308 - , units
309 - , suffix
310 - , chart
311 - , family
312 - , dimension
313 - , labels
314 - , value
315 - , last_t * MSEC_PER_SEC
316 - );
331 + if(timestamps)
332 + buffer_sprintf(wb, "%s_%s%s%s{chart=\"%s\",family=\"%s\",dimension=\"%s\"%s} " CALCULATED_NUMBER_FORMAT " %llu\n"
333 + , prefix
334 + , context
335 + , units
336 + , suffix
337 + , chart
338 + , family
339 + , dimension
340 + , labels
341 + , value
342 + , last_t * MSEC_PER_SEC
343 + );
344 + else
345 + buffer_sprintf(wb, "%s_%s%s%s{chart=\"%s\",family=\"%s\",dimension=\"%s\"%s} " CALCULATED_NUMBER_FORMAT "\n"
346 + , prefix
347 + , context
348 + , units
349 + , suffix
350 + , chart
351 + , family
352 + , dimension
353 + , labels
354 + , value
355 + );
356 }
357 }
358 }
@@ -374,16 +413,16 @@ static inline time_t prometheus_preparation(RRDHOST *host, BUFFER *wb, uint32_t
413 return after;
414 }
415
377 -void rrd_stats_api_v1_charts_allmetrics_prometheus_single_host(RRDHOST *host, BUFFER *wb, const char *server, const char *prefix, uint32_t options, int help, int types, int names) {
416 +void rrd_stats_api_v1_charts_allmetrics_prometheus_single_host(RRDHOST *host, BUFFER *wb, const char *server, const char *prefix, uint32_t options, int help, int types, int names, int timestamps) {
417 time_t before = now_realtime_sec();
418
419 // we start at the point we had stopped before
420 time_t after = prometheus_preparation(host, wb, options, server, before, help);
421
383 - rrd_stats_api_v1_charts_allmetrics_prometheus(host, wb, prefix, options, after, before, 0, help, types, names);
422 + rrd_stats_api_v1_charts_allmetrics_prometheus(host, wb, prefix, options, after, before, 0, help, types, names, timestamps);
423 }
424
386 -void rrd_stats_api_v1_charts_allmetrics_prometheus_all_hosts(RRDHOST *host, BUFFER *wb, const char *server, const char *prefix, uint32_t options, int help, int types, int names) {
425 +void rrd_stats_api_v1_charts_allmetrics_prometheus_all_hosts(RRDHOST *host, BUFFER *wb, const char *server, const char *prefix, uint32_t options, int help, int types, int names, int timestamps) {
426 time_t before = now_realtime_sec();
427
428 // we start at the point we had stopped before
@@ -391,7 +430,7 @@ void rrd_stats_api_v1_charts_allmetrics_prometheus_all_hosts(RRDHOST *host, BUFF
430
431 rrd_rdlock();
432 rrdhost_foreach_read(host) {
394 - rrd_stats_api_v1_charts_allmetrics_prometheus(host, wb, prefix, options, after, before, 1, help, types, names);
433 + rrd_stats_api_v1_charts_allmetrics_prometheus(host, wb, prefix, options, after, before, 1, help, types, names, timestamps);
434 }
435 rrd_unlock();
436 }
src/backend_prometheus.h
+2 -2
@@ -5,7 +5,7 @@
5 #ifndef NETDATA_BACKEND_PROMETHEUS_H
6 #define NETDATA_BACKEND_PROMETHEUS_H
7
8 -extern void rrd_stats_api_v1_charts_allmetrics_prometheus_single_host(RRDHOST *host, BUFFER *wb, const char *server, const char *prefix, uint32_t options, int help, int types, int names);
9 -extern void rrd_stats_api_v1_charts_allmetrics_prometheus_all_hosts(RRDHOST *host, BUFFER *wb, const char *server, const char *prefix, uint32_t options, int help, int types, int names);
8 +extern void rrd_stats_api_v1_charts_allmetrics_prometheus_single_host(RRDHOST *host, BUFFER *wb, const char *server, const char *prefix, uint32_t options, int help, int types, int names, int timestamps);
9 +extern void rrd_stats_api_v1_charts_allmetrics_prometheus_all_hosts(RRDHOST *host, BUFFER *wb, const char *server, const char *prefix, uint32_t options, int help, int types, int names, int timestamps);
10
11 #endif //NETDATA_BACKEND_PROMETHEUS_H
src/web_api_v1.c
+9 -3
@@ -254,7 +254,7 @@ inline int web_client_api_request_v1_charts(RRDHOST *host, struct web_client *w,
254
255 inline int web_client_api_request_v1_allmetrics(RRDHOST *host, struct web_client *w, char *url) {
256 int format = ALLMETRICS_SHELL;
257 - int help = 0, types = 0, names = backend_send_names; // prometheus options
257 + int help = 0, types = 0, timestamps = 1, names = backend_send_names; // prometheus options
258 const char *prometheus_server = w->client_ip;
259 uint32_t prometheus_options = backend_options;
260 const char *prometheus_prefix = backend_prefix;
@@ -297,6 +297,12 @@ inline int web_client_api_request_v1_allmetrics(RRDHOST *host, struct web_client
297 else
298 names = 0;
299 }
300 + else if(!strcmp(name, "timestamps")) {
301 + if(!strcmp(value, "yes"))
302 + timestamps = 1;
303 + else
304 + timestamps = 0;
305 + }
306 else if(!strcmp(name, "server")) {
307 prometheus_server = value;
308 }
@@ -324,12 +330,12 @@ inline int web_client_api_request_v1_allmetrics(RRDHOST *host, struct web_client
330
331 case ALLMETRICS_PROMETHEUS:
332 w->response.data->contenttype = CT_PROMETHEUS;
327 - rrd_stats_api_v1_charts_allmetrics_prometheus_single_host(host, w->response.data, prometheus_server, prometheus_prefix, prometheus_options, help, types, names);
333 + rrd_stats_api_v1_charts_allmetrics_prometheus_single_host(host, w->response.data, prometheus_server, prometheus_prefix, prometheus_options, help, types, names, timestamps);
334 return 200;
335
336 case ALLMETRICS_PROMETHEUS_ALL_HOSTS:
337 w->response.data->contenttype = CT_PROMETHEUS;
332 - rrd_stats_api_v1_charts_allmetrics_prometheus_all_hosts(host, w->response.data, prometheus_server, prometheus_prefix, prometheus_options, help, types, names);
338 + rrd_stats_api_v1_charts_allmetrics_prometheus_all_hosts(host, w->response.data, prometheus_server, prometheus_prefix, prometheus_options, help, types, names, timestamps);
339 return 200;
340
341 default:
web/netdata-swagger.json
+754 -666
@@ -1,683 +1,771 @@
1 {
2 - "swagger": "2.0",
3 - "info": {
4 - "title": "NetData API",
5 - "description": "Real time data collection and graphs...",
6 - "version": "1.5.1_rolling"
2 + "swagger": "2.0",
3 + "info": {
4 + "title": "NetData API",
5 + "description": "Real time data collection and graphs...",
6 + "version": "1.9.11_rolling"
7 + },
8 + "host": "registry.my-netdata.io",
9 + "schemes": [
10 + "http"
11 + ],
12 + "basePath": "/api/v1",
13 + "produces": [
14 + "application/json"
15 + ],
16 + "paths": {
17 + "/charts": {
18 + "get": {
19 + "summary": "Get a list of all charts available at the server",
20 + "description": "The charts endpoint returns a summary about all charts stored in the netdata server.",
21 + "responses": {
22 + "200": {
23 + "description": "An array of charts",
24 + "schema": {
25 + "type": "array",
26 + "items": {
27 + "$ref": "#/definitions/chart_summary"
28 + }
29 + }
30 + }
31 + }
32 + }
33 },
8 - "host": "registry.my-netdata.io",
9 - "schemes": [
10 - "http"
11 - ],
12 - "basePath": "/api/v1",
13 - "produces": [
14 - "application/json"
15 - ],
16 - "paths": {
17 - "/charts": {
18 - "get": {
19 - "summary": "Get a list of all charts available at the server",
20 - "description": "The charts endpoint returns a summary about all charts stored in the netdata server.",
21 - "responses": {
22 - "200": {
23 - "description": "An array of charts",
24 - "schema": {
25 - "type": "array",
26 - "items": {
27 - "$ref": "#/definitions/chart_summary"
28 - }
29 - }
30 - }
31 - }
34 + "/chart": {
35 + "get": {
36 + "summary": "Get info about a specific chart",
37 + "description": "The Chart endpoint returns detailed information about a chart.",
38 + "parameters": [
39 + {
40 + "name": "chart",
41 + "in": "query",
42 + "description": "The id of the chart as returned by the /charts call.",
43 + "required": true,
44 + "type": "string",
45 + "format": "as returned by /charts",
46 + "default": "system.cpu"
47 + }
48 + ],
49 + "responses": {
50 + "200": {
51 + "description": "A javascript object with detailed information about the chart.",
52 + "schema": {
53 + "$ref": "#/definitions/chart"
54 }
33 - },
34 - "/chart": {
35 - "get": {
36 - "summary": "Get info about a specific chart",
37 - "description": "The Chart endpoint returns detailed information about a chart.",
38 - "parameters": [
39 - {
40 - "name": "chart",
41 - "in": "query",
42 - "description": "The id of the chart as returned by the /charts call.",
43 - "required": true,
44 - "type": "string",
45 - "format": "as returned by /charts",
46 - "default": "system.cpu"
47 - }
48 - ],
49 - "responses": {
50 - "200": {
51 - "description": "A javascript object with detailed information about the chart.",
52 - "schema": {
53 - "$ref": "#/definitions/chart"
54 - }
55 - },
56 - "404": {
57 - "description": "No chart with the given id is found."
58 - }
59 - }
55 + },
56 + "404": {
57 + "description": "No chart with the given id is found."
58 + }
59 + }
60 + }
61 + },
62 + "/data": {
63 + "get": {
64 + "summary": "Get collected data for a specific chart",
65 + "description": "The Data endpoint returns data stored in the round robin database of a chart.\n",
66 + "parameters": [
67 + {
68 + "name": "chart",
69 + "in": "query",
70 + "description": "The id of the chart as returned by the /charts call.",
71 + "required": true,
72 + "type": "string",
73 + "format": "as returned by /charts",
74 + "allowEmptyValue": false,
75 + "default": "system.cpu"
76 + },
77 + {
78 + "name": "dimension",
79 + "in": "query",
80 + "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.",
81 + "required": false,
82 + "type": "array",
83 + "items": {
84 + "type": "string",
85 + "collectionFormat": "pipes",
86 + "format": "as returned by /charts"
87 + },
88 + "allowEmptyValue": false
89 + },
90 + {
91 + "name": "after",
92 + "in": "query",
93 + "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). Netdata will adapt this parameter to the boundaries of the round robin database. The default is the beginning of the round robin database (i.e. by default netdata will attempt to return data for the entire database).",
94 + "required": true,
95 + "type": "number",
96 + "format": "integer",
97 + "allowEmptyValue": false,
98 + "default": -600
99 + },
100 + {
101 + "name": "before",
102 + "in": "query",
103 + "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).",
104 + "required": false,
105 + "type": "number",
106 + "format": "integer",
107 + "default": 0
108 + },
109 + {
110 + "name": "points",
111 + "in": "query",
112 + "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.",
113 + "required": true,
114 + "type": "number",
115 + "format": "integer",
116 + "allowEmptyValue": false,
117 + "default": 20
118 + },
119 + {
120 + "name": "group",
121 + "in": "query",
122 + "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 dimesions to return the most extreme value in either direction).",
123 + "required": true,
124 + "type": "string",
125 + "enum": [
126 + "min",
127 + "max",
128 + "average",
129 + "sum",
130 + "incremental-sum"
131 + ],
132 + "default": "average",
133 + "allowEmptyValue": false
134 + },
135 + {
136 + "name": "gtime",
137 + "in": "query",
138 + "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).",
139 + "required": false,
140 + "type": "number",
141 + "format": "integer",
142 + "allowEmptyValue": false,
143 + "default": 0
144 + },
145 + {
146 + "name": "format",
147 + "in": "query",
148 + "description": "The format of the data to be returned.",
149 + "required": true,
150 + "type": "string",
151 + "enum": [
152 + "json",
153 + "jsonp",
154 + "csv",
155 + "tsv",
156 + "tsv-excel",
157 + "ssv",
158 + "ssvcomma",
159 + "datatable",
160 + "datasource",
161 + "html",
162 + "array",
163 + "csvjsonarray"
164 + ],
165 + "default": "json",
166 + "allowEmptyValue": false
167 + },
168 + {
169 + "name": "options",
170 + "in": "query",
171 + "description": "Options that affect data generation.",
172 + "required": false,
173 + "type": "array",
174 + "items": {
175 + "type": "string",
176 + "enum": [
177 + "nonzero",
178 + "flip",
179 + "jsonwrap",
180 + "min2max",
181 + "seconds",
182 + "milliseconds",
183 + "abs",
184 + "absolute",
185 + "absolute-sum",
186 + "null2zero",
187 + "objectrows",
188 + "google_json",
189 + "percentage",
190 + "unaligned",
191 + "match-ids",
192 + "match-names"
193 + ],
194 + "collectionFormat": "pipes"
195 + },
196 + "default": [
197 + "seconds",
198 + "jsonwrap"
199 + ],
200 + "allowEmptyValue": false
201 + },
202 + {
203 + "name": "callback",
204 + "in": "query",
205 + "description": "For JSONP responses, the callback function name.",
206 + "required": false,
207 + "type": "string",
208 + "allowEmptyValue": true
209 + },
210 + {
211 + "name": "filename",
212 + "in": "query",
213 + "description": "Add Content-Disposition: attachment; filename=<filename> header to the response, that will instruct the browser to save the response with the given filename.",
214 + "required": false,
215 + "type": "string",
216 + "allowEmptyValue": true
217 + },
218 + {
219 + "name": "tqx",
220 + "in": "query",
221 + "description": "[Google Visualization API](https://developers.google.com/chart/interactive/docs/dev/implementing_data_source?hl=en) formatted parameter.",
222 + "required": false,
223 + "type": "string",
224 + "allowEmptyValue": true
225 + }
226 + ],
227 + "responses": {
228 + "200": {
229 + "description": "The call was successful. The response should include the data.",
230 + "schema": {
231 + "$ref": "#/definitions/chart"
232 }
233 + },
234 + "400": {
235 + "description": "Bad request - the body will include a message stating what is wrong."
236 + },
237 + "404": {
238 + "description": "No chart with the given id is found."
239 + },
240 + "500": {
241 + "description": "Internal server error. This usually means the server is out of memory."
242 + }
243 + }
244 + }
245 + },
246 + "/badge.svg": {
247 + "get": {
248 + "summary": "Generate a SVG image for a chart (or dimension)",
249 + "description": "Successful responses are SVG images\n",
250 + "parameters": [
251 + {
252 + "name": "chart",
253 + "in": "query",
254 + "description": "The id of the chart as returned by the /charts call.",
255 + "required": true,
256 + "type": "string",
257 + "format": "as returned by /charts",
258 + "allowEmptyValue": false,
259 + "default": "system.cpu"
260 + },
261 + {
262 + "name": "alarm",
263 + "in": "query",
264 + "description": "the name of an alarm linked to the chart",
265 + "required": false,
266 + "type": "string",
267 + "format": "any text",
268 + "allowEmptyValue": true
269 + },
270 + {
271 + "name": "dimension",
272 + "in": "query",
273 + "description": "zero, one or more dimension ids, as returned by the /chart call.",
274 + "required": false,
275 + "type": "array",
276 + "items": {
277 + "type": "string",
278 + "collectionFormat": "pipes",
279 + "format": "as returned by /charts"
280 + },
281 + "allowEmptyValue": false
282 + },
283 + {
284 + "name": "after",
285 + "in": "query",
286 + "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.",
287 + "required": true,
288 + "type": "number",
289 + "format": "integer",
290 + "allowEmptyValue": false,
291 + "default": -600
292 + },
293 + {
294 + "name": "before",
295 + "in": "query",
296 + "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.",
297 + "required": false,
298 + "type": "number",
299 + "format": "integer",
300 + "default": 0
301 + },
302 + {
303 + "name": "group",
304 + "in": "query",
305 + "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 dimesions to return the most extreme value in either direction).",
306 + "required": true,
307 + "type": "string",
308 + "enum": [
309 + "min",
310 + "max",
311 + "average",
312 + "sum",
313 + "incremental-sum"
314 + ],
315 + "default": "average",
316 + "allowEmptyValue": false
317 + },
318 + {
319 + "name": "options",
320 + "in": "query",
321 + "description": "Options that affect data generation.",
322 + "required": false,
323 + "type": "array",
324 + "items": {
325 + "type": "string",
326 + "enum": [
327 + "abs",
328 + "absolute",
329 + "display-absolute",
330 + "absolute-sum",
331 + "null2zero",
332 + "percentage",
333 + "unaligned"
334 + ],
335 + "collectionFormat": "pipes"
336 + },
337 + "default": [
338 + "absolute"
339 + ],
340 + "allowEmptyValue": true
341 + },
342 + {
343 + "name": "label",
344 + "in": "query",
345 + "description": "a text to be used as the label",
346 + "required": false,
347 + "type": "string",
348 + "format": "any text",
349 + "allowEmptyValue": true
350 + },
351 + {
352 + "name": "units",
353 + "in": "query",
354 + "description": "a text to be used as the units",
355 + "required": false,
356 + "type": "string",
357 + "format": "any text",
358 + "allowEmptyValue": true
359 + },
360 + {
361 + "name": "label_color",
362 + "in": "query",
363 + "description": "a color to be used for the background of the label",
364 + "required": false,
365 + "type": "string",
366 + "format": "any text",
367 + "allowEmptyValue": true
368 + },
369 + {
370 + "name": "value_color",
371 + "in": "query",
372 + "description": "a color to be used for the background of the label. You can set multiple using a pipe with a condition each, like this: color<value|color>value|color:null The following operators are supported: >, <, >=, <=, =, :null (to check if no value exists).",
373 + "required": false,
374 + "type": "string",
375 + "format": "any text",
376 + "allowEmptyValue": true
377 + },
378 + {
379 + "name": "multiply",
380 + "in": "query",
381 + "description": "multiply the value with this number for rendering it at the image (integer value required)",
382 + "required": false,
383 + "type": "number",
384 + "format": "integer",
385 + "allowEmptyValue": true
386 + },
387 + {
388 + "name": "divide",
389 + "in": "query",
390 + "description": "divide the value with this number for rendering it at the image (integer value required)",
391 + "required": false,
392 + "type": "number",
393 + "format": "integer",
394 + "allowEmptyValue": true
395 + },
396 + {
397 + "name": "scale",
398 + "in": "query",
399 + "description": "set the scale of the badge (greater or equal to 100)",
400 + "required": false,
401 + "type": "number",
402 + "format": "integer",
403 + "allowEmptyValue": true
404 + }
405 + ],
406 + "responses": {
407 + "200": {
408 + "description": "The call was successful. The response should be an SVG image."
409 + },
410 + "400": {
411 + "description": "Bad request - the body will include a message stating what is wrong."
412 + },
413 + "404": {
414 + "description": "No chart with the given id is found."
415 + },
416 + "500": {
417 + "description": "Internal server error. This usually means the server is out of memory."
418 + }
419 + }
420 + }
421 + },
422 + "/allmetrics": {
423 + "get": {
424 + "summary": "Get a value of all the metrics maintained by netdata",
425 + "description": "The charts endpoint returns the latest value of all charts and dimensions stored in the netdata server.",
426 + "parameters": [
427 + {
428 + "name": "format",
429 + "in": "query",
430 + "description": "The format of the response to be returned",
431 + "required": true,
432 + "type": "string",
433 + "enum": [
434 + "shell",
435 + "prometheus",
436 + "prometheus_all_hosts",
437 + "json"
438 + ],
439 + "default": "shell"
440 + },
441 + {
442 + "name": "help",
443 + "in": "query",
444 + "description": "enable or disable HELP lines in prometheus output",
445 + "required": false,
446 + "type": "string",
447 + "enum": [
448 + "yes",
449 + "no"
450 + ],
451 + "default": "no"
452 + },
453 + {
454 + "name": "types",
455 + "in": "query",
456 + "description": "enable or disable TYPE lines in prometheus output",
457 + "required": false,
458 + "type": "string",
459 + "enum": [
460 + "yes",
461 + "no"
462 + ],
463 + "default": "no"
464 + },
465 + {
466 + "name": "timestamps",
467 + "in": "query",
468 + "description": "enable or disable timestamps in prometheus output",
469 + "required": false,
470 + "type": "string",
471 + "enum": [
472 + "yes",
473 + "no"
474 + ],
475 + "default": "yes"
476 + },
477 + {
478 + "name": "names",
479 + "in": "query",
480 + "description": "When enabled netdata will report dimension names. When disabled netdata will report dimension IDs. The default is controlled in netdata.conf.",
481 + "required": false,
482 + "type": "string",
483 + "enum": [
484 + "yes",
485 + "no"
486 + ],
487 + "default": "yes"
488 + },
489 + {
490 + "name": "server",
491 + "in": "query",
492 + "description": "Set a distinct name of the client querying prometheus metrics. Netdata will use the client IP if this is not set.",
493 + "required": false,
494 + "type": "string",
495 + "format": "any text"
496 + },
497 + {
498 + "name": "prefix",
499 + "in": "query",
500 + "description": "Prefix all prometheus metrics with this string.",
501 + "required": false,
502 + "type": "string",
503 + "format": "any text"
504 + },
505 + {
506 + "name": "data",
507 + "in": "query",
508 + "description": "Select the prometheus response data source. The default is controlled in netdata.conf",
509 + "required": false,
510 + "type": "string",
511 + "enum": [
512 + "as-collected",
513 + "average",
514 + "sum"
515 + ],
516 + "default": "average"
517 + }
518 + ],
519 + "responses": {
520 + "200": {
521 + "description": "All the metrics returned in the format requested"
522 + },
523 + "400": {
524 + "description": "The format requested is not supported"
525 + }
526 + }
527 + }
528 + }
529 + },
530 + "definitions": {
531 + "chart_summary": {
532 + "type": "object",
533 + "properties": {
534 + "hostname": {
535 + "type": "string",
536 + "description": "The hostname of the netdata server."
537 },
62 - "/data": {
63 - "get": {
64 - "summary": "Get collected data for a specific chart",
65 - "description": "The Data endpoint returns data stored in the round robin database of a chart.\n",
66 - "parameters": [
67 - {
68 - "name": "chart",
69 - "in": "query",
70 - "description": "The id of the chart as returned by the /charts call.",
71 - "required": true,
72 - "type": "string",
73 - "format": "as returned by /charts",
74 - "allowEmptyValue": false,
75 - "default": "system.cpu"
76 - },
77 - {
78 - "name": "dimension",
79 - "in": "query",
80 - "description": "zero, one or more dimension ids, as returned by the /chart call.",
81 - "required": false,
82 - "type": "array",
83 - "items": {
84 - "type": "string",
85 - "collectionFormat": "pipes",
86 - "format": "as returned by /charts"
87 - },
88 - "allowEmptyValue": false
89 - },
90 - {
91 - "name": "after",
92 - "in": "query",
93 - "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). Netdata will adapt this parameter to the boundaries of the round robin database. The default is the beginning of the round robin database (i.e. by default netdata will attempt to return data for the entire database).",
94 - "required": true,
95 - "type": "number",
96 - "format": "integer",
97 - "allowEmptyValue": false,
98 - "default": -600
99 - },
100 - {
101 - "name": "before",
102 - "in": "query",
103 - "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).",
104 - "required": false,
105 - "type": "number",
106 - "format": "integer",
107 - "default": 0
108 - },
109 - {
110 - "name": "points",
111 - "in": "query",
112 - "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.",
113 - "required": true,
114 - "type": "number",
115 - "format": "integer",
116 - "allowEmptyValue": false,
117 - "default": 20
118 - },
119 - {
120 - "name": "group",
121 - "in": "query",
122 - "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 dimesions to return the most extreme value in either direction).",
123 - "required": true,
124 - "type": "string",
125 - "enum": [
126 - "min",
127 - "max",
128 - "average",
129 - "sum",
130 - "incremental-sum"
131 - ],
132 - "default": "average",
133 - "allowEmptyValue": false
134 - },
135 - {
136 - "name": "gtime",
137 - "in": "query",
138 - "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).",
139 - "required": false,
140 - "type": "number",
141 - "format": "integer",
142 - "allowEmptyValue": false,
143 - "default": 0
144 - },
145 - {
146 - "name": "format",
147 - "in": "query",
148 - "description": "The format of the data to be returned.",
149 - "required": true,
150 - "type": "string",
151 - "enum": [
152 - "json",
153 - "jsonp",
154 - "csv",
155 - "tsv",
156 - "tsv-excel",
157 - "ssv",
158 - "ssvcomma",
159 - "datatable",
160 - "datasource",
161 - "html",
162 - "array",
163 - "csvjsonarray"
164 - ],
165 - "default": "json",
166 - "allowEmptyValue": false
167 - },
168 - {
169 - "name": "options",
170 - "in": "query",
171 - "description": "Options that affect data generation.",
172 - "required": false,
173 - "type": "array",
174 - "items": {
175 - "type": "string",
176 - "enum": [
177 - "nonzero",
178 - "flip",
179 - "jsonwrap",
180 - "min2max",
181 - "seconds",
182 - "milliseconds",
183 - "abs",
184 - "absolute",
185 - "absolute-sum",
186 - "null2zero",
187 - "objectrows",
188 - "google_json",
189 - "percentage",
190 - "unaligned",
191 - "match-ids",
192 - "match-names"
193 - ],
194 - "collectionFormat": "pipes"
195 - },
196 - "default": [
197 - "seconds",
198 - "jsonwrap"
199 - ],
200 - "allowEmptyValue": false
201 - },
202 - {
203 - "name": "callback",
204 - "in": "query",
205 - "description": "For JSONP responses, the callback function name.",
206 - "required": false,
207 - "type": "string",
208 - "allowEmptyValue": true
209 - },
210 - {
211 - "name": "filename",
212 - "in": "query",
213 - "description": "Add Content-Disposition: attachment; filename=<filename> header to the response, that will instruct the browser to save the response with the given filename.",
214 - "required": false,
215 - "type": "string",
216 - "allowEmptyValue": true
217 - },
218 - {
219 - "name": "tqx",
220 - "in": "query",
221 - "description": "[Google Visualization API](https://developers.google.com/chart/interactive/docs/dev/implementing_data_source?hl=en) formatted parameter.",
222 - "required": false,
223 - "type": "string",
224 - "allowEmptyValue": true
225 - }
226 - ],
227 - "responses": {
228 - "200": {
229 - "description": "The call was successful. The response should include the data.",
230 - "schema": {
231 - "$ref": "#/definitions/chart"
232 - }
233 - },
234 - "400": {
235 - "description": "Bad request - the body will include a message stating what is wrong."
236 - },
237 - "404": {
238 - "description": "No chart with the given id is found."
239 - },
240 - "500": {
241 - "description": "Internal server error. This usually means the server is out of memory."
242 - }
243 - }
244 - }
538 + "version": {
539 + "type": "string",
540 + "description": "netdata version of the server."
541 },
246 - "/badge.svg": {
247 - "get": {
248 - "summary": "Generate a SVG image for a chart (or dimension)",
249 - "description": "Successful responses are SVG images\n",
250 - "parameters": [
251 - {
252 - "name": "chart",
253 - "in": "query",
254 - "description": "The id of the chart as returned by the /charts call.",
255 - "required": true,
256 - "type": "string",
257 - "format": "as returned by /charts",
258 - "allowEmptyValue": false,
259 - "default": "system.cpu"
260 - },
261 - {
262 - "name": "alarm",
263 - "in": "query",
264 - "description": "the name of an alarm linked to the chart",
265 - "required": false,
266 - "type": "string",
267 - "format": "any text",
268 - "allowEmptyValue": true
269 - },
270 - {
271 - "name": "dimension",
272 - "in": "query",
273 - "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.",
274 - "required": false,
275 - "type": "array",
276 - "items": {
277 - "type": "string",
278 - "collectionFormat": "pipes",
279 - "format": "as returned by /charts"
280 - },
281 - "allowEmptyValue": false
282 - },
283 - {
284 - "name": "after",
285 - "in": "query",
286 - "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.",
287 - "required": true,
288 - "type": "number",
289 - "format": "integer",
290 - "allowEmptyValue": false,
291 - "default": -600
292 - },
293 - {
294 - "name": "before",
295 - "in": "query",
296 - "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.",
297 - "required": false,
298 - "type": "number",
299 - "format": "integer",
300 - "default": 0
301 - },
302 - {
303 - "name": "group",
304 - "in": "query",
305 - "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 dimesions to return the most extreme value in either direction).",
306 - "required": true,
307 - "type": "string",
308 - "enum": [
309 - "min",
310 - "max",
311 - "average",
312 - "sum",
313 - "incremental-sum"
314 - ],
315 - "default": "average",
316 - "allowEmptyValue": false
317 - },
318 - {
319 - "name": "options",
320 - "in": "query",
321 - "description": "Options that affect data generation.",
322 - "required": false,
323 - "type": "array",
324 - "items": {
325 - "type": "string",
326 - "enum": [
327 - "abs",
328 - "absolute",
329 - "display-absolute",
330 - "absolute-sum",
331 - "null2zero",
332 - "percentage",
333 - "unaligned"
334 - ],
335 - "collectionFormat": "pipes"
336 - },
337 - "default": [
338 - "absolute"
339 - ],
340 - "allowEmptyValue": true
341 - },
342 - {
343 - "name": "label",
344 - "in": "query",
345 - "description": "a text to be used as the label",
346 - "required": false,
347 - "type": "string",
348 - "format": "any text",
349 - "allowEmptyValue": true
350 - },
351 - {
352 - "name": "units",
353 - "in": "query",
354 - "description": "a text to be used as the units",
355 - "required": false,
356 - "type": "string",
357 - "format": "any text",
358 - "allowEmptyValue": true
359 - },
360 - {
361 - "name": "label_color",
362 - "in": "query",
363 - "description": "a color to be used for the background of the label",
364 - "required": false,
365 - "type": "string",
366 - "format": "any text",
367 - "allowEmptyValue": true
368 - },
369 - {
370 - "name": "value_color",
371 - "in": "query",
372 - "description": "a color to be used for the background of the label. You can set multiple using a pipe with a condition each, like this: color<value|color>value|color:null The following operators are supported: >, <, >=, <=, =, :null (to check if no value exists).",
373 - "required": false,
374 - "type": "string",
375 - "format": "any text",
376 - "allowEmptyValue": true
377 - },
378 - {
379 - "name": "multiply",
380 - "in": "query",
381 - "description": "multiply the value with this number for rendering it at the image (integer value required)",
382 - "required": false,
383 - "type": "number",
384 - "format": "integer",
385 - "allowEmptyValue": true
386 - },
387 - {
388 - "name": "divide",
389 - "in": "query",
390 - "description": "divide the value with this number for rendering it at the image (integer value required)",
391 - "required": false,
392 - "type": "number",
393 - "format": "integer",
394 - "allowEmptyValue": true
395 - }
396 - ],
397 - "responses": {
398 - "200": {
399 - "description": "The call was successful. The response should be an SVG image."
400 - },
401 - "400": {
402 - "description": "Bad request - the body will include a message stating what is wrong."
403 - },
404 - "404": {
405 - "description": "No chart with the given id is found."
406 - },
407 - "500": {
408 - "description": "Internal server error. This usually means the server is out of memory."
409 - }
410 - }
411 - }
542 + "os": {
543 + "type": "string",
544 + "description": "The netdata server host operating system.",
545 + "enum": [
546 + "macos",
547 + "linux",
548 + "freebsd"
549 + ]
550 + },
551 + "history": {
552 + "type": "number",
553 + "description": "The duration, in seconds, of the round robin database maintained by netdata."
554 + },
555 + "update_every": {
556 + "type": "number",
557 + "description": "The default update frequency of the netdata server. All charts have an update frequency equal or bigger than this."
558 },
413 - "/allmetrics": {
414 - "get": {
415 - "summary": "Get a value of all the metrics maintained by netdata",
416 - "description": "The charts endpoint returns the latest value of all charts and dimensions stored in the netdata server.",
417 - "parameters": [
418 - {
419 - "name": "format",
420 - "in": "query",
421 - "description": "The format of the response to be returned",
422 - "required": true,
423 - "type": "string",
424 - "enum": [
425 - "shell",
426 - "prometheus"
427 - ],
428 - "default": "shell"
429 - }
430 - ],
431 - "responses": {
432 - "200": {
433 - "description": "All the metrics returned in the format requested"
434 - },
435 - "400": {
436 - "description": "The format requested is not supported"
437 - }
438 - }
559 + "charts": {
560 + "type": "object",
561 + "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.",
562 + "properties": {
563 + "key": {
564 + "$ref": "#/definitions/chart"
565 }
566 + }
567 + },
568 + "charts_count": {
569 + "type": "number",
570 + "description": "The number of charts."
571 + },
572 + "dimensions_count": {
573 + "type": "number",
574 + "description": "The total number of dimensions."
575 + },
576 + "alarms_count": {
577 + "type": "number",
578 + "description": "The number of alarms."
579 + },
580 + "rrd_memory_bytes": {
581 + "type": "number",
582 + "description": "The size of the round robin database in bytes."
583 }
584 + }
585 },
442 - "definitions": {
443 - "chart_summary": {
444 - "type": "object",
445 - "properties": {
446 - "hostname": {
447 - "type": "string",
448 - "description": "The hostname of the netdata server."
449 - },
450 - "version": {
451 - "type": "string",
452 - "description": "netdata version of the server."
453 - },
454 - "os": {
455 - "type": "string",
456 - "description": "The netdata server host operating system.",
457 - "enum": [
458 - "macos",
459 - "linux",
460 - "freebsd"
461 - ]
462 - },
463 - "history": {
464 - "type": "number",
465 - "description": "The duration, in seconds, of the round robin database maintained by netdata."
466 - },
467 - "update_every": {
468 - "type": "number",
469 - "description": "The default update frequency of the netdata server. All charts have an update frequency equal or bigger than this."
470 - },
471 - "charts": {
472 - "type": "object",
473 - "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.",
474 - "properties": {
475 - "key": {
476 - "$ref": "#/definitions/chart"
477 - }
478 - }
479 - },
480 - "charts_count": {
481 - "type": "number",
482 - "description": "The number of charts."
483 - },
484 - "dimensions_count": {
485 - "type": "number",
486 - "description": "The total number of dimensions."
487 - },
488 - "alarms_count": {
489 - "type": "number",
490 - "description": "The number of alarms."
491 - },
492 - "rrd_memory_bytes": {
493 - "type": "number",
494 - "description": "The size of the round robin database in bytes."
495 - }
496 - }
586 + "chart": {
587 + "type": "object",
588 + "properties": {
589 + "id": {
590 + "type": "string",
591 + "description": "The unique id of the chart"
592 },
498 - "chart": {
499 - "type": "object",
500 - "properties": {
501 - "id": {
502 - "type": "string",
503 - "description": "The unique id of the chart"
504 - },
505 - "name": {
506 - "type": "string",
507 - "description": "The name of the chart"
508 - },
509 - "type": {
510 - "type": "string",
511 - "description": "The type of the chart. Types are not handled by netdata. You can use this field for anything you like."
512 - },
513 - "family": {
514 - "type": "string",
515 - "description": "The family of the chart. Families are not handled by netdata. You can use this field for anything you like."
516 - },
517 - "title": {
518 - "type": "string",
519 - "description": "The title of the chart."
520 - },
521 - "priority": {
522 - "type": "string",
523 - "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."
524 - },
525 - "enabled": {
526 - "type": "boolean",
527 - "description": "True when the chart is enabled. Disabled charts do not currently collect values, but they may have historical values available."
528 - },
529 - "units": {
530 - "type": "string",
531 - "description": "The unit of measurement for the values of all dimensions of the chart."
532 - },
533 - "data_url": {
534 - "type": "string",
535 - "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."
536 - },
537 - "chart_type": {
538 - "type": "string",
539 - "description": "The chart type.",
540 - "enum": [
541 - "line",
542 - "area",
543 - "stacked"
544 - ]
545 - },
546 - "duration": {
547 - "type": "number",
548 - "description": "The duration, in seconds, of the round robin database maintained by netdata."
549 - },
550 - "first_entry": {
551 - "type": "number",
552 - "description": "The UNIX timestamp of the first entry (the oldest) in the round robin database."
553 - },
554 - "last_entry": {
555 - "type": "number",
556 - "description": "The UNIX timestamp of the latest entry in the round robin database."
557 - },
558 - "update_every": {
559 - "type": "number",
560 - "description": "The update frequency of this chart, in seconds. One value every this amount of time is kept in the round robin database."
561 - },
562 - "dimensions": {
563 - "type": "object",
564 - "description": "An object containing all the chart dimensions available for the chart. This is used as an indexed array. The key of the object the id of the dimension.",
565 - "properties": {
566 - "key": {
567 - "$ref": "#/definitions/dimension"
568 - }
569 - }
570 - },
571 - "green": {
572 - "type": "number",
573 - "description": "Chart health green threshold"
574 - },
575 - "red": {
576 - "type": "number",
577 - "description": "Chart health red trheshold"
578 - }
579 - }
593 + "name": {
594 + "type": "string",
595 + "description": "The name of the chart"
596 },
581 - "dimension": {
582 - "type": "object",
583 - "properties": {
584 - "name": {
585 - "type": "string",
586 - "description": "The name of the dimension"
587 - }
588 - }
597 + "type": {
598 + "type": "string",
599 + "description": "The type of the chart. Types are not handled by netdata. You can use this field for anything you like."
600 + },
601 + "family": {
602 + "type": "string",
603 + "description": "The family of the chart. Families are not handled by netdata. You can use this field for anything you like."
604 + },
605 + "title": {
606 + "type": "string",
607 + "description": "The title of the chart."
608 + },
609 + "priority": {
610 + "type": "string",
611 + "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."
612 + },
613 + "enabled": {
614 + "type": "boolean",
615 + "description": "True when the chart is enabled. Disabled charts do not currently collect values, but they may have historical values available."
616 + },
617 + "units": {
618 + "type": "string",
619 + "description": "The unit of measurement for the values of all dimensions of the chart."
620 + },
621 + "data_url": {
622 + "type": "string",
623 + "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."
624 + },
625 + "chart_type": {
626 + "type": "string",
627 + "description": "The chart type.",
628 + "enum": [
629 + "line",
630 + "area",
631 + "stacked"
632 + ]
633 },
590 - "json_wrap": {
591 - "type": "object",
592 - "properties": {
593 - "api": {
594 - "type": "number",
595 - "description": "The API version this conforms to, currently 1"
596 - },
597 - "id": {
598 - "type": "string",
599 - "description": "The unique id of the chart"
600 - },
601 - "name": {
602 - "type": "string",
603 - "description": "The name of the chart"
604 - },
605 - "update_every": {
606 - "type": "number",
607 - "description": "The update frequency of this chart, in seconds. One value every this amount of time is kept in the round robin database (indepedently of the current view)."
608 - },
609 - "view_update_every": {
610 - "type": "number",
611 - "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."
612 - },
613 - "first_entry": {
614 - "type": "number",
615 - "description": "The UNIX timestamp of the first entry (the oldest) in the round robin database (indepedently of the current view)."
616 - },
617 - "last_entry": {
618 - "type": "number",
619 - "description": "The UNIX timestamp of the latest entry in the round robin database (indepedently of the current view)."
620 - },
621 - "after": {
622 - "type": "number",
623 - "description": "The UNIX timestamp of the first entry (the oldest) returned in this response."
624 - },
625 - "before": {
626 - "type": "number",
627 - "description": "The UNIX timestamp of the latest entry returned in this response."
628 - },
629 - "min": {
630 - "type": "number",
631 - "description": "The minimum value returned in the current view. This can be used to size the y-series of the chart."
632 - },
633 - "max": {
634 - "type": "number",
635 - "description": "The maximum value returned in the current view. This can be used to size the y-series of the chart."
636 - },
637 - "dimension_names": {
638 - "description": "The dimension names of the chart as returned in the current view.",
639 - "type": "array",
640 - "items": {
641 - "type": "string"
642 - }
643 - },
644 - "dimension_ids": {
645 - "description": "The dimension IDs of the chart as returned in the current view.",
646 - "type": "array",
647 - "items": {
648 - "type": "string"
649 - }
650 - },
651 - "latest_values": {
652 - "description": "The latest values collected for the chart (indepedently of the current view).",
653 - "type": "array",
654 - "items": {
655 - "type": "string"
656 - }
657 - },
658 - "view_latest_values": {
659 - "description": "The latest values returned with this response.",
660 - "type": "array",
661 - "items": {
662 - "type": "string"
663 - }
664 - },
665 - "dimensions": {
666 - "type": "number",
667 - "description": "The number of dimensions returned."
668 - },
669 - "points": {
670 - "type": "number",
671 - "description": "The number of rows / points returned."
672 - },
673 - "format": {
674 - "type": "string",
675 - "description": "The format of the result returned."
676 - },
677 - "result": {
678 - "description": "The result requested, in the format requested."
679 - }
634 + "duration": {
635 + "type": "number",
636 + "description": "The duration, in seconds, of the round robin database maintained by netdata."
637 + },
638 + "first_entry": {
639 + "type": "number",
640 + "description": "The UNIX timestamp of the first entry (the oldest) in the round robin database."
641 + },
642 + "last_entry": {
643 + "type": "number",
644 + "description": "The UNIX timestamp of the latest entry in the round robin database."
645 + },
646 + "update_every": {
647 + "type": "number",
648 + "description": "The update frequency of this chart, in seconds. One value every this amount of time is kept in the round robin database."
649 + },
650 + "dimensions": {
651 + "type": "object",
652 + "description": "An object containing all the chart dimensions available for the chart. This is used as an indexed array. The key of the object the id of the dimension.",
653 + "properties": {
654 + "key": {
655 + "$ref": "#/definitions/dimension"
656 }
657 + }
658 + },
659 + "green": {
660 + "type": "number",
661 + "description": "Chart health green threshold"
662 + },
663 + "red": {
664 + "type": "number",
665 + "description": "Chart health red trheshold"
666 + }
667 + }
668 + },
669 + "dimension": {
670 + "type": "object",
671 + "properties": {
672 + "name": {
673 + "type": "string",
674 + "description": "The name of the dimension"
675 + }
676 + }
677 + },
678 + "json_wrap": {
679 + "type": "object",
680 + "properties": {
681 + "api": {
682 + "type": "number",
683 + "description": "The API version this conforms to, currently 1"
684 + },
685 + "id": {
686 + "type": "string",
687 + "description": "The unique id of the chart"
688 + },
689 + "name": {
690 + "type": "string",
691 + "description": "The name of the chart"
692 + },
693 + "update_every": {
694 + "type": "number",
695 + "description": "The update frequency of this chart, in seconds. One value every this amount of time is kept in the round robin database (indepedently of the current view)."
696 + },
697 + "view_update_every": {
698 + "type": "number",
699 + "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."
700 + },
701 + "first_entry": {
702 + "type": "number",
703 + "description": "The UNIX timestamp of the first entry (the oldest) in the round robin database (indepedently of the current view)."
704 + },
705 + "last_entry": {
706 + "type": "number",
707 + "description": "The UNIX timestamp of the latest entry in the round robin database (indepedently of the current view)."
708 + },
709 + "after": {
710 + "type": "number",
711 + "description": "The UNIX timestamp of the first entry (the oldest) returned in this response."
712 + },
713 + "before": {
714 + "type": "number",
715 + "description": "The UNIX timestamp of the latest entry returned in this response."
716 + },
717 + "min": {
718 + "type": "number",
719 + "description": "The minimum value returned in the current view. This can be used to size the y-series of the chart."
720 + },
721 + "max": {
722 + "type": "number",
723 + "description": "The maximum value returned in the current view. This can be used to size the y-series of the chart."
724 + },
725 + "dimension_names": {
726 + "description": "The dimension names of the chart as returned in the current view.",
727 + "type": "array",
728 + "items": {
729 + "type": "string"
730 + }
731 + },
732 + "dimension_ids": {
733 + "description": "The dimension IDs of the chart as returned in the current view.",
734 + "type": "array",
735 + "items": {
736 + "type": "string"
737 + }
738 + },
739 + "latest_values": {
740 + "description": "The latest values collected for the chart (indepedently of the current view).",
741 + "type": "array",
742 + "items": {
743 + "type": "string"
744 + }
745 + },
746 + "view_latest_values": {
747 + "description": "The latest values returned with this response.",
748 + "type": "array",
749 + "items": {
750 + "type": "string"
751 + }
752 + },
753 + "dimensions": {
754 + "type": "number",
755 + "description": "The number of dimensions returned."
756 + },
757 + "points": {
758 + "type": "number",
759 + "description": "The number of rows / points returned."
760 + },
761 + "format": {
762 + "type": "string",
763 + "description": "The format of the result returned."
764 + },
765 + "result": {
766 + "description": "The result requested, in the format requested."
767 }
768 + }
769 }
770 + }
771 }
\ No newline at end of file
web/netdata-swagger.yaml
+56 -2
@@ -2,7 +2,7 @@ swagger: '2.0'
2 info:
3 title: NetData API
4 description: 'Real time data collection and graphs...'
5 - version: 1.5.1_rolling
5 + version: 1.9.11_rolling
6 host: registry.my-netdata.io
7 schemes:
8 - http
@@ -258,6 +258,13 @@ paths:
258 type: number
259 format: integer
260 allowEmptyValue: true
261 + - name: scale
262 + in: query
263 + description: 'set the scale of the badge (greater or equal to 100)'
264 + required: false
265 + type: number
266 + format: integer
267 + allowEmptyValue: true
268 responses:
269 '200':
270 description: 'The call was successful. The response should be an SVG image.'
@@ -277,8 +284,55 @@ paths:
284 description: 'The format of the response to be returned'
285 required: true
286 type: string
280 - enum: [ 'shell', 'prometheus' ]
287 + enum: [ 'shell', 'prometheus', 'prometheus_all_hosts', 'json' ]
288 default: 'shell'
289 + - name: help
290 + in: query
291 + description: 'enable or disable HELP lines in prometheus output'
292 + required: false
293 + type: string
294 + enum: [ 'yes', 'no' ]
295 + default: 'no'
296 + - name: types
297 + in: query
298 + description: 'enable or disable TYPE lines in prometheus output'
299 + required: false
300 + type: string
301 + enum: [ 'yes', 'no' ]
302 + default: 'no'
303 + - name: timestamps
304 + in: query
305 + description: 'enable or disable timestamps in prometheus output'
306 + required: false
307 + type: string
308 + enum: [ 'yes', 'no' ]
309 + default: 'yes'
310 + - name: names
311 + in: query
312 + description: 'When enabled netdata will report dimension names. When disabled netdata will report dimension IDs. The default is controlled in netdata.conf.'
313 + required: false
314 + type: string
315 + enum: [ 'yes', 'no' ]
316 + default: 'yes'
317 + - name: server
318 + in: query
319 + description: 'Set a distinct name of the client querying prometheus metrics. Netdata will use the client IP if this is not set.'
320 + required: false
321 + type: string
322 + format: 'any text'
323 + - name: prefix
324 + in: query
325 + description: 'Prefix all prometheus metrics with this string.'
326 + required: false
327 + type: string
328 + format: 'any text'
329 + - name: data
330 + in: query
331 + description: 'Select the prometheus response data source. The default is controlled in netdata.conf'
332 + required: false
333 + type: string
334 + enum: [ 'as-collected', 'average', 'sum' ]
335 + default: 'average'
336 responses:
337 '200':
338 description: 'All the metrics returned in the format requested'