]> arthur.barton.de Git - netdata.git/blob - web/netdata-swagger.yaml
Merge pull request #1726 from ktsaou/master
[netdata.git] / web / netdata-swagger.yaml
1 swagger: '2.0'
2 info:
3   title: NetData API
4   description: 'Real time data collection and graphs...'
5   version: 1.4.1_master
6 host: registry.my-netdata.io
7 schemes:
8   - http
9 basePath: /api/v1
10 produces:
11   - application/json
12 paths:
13   /charts:
14     get:
15       summary: 'Get a list of all charts available at the server'
16       description: 'The charts endpoint returns a summary about all charts stored in the netdata server.'
17       responses:
18         '200':
19           description: 'An array of charts'
20           schema:
21             type: array
22             items:
23               $ref: '#/definitions/chart_summary'
24   /chart:
25     get:
26       summary: 'Get info about a specific chart'
27       description: 'The Chart endpoint returns detailed information about a chart.'
28       parameters:
29         - name: chart
30           in: query
31           description: 'The id of the chart as returned by the /charts call.'
32           required: true
33           type: string
34           format: 'as returned by /charts'
35           default: 'system.cpu'
36       responses:
37         '200':
38           description: 'A javascript object with detailed information about the chart.'
39           schema:
40             $ref: '#/definitions/chart'
41         '404':
42           description: 'No chart with the given id is found.'
43   /data:
44     get:
45       summary: 'Get collected data for a specific chart'
46       description: |
47         The Data endpoint returns data stored in the round robin database of a chart.
48       parameters:
49         - name: chart
50           in: query
51           description: 'The id of the chart as returned by the /charts call.'
52           required: true
53           type: string
54           format: 'as returned by /charts'
55           allowEmptyValue: false
56           default: system.cpu
57         - name: dimension
58           in: query
59           description: 'zero, one or more dimension ids, as returned by the /chart call.'
60           required: false
61           type: array
62           items:
63             type: string
64             collectionFormat: pipes
65             format: 'as returned by /charts'
66           allowEmptyValue: false
67         - name: after
68           in: query
69           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).'
70           required: true
71           type: number
72           format: integer
73           allowEmptyValue: false
74           default: -600
75         - name: before
76           in: query
77           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).'
78           required: false
79           type: number
80           format: integer
81           default: 0
82         - name: points
83           in: query
84           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.'
85           required: true
86           type: number
87           format: integer
88           allowEmptyValue: false
89           default: 20
90         - name: group
91           in: query
92           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).'
93           required: true
94           type: string
95           enum: [ 'min', 'max', 'average', 'sum', 'incremental-sum' ]
96           default: 'average'
97           allowEmptyValue: false
98         - name: format
99           in: query
100           description: 'The format of the data to be returned.'
101           required: true
102           type: string
103           enum: [ 'json', 'jsonp', 'csv', 'tsv', 'tsv-excel', 'ssv', 'ssvcomma', 'datatable', 'datasource', 'html', 'array', 'csvjsonarray' ]
104           default: json
105           allowEmptyValue: false
106         - name: options
107           in: query
108           description: 'Options that affect data generation.'
109           required: false
110           type: array
111           items:
112             type: string
113             enum: [ 'nonzero', 'flip', 'jsonwrap', 'min2max', 'seconds', 'milliseconds', 'abs', 'absolute', 'absolute-sum', 'null2zero', 'objectrows', 'google_json', 'percentage', 'unaligned' ]
114             collectionFormat: pipes
115           default: [seconds, jsonwrap]
116           allowEmptyValue: false
117         - name: callback
118           in: query
119           description: 'For JSONP responses, the callback function name.'
120           required: false
121           type: string
122           allowEmptyValue: true
123         - name: filename
124           in: query
125           description: 'Add Content-Disposition: attachment; filename=<filename> header to the response, that will instruct the browser to save the response with the given filename.'
126           required: false
127           type: string
128           allowEmptyValue: true
129         - name: tqx
130           in: query
131           description: '[Google Visualization API](https://developers.google.com/chart/interactive/docs/dev/implementing_data_source?hl=en) formatted parameter.'
132           required: false
133           type: string
134           allowEmptyValue: true
135       responses:
136         '200':
137           description: 'The call was successful. The response should include the data.'
138           schema:
139             $ref: '#/definitions/chart'
140         '400':
141           description: 'Bad request - the body will include a message stating what is wrong.'
142         '404':
143           description: 'No chart with the given id is found.'
144         '500':
145           description: 'Internal server error. This usually means the server is out of memory.'
146   /badge.svg:
147     get:
148       summary: 'Generate a SVG image for a chart (or dimension)'
149       description: |
150         Successful responses are SVG images
151       parameters:
152         - name: chart
153           in: query
154           description: 'The id of the chart as returned by the /charts call.'
155           required: true
156           type: string
157           format: 'as returned by /charts'
158           allowEmptyValue: false
159           default: system.cpu
160         - name: alarm
161           in: query
162           description: 'the name of an alarm linked to the chart'
163           required: false
164           type: string
165           format: 'any text'
166           allowEmptyValue: true
167         - name: dimension
168           in: query
169           description: 'zero, one or more dimension ids, as returned by the /chart call.'
170           required: false
171           type: array
172           items:
173             type: string
174             collectionFormat: pipes
175             format: 'as returned by /charts'
176           allowEmptyValue: false
177         - name: after
178           in: query
179           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.'
180           required: true
181           type: number
182           format: integer
183           allowEmptyValue: false
184           default: -600
185         - name: before
186           in: query
187           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.'
188           required: false
189           type: number
190           format: integer
191           default: 0
192         - name: group
193           in: query
194           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).'
195           required: true
196           type: string
197           enum: [ 'min', 'max', 'average', 'sum', 'incremental-sum' ]
198           default: 'average'
199           allowEmptyValue: false
200         - name: options
201           in: query
202           description: 'Options that affect data generation.'
203           required: false
204           type: array
205           items:
206             type: string
207             enum: [ 'abs', 'absolute', 'absolute-sum', 'null2zero', 'percentage', 'unaligned' ]
208             collectionFormat: pipes
209           default: ['absolute']
210           allowEmptyValue: true
211         - name: label
212           in: query
213           description: 'a text to be used as the label'
214           required: false
215           type: string
216           format: 'any text'
217           allowEmptyValue: true
218         - name: units
219           in: query
220           description: 'a text to be used as the units'
221           required: false
222           type: string
223           format: 'any text'
224           allowEmptyValue: true
225         - name: label_color
226           in: query
227           description: 'a color to be used for the background of the label'
228           required: false
229           type: string
230           format: 'any text'
231           allowEmptyValue: true
232         - name: value_color
233           in: query
234           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).'
235           required: false
236           type: string
237           format: 'any text'
238           allowEmptyValue: true
239         - name: multiply
240           in: query
241           description: 'multiply the value with this number for rendering it at the image (integer value required)'
242           required: false
243           type: number
244           format: integer
245           allowEmptyValue: true
246         - name: divide
247           in: query
248           description: 'divide the value with this number for rendering it at the image (integer value required)'
249           required: false
250           type: number
251           format: integer
252           allowEmptyValue: true
253       responses:
254         '200':
255           description: 'The call was successful. The response should be an SVG image.'
256         '400':
257           description: 'Bad request - the body will include a message stating what is wrong.'
258         '404':
259           description: 'No chart with the given id is found.'
260         '500':
261           description: 'Internal server error. This usually means the server is out of memory.'
262   /allmetrics:
263     get:
264       summary: 'Get a value of all the metrics maintained by netdata'
265       description: 'The charts endpoint returns the latest value of all charts and dimensions stored in the netdata server.'
266       parameters:
267         - name: format
268           in: query
269           description: 'The format of the response to be returned'
270           required: true
271           type: string
272           enum: [ 'shell', 'prometheus' ]
273           default: 'shell'
274       responses:
275         '200':
276           description: 'All the metrics returned in the format requested'
277         '400':
278           description: 'The format requested is not supported'
279 definitions:
280   chart_summary:
281     type: object
282     properties:
283       hostname:
284         type: string
285         description: 'The hostname of the netdata server.'
286       update_every:
287         type: number
288         description: 'The default update frequency of the netdata server. All charts have an update frequency equal or bigger than this.'
289       charts:
290         type: object
291         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.'
292         properties:
293           key:
294               $ref: '#/definitions/chart'
295   chart:
296     type: object
297     properties:
298       id:
299         type: string
300         description: 'The unique id of the chart'
301       name:
302         type: string
303         description: 'The name of the chart'
304       type:
305         type: string
306         description: 'The type of the chart. Types are not handled by netdata. You can use this field for anything you like.'
307       family:
308         type: string
309         description: 'The family of the chart. Families are not handled by netdata. You can use this field for anything you like.'
310       title:
311         type: string
312         description: 'The title of the chart.'
313       priority:
314         type: string
315         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.'
316       enabled:
317         type: boolean
318         description: 'True when the chart is enabled. Disabled charts do not currently collect values, but they may have historical values available.'
319       units:
320         type: string
321         description: 'The unit of measurement for the values of all dimensions of the chart.'
322       data_url:
323         type: string
324         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.'
325       chart_type:
326         type: string
327         description: 'The chart type.'
328         enum: [ 'line', 'area', 'stacked' ]
329       duration:
330         type: number
331         description: 'The duration, in seconds, of the round robin database maintained by netdata.'
332       first_entry:
333         type: number
334         description: 'The UNIX timestamp of the first entry (the oldest) in the round robin database.'
335       last_entry:
336         type: number
337         description: 'The UNIX timestamp of the latest entry in the round robin database.'
338       update_every:
339         type: number
340         description: 'The update frequency of this chart, in seconds. One value every this amount of time is kept in the round robin database.'
341       dimensions:
342         type: object
343         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.'
344         properties:
345           key:
346               $ref: '#/definitions/dimension'
347   dimension:
348     type: object
349     properties:
350       name:
351         type: string
352         description: 'The name of the dimension'
353  
354   json_wrap:
355     type: object
356     properties:
357       api:
358         type: number
359         description: 'The API version this conforms to, currently 1'
360       id:
361         type: string
362         description: 'The unique id of the chart'
363       name:
364         type: string
365         description: 'The name of the chart'
366       update_every:
367         type: number
368         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).'
369       view_update_every:
370         type: number
371         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.'
372       first_entry:
373         type: number
374         description: 'The UNIX timestamp of the first entry (the oldest) in the round robin database (indepedently of the current view).'
375       last_entry:
376         type: number
377         description: 'The UNIX timestamp of the latest entry in the round robin database (indepedently of the current view).'
378       after:
379         type: number
380         description: 'The UNIX timestamp of the first entry (the oldest) returned in this response.'
381       before:
382         type: number
383         description: 'The UNIX timestamp of the latest entry returned in this response.'
384       min:
385         type: number
386         description: 'The minimum value returned in the current view. This can be used to size the y-series of the chart.'
387       max:
388         type: number
389         description: 'The maximum value returned in the current view. This can be used to size the y-series of the chart.'
390       dimension_names:
391         description: 'The dimension names of the chart as returned in the current view.'
392         type: array
393         items:
394           type: string
395       dimension_ids:
396         description: 'The dimension IDs of the chart as returned in the current view.'
397         type: array
398         items:
399           type: string
400       latest_values:
401         description: 'The latest values collected for the chart (indepedently of the current view).'
402         type: array
403         items:
404           type: string
405       view_latest_values:
406         description: 'The latest values returned with this response.'
407         type: array
408         items:
409           type: string
410       dimensions:
411         type: number
412         description: 'The number of dimensions returned.'
413       points:
414         type: number
415         description: 'The number of rows / points returned.'
416       format:
417         type: string
418         description: 'The format of the result returned.'
419       result:
420         description: 'The result requested, in the format requested.'