add api/v1/info endpoint to swagger (#4807)
Wei He committed
Dec 2, 2018 at 09:10 UTC
920bfa9f891863b8efb05413b4feb7793b02f5a5
2 files changed
+112
-5
web/api/netdata-swagger.json
+59
-1
@@ -3,7 +3,7 @@
3
"info": {
4
"title": "NetData API",
5
"description": "Real-time performance and health monitoring.",
6
- "version": "1.9.11_rolling"
6
+ "version": "1.11.1_rolling"
7
},
8
"host": "registry.my-netdata.io",
9
"schemes": [
@@ -15,6 +15,20 @@
15
"application/json"
16
],
17
"paths": {
18
+ "/info": {
19
+ "get": {
20
+ "summary": "Get netdata basic information",
21
+ "description": "The info endpoint returns basic information about netdata. It provides:\n* netdata version\n* netdata unique id\n* list of hosts mirrored (includes itself)\n* number of alarms in the host\n * number of alarms in normal state\n * number of alarms in warning state\n * number of alarms in critical state\n",
22
+ "responses": {
23
+ "200": {
24
+ "description": "netdata basic information",
25
+ "schema": {
26
+ "$ref": "#/definitions/info"
27
+ }
28
+ }
29
+ }
30
+ }
31
+ },
32
"/charts": {
33
"get": {
34
"summary": "Get a list of all charts available at the server",
@@ -534,6 +548,50 @@
548
}
549
},
550
"definitions": {
551
+ "info": {
552
+ "type": "object",
553
+ "properties": {
554
+ "version": {
555
+ "type": "string",
556
+ "description": "netdata version of the server.",
557
+ "example": "1.11.1_rolling"
558
+ },
559
+ "uid": {
560
+ "type": "string",
561
+ "description": "netdata unique id of the server.",
562
+ "example": "24e9fe3c-f2ac-11e8-bafc-0242ac110002"
563
+ },
564
+ "mirrored_hosts": {
565
+ "type": "array",
566
+ "description": "list of hosts mirrored of the server (include itself).",
567
+ "items": {
568
+ "type": "string"
569
+ },
570
+ "example": [
571
+ "host1.example.com",
572
+ "host2.example.com"
573
+ ]
574
+ },
575
+ "alarms": {
576
+ "type": "object",
577
+ "description": "number of alarms in the server.",
578
+ "properties": {
579
+ "normal": {
580
+ "type": "integer",
581
+ "description": "number of alarms in normal state."
582
+ },
583
+ "warning": {
584
+ "type": "integer",
585
+ "description": "number of alarms in warning state."
586
+ },
587
+ "critical": {
588
+ "type": "integer",
589
+ "description": "number of alarms in critical state."
590
+ }
591
+ }
592
+ }
593
+ }
594
+ },
595
"chart_summary": {
596
"type": "object",
597
"properties": {
web/api/netdata-swagger.yaml
+53
-4
@@ -3,7 +3,7 @@ swagger: '2.0'
3
info:
4
title: NetData API
5
description: 'Real-time performance and health monitoring.'
6
- version: 1.11.0_rolling
6
+ version: 1.11.1_rolling
7
host: registry.my-netdata.io
8
schemes:
9
- https
@@ -12,6 +12,23 @@ basePath: /api/v1
12
produces:
13
- application/json
14
paths:
15
+ /info:
16
+ get:
17
+ summary: Get netdata basic information
18
+ description: |
19
+ The info endpoint returns basic information about netdata. It provides:
20
+ * netdata version
21
+ * netdata unique id
22
+ * list of hosts mirrored (includes itself)
23
+ * number of alarms in the host
24
+ * number of alarms in normal state
25
+ * number of alarms in warning state
26
+ * number of alarms in critical state
27
+ responses:
28
+ '200':
29
+ description: netdata basic information
30
+ schema:
31
+ $ref: '#/definitions/info'
32
/charts:
33
get:
34
summary: 'Get a list of all charts available at the server'
@@ -341,6 +358,38 @@ paths:
358
'400':
359
description: 'The format requested is not supported'
360
definitions:
361
+ info:
362
+ type: object
363
+ properties:
364
+ version:
365
+ type: string
366
+ description: netdata version of the server.
367
+ example: 1.11.1_rolling
368
+ uid:
369
+ type: string
370
+ description: netdata unique id of the server.
371
+ example: 24e9fe3c-f2ac-11e8-bafc-0242ac110002
372
+ mirrored_hosts:
373
+ type: array
374
+ description: list of hosts mirrored of the server (include itself).
375
+ items:
376
+ type: string
377
+ example:
378
+ - host1.example.com
379
+ - host2.example.com
380
+ alarms:
381
+ type: object
382
+ description: number of alarms in the server.
383
+ properties:
384
+ normal:
385
+ type: integer
386
+ description: number of alarms in normal state.
387
+ warning:
388
+ type: integer
389
+ description: number of alarms in warning state.
390
+ critical:
391
+ type: integer
392
+ description: number of alarms in critical state.
393
chart_summary:
394
type: object
395
properties:
@@ -365,7 +414,7 @@ definitions:
414
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.'
415
properties:
416
key:
368
- $ref: '#/definitions/chart'
417
+ $ref: '#/definitions/chart'
418
charts_count:
419
type: number
420
description: 'The number of charts.'
@@ -429,7 +478,7 @@ definitions:
478
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.'
479
properties:
480
key:
432
- $ref: '#/definitions/dimension'
481
+ $ref: '#/definitions/dimension'
482
green:
483
type: number
484
description: 'Chart health green threshold'
@@ -442,7 +491,7 @@ definitions:
491
name:
492
type: string
493
description: 'The name of the dimension'
445
-
494
+
495
json_wrap:
496
type: object
497
properties: