]> arthur.barton.de Git - netdata.git/blob - web/netdata-swagger.json
Merge pull request #2021 from ktsaou/master
[netdata.git] / web / netdata-swagger.json
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"
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         },
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                 }
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, 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": "format",
137                         "in": "query",
138                         "description": "The format of the data to be returned.",
139                         "required": true,
140                         "type": "string",
141                         "enum": [
142                             "json",
143                             "jsonp",
144                             "csv",
145                             "tsv",
146                             "tsv-excel",
147                             "ssv",
148                             "ssvcomma",
149                             "datatable",
150                             "datasource",
151                             "html",
152                             "array",
153                             "csvjsonarray"
154                         ],
155                         "default": "json",
156                         "allowEmptyValue": false
157                     },
158                     {
159                         "name": "options",
160                         "in": "query",
161                         "description": "Options that affect data generation.",
162                         "required": false,
163                         "type": "array",
164                         "items": {
165                             "type": "string",
166                             "enum": [
167                                 "nonzero",
168                                 "flip",
169                                 "jsonwrap",
170                                 "min2max",
171                                 "seconds",
172                                 "milliseconds",
173                                 "abs",
174                                 "absolute",
175                                 "absolute-sum",
176                                 "null2zero",
177                                 "objectrows",
178                                 "google_json",
179                                 "percentage",
180                                 "unaligned"
181                             ],
182                             "collectionFormat": "pipes"
183                         },
184                         "default": [
185                             "seconds",
186                             "jsonwrap"
187                         ],
188                         "allowEmptyValue": false
189                     },
190                     {
191                         "name": "callback",
192                         "in": "query",
193                         "description": "For JSONP responses, the callback function name.",
194                         "required": false,
195                         "type": "string",
196                         "allowEmptyValue": true
197                     },
198                     {
199                         "name": "filename",
200                         "in": "query",
201                         "description": "Add Content-Disposition: attachment; filename=<filename> header to the response, that will instruct the browser to save the response with the given filename.",
202                         "required": false,
203                         "type": "string",
204                         "allowEmptyValue": true
205                     },
206                     {
207                         "name": "tqx",
208                         "in": "query",
209                         "description": "[Google Visualization API](https://developers.google.com/chart/interactive/docs/dev/implementing_data_source?hl=en) formatted parameter.",
210                         "required": false,
211                         "type": "string",
212                         "allowEmptyValue": true
213                     }
214                 ],
215                 "responses": {
216                     "200": {
217                         "description": "The call was successful. The response should include the data.",
218                         "schema": {
219                             "$ref": "#/definitions/chart"
220                         }
221                     },
222                     "400": {
223                         "description": "Bad request - the body will include a message stating what is wrong."
224                     },
225                     "404": {
226                         "description": "No chart with the given id is found."
227                     },
228                     "500": {
229                         "description": "Internal server error. This usually means the server is out of memory."
230                     }
231                 }
232             }
233         },
234         "/badge.svg": {
235             "get": {
236                 "summary": "Generate a SVG image for a chart (or dimension)",
237                 "description": "Successful responses are SVG images\n",
238                 "parameters": [
239                     {
240                         "name": "chart",
241                         "in": "query",
242                         "description": "The id of the chart as returned by the /charts call.",
243                         "required": true,
244                         "type": "string",
245                         "format": "as returned by /charts",
246                         "allowEmptyValue": false,
247                         "default": "system.cpu"
248                     },
249                     {
250                         "name": "alarm",
251                         "in": "query",
252                         "description": "the name of an alarm linked to the chart",
253                         "required": false,
254                         "type": "string",
255                         "format": "any text",
256                         "allowEmptyValue": true
257                     },
258                     {
259                         "name": "dimension",
260                         "in": "query",
261                         "description": "zero, one or more dimension ids, as returned by the /chart call.",
262                         "required": false,
263                         "type": "array",
264                         "items": {
265                             "type": "string",
266                             "collectionFormat": "pipes",
267                             "format": "as returned by /charts"
268                         },
269                         "allowEmptyValue": false
270                     },
271                     {
272                         "name": "after",
273                         "in": "query",
274                         "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.",
275                         "required": true,
276                         "type": "number",
277                         "format": "integer",
278                         "allowEmptyValue": false,
279                         "default": -600
280                     },
281                     {
282                         "name": "before",
283                         "in": "query",
284                         "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.",
285                         "required": false,
286                         "type": "number",
287                         "format": "integer",
288                         "default": 0
289                     },
290                     {
291                         "name": "group",
292                         "in": "query",
293                         "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).",
294                         "required": true,
295                         "type": "string",
296                         "enum": [
297                             "min",
298                             "max",
299                             "average",
300                             "sum",
301                             "incremental-sum"
302                         ],
303                         "default": "average",
304                         "allowEmptyValue": false
305                     },
306                     {
307                         "name": "options",
308                         "in": "query",
309                         "description": "Options that affect data generation.",
310                         "required": false,
311                         "type": "array",
312                         "items": {
313                             "type": "string",
314                             "enum": [
315                                 "abs",
316                                 "absolute",
317                                 "absolute-sum",
318                                 "null2zero",
319                                 "percentage",
320                                 "unaligned"
321                             ],
322                             "collectionFormat": "pipes"
323                         },
324                         "default": [
325                             "absolute"
326                         ],
327                         "allowEmptyValue": true
328                     },
329                     {
330                         "name": "label",
331                         "in": "query",
332                         "description": "a text to be used as the label",
333                         "required": false,
334                         "type": "string",
335                         "format": "any text",
336                         "allowEmptyValue": true
337                     },
338                     {
339                         "name": "units",
340                         "in": "query",
341                         "description": "a text to be used as the units",
342                         "required": false,
343                         "type": "string",
344                         "format": "any text",
345                         "allowEmptyValue": true
346                     },
347                     {
348                         "name": "label_color",
349                         "in": "query",
350                         "description": "a color to be used for the background of the label",
351                         "required": false,
352                         "type": "string",
353                         "format": "any text",
354                         "allowEmptyValue": true
355                     },
356                     {
357                         "name": "value_color",
358                         "in": "query",
359                         "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).",
360                         "required": false,
361                         "type": "string",
362                         "format": "any text",
363                         "allowEmptyValue": true
364                     },
365                     {
366                         "name": "multiply",
367                         "in": "query",
368                         "description": "multiply the value with this number for rendering it at the image (integer value required)",
369                         "required": false,
370                         "type": "number",
371                         "format": "integer",
372                         "allowEmptyValue": true
373                     },
374                     {
375                         "name": "divide",
376                         "in": "query",
377                         "description": "divide the value with this number for rendering it at the image (integer value required)",
378                         "required": false,
379                         "type": "number",
380                         "format": "integer",
381                         "allowEmptyValue": true
382                     }
383                 ],
384                 "responses": {
385                     "200": {
386                         "description": "The call was successful. The response should be an SVG image."
387                     },
388                     "400": {
389                         "description": "Bad request - the body will include a message stating what is wrong."
390                     },
391                     "404": {
392                         "description": "No chart with the given id is found."
393                     },
394                     "500": {
395                         "description": "Internal server error. This usually means the server is out of memory."
396                     }
397                 }
398             }
399         },
400         "/allmetrics": {
401             "get": {
402                 "summary": "Get a value of all the metrics maintained by netdata",
403                 "description": "The charts endpoint returns the latest value of all charts and dimensions stored in the netdata server.",
404                 "parameters": [
405                     {
406                         "name": "format",
407                         "in": "query",
408                         "description": "The format of the response to be returned",
409                         "required": true,
410                         "type": "string",
411                         "enum": [
412                             "shell",
413                             "prometheus"
414                         ],
415                         "default": "shell"
416                     }
417                 ],
418                 "responses": {
419                     "200": {
420                         "description": "All the metrics returned in the format requested"
421                     },
422                     "400": {
423                         "description": "The format requested is not supported"
424                     }
425                 }
426             }
427         }
428     },
429     "definitions": {
430         "chart_summary": {
431             "type": "object",
432             "properties": {
433                 "hostname": {
434                     "type": "string",
435                     "description": "The hostname of the netdata server."
436                 },
437                 "version": {
438                     "type": "string",
439                     "description": "netdata version of the server."
440                 },
441                 "os": {
442                     "type": "string",
443                     "description": "The netdata server host operating system.",
444                     "enum": [
445                         "macos",
446                         "linux",
447                         "freebsd"
448                     ]
449                 },
450                 "history": {
451                     "type": "number",
452                     "description": "The duration, in seconds, of the round robin database maintained by netdata."
453                 },
454                 "update_every": {
455                     "type": "number",
456                     "description": "The default update frequency of the netdata server. All charts have an update frequency equal or bigger than this."
457                 },
458                 "charts": {
459                     "type": "object",
460                     "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.",
461                     "properties": {
462                         "key": {
463                             "$ref": "#/definitions/chart"
464                         }
465                     }
466                 },
467                 "charts_count": {
468                     "type": "number",
469                     "description": "The number of charts."
470                 },
471                 "dimensions_count": {
472                     "type": "number",
473                     "description": "The total number of dimensions."
474                 },
475                 "alarms_count": {
476                     "type": "number",
477                     "description": "The number of alarms."
478                 },
479                 "rrd_memory_bytes": {
480                     "type": "number",
481                     "description": "The size of the round robin database in bytes."
482                 }
483             }
484         },
485         "chart": {
486             "type": "object",
487             "properties": {
488                 "id": {
489                     "type": "string",
490                     "description": "The unique id of the chart"
491                 },
492                 "name": {
493                     "type": "string",
494                     "description": "The name of the chart"
495                 },
496                 "type": {
497                     "type": "string",
498                     "description": "The type of the chart. Types are not handled by netdata. You can use this field for anything you like."
499                 },
500                 "family": {
501                     "type": "string",
502                     "description": "The family of the chart. Families are not handled by netdata. You can use this field for anything you like."
503                 },
504                 "title": {
505                     "type": "string",
506                     "description": "The title of the chart."
507                 },
508                 "priority": {
509                     "type": "string",
510                     "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."
511                 },
512                 "enabled": {
513                     "type": "boolean",
514                     "description": "True when the chart is enabled. Disabled charts do not currently collect values, but they may have historical values available."
515                 },
516                 "units": {
517                     "type": "string",
518                     "description": "The unit of measurement for the values of all dimensions of the chart."
519                 },
520                 "data_url": {
521                     "type": "string",
522                     "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."
523                 },
524                 "chart_type": {
525                     "type": "string",
526                     "description": "The chart type.",
527                     "enum": [
528                         "line",
529                         "area",
530                         "stacked"
531                     ]
532                 },
533                 "duration": {
534                     "type": "number",
535                     "description": "The duration, in seconds, of the round robin database maintained by netdata."
536                 },
537                 "first_entry": {
538                     "type": "number",
539                     "description": "The UNIX timestamp of the first entry (the oldest) in the round robin database."
540                 },
541                 "last_entry": {
542                     "type": "number",
543                     "description": "The UNIX timestamp of the latest entry in the round robin database."
544                 },
545                 "update_every": {
546                     "type": "number",
547                     "description": "The update frequency of this chart, in seconds. One value every this amount of time is kept in the round robin database."
548                 },
549                 "dimensions": {
550                     "type": "object",
551                     "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.",
552                     "properties": {
553                         "key": {
554                             "$ref": "#/definitions/dimension"
555                         }
556                     }
557                 },
558                 "green": {
559                     "type": "number",
560                     "description": "Chart health green threshold"
561                 },
562                 "red": {
563                     "type": "number",
564                     "description": "Chart health red trheshold"
565                 }
566             }
567         },
568         "dimension": {
569             "type": "object",
570             "properties": {
571                 "name": {
572                     "type": "string",
573                     "description": "The name of the dimension"
574                 }
575             }
576         },
577         "json_wrap": {
578             "type": "object",
579             "properties": {
580                 "api": {
581                     "type": "number",
582                     "description": "The API version this conforms to, currently 1"
583                 },
584                 "id": {
585                     "type": "string",
586                     "description": "The unique id of the chart"
587                 },
588                 "name": {
589                     "type": "string",
590                     "description": "The name of the chart"
591                 },
592                 "update_every": {
593                     "type": "number",
594                     "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)."
595                 },
596                 "view_update_every": {
597                     "type": "number",
598                     "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."
599                 },
600                 "first_entry": {
601                     "type": "number",
602                     "description": "The UNIX timestamp of the first entry (the oldest) in the round robin database (indepedently of the current view)."
603                 },
604                 "last_entry": {
605                     "type": "number",
606                     "description": "The UNIX timestamp of the latest entry in the round robin database (indepedently of the current view)."
607                 },
608                 "after": {
609                     "type": "number",
610                     "description": "The UNIX timestamp of the first entry (the oldest) returned in this response."
611                 },
612                 "before": {
613                     "type": "number",
614                     "description": "The UNIX timestamp of the latest entry returned in this response."
615                 },
616                 "min": {
617                     "type": "number",
618                     "description": "The minimum value returned in the current view. This can be used to size the y-series of the chart."
619                 },
620                 "max": {
621                     "type": "number",
622                     "description": "The maximum value returned in the current view. This can be used to size the y-series of the chart."
623                 },
624                 "dimension_names": {
625                     "description": "The dimension names of the chart as returned in the current view.",
626                     "type": "array",
627                     "items": {
628                         "type": "string"
629                     }
630                 },
631                 "dimension_ids": {
632                     "description": "The dimension IDs of the chart as returned in the current view.",
633                     "type": "array",
634                     "items": {
635                         "type": "string"
636                     }
637                 },
638                 "latest_values": {
639                     "description": "The latest values collected for the chart (indepedently of the current view).",
640                     "type": "array",
641                     "items": {
642                         "type": "string"
643                     }
644                 },
645                 "view_latest_values": {
646                     "description": "The latest values returned with this response.",
647                     "type": "array",
648                     "items": {
649                         "type": "string"
650                     }
651                 },
652                 "dimensions": {
653                     "type": "number",
654                     "description": "The number of dimensions returned."
655                 },
656                 "points": {
657                     "type": "number",
658                     "description": "The number of rows / points returned."
659                 },
660                 "format": {
661                     "type": "string",
662                     "description": "The format of the result returned."
663                 },
664                 "result": {
665                     "description": "The result requested, in the format requested."
666                 }
667             }
668         }
669     }
670 }