Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

info API minor enhancements #5891

Merged
merged 1 commit into from May 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions web/api/formatters/charts2json.c
Expand Up @@ -136,6 +136,18 @@ void charts2json(RRDHOST *host, BUFFER *wb) {
buffer_sprintf(wb, "\n\t]\n}\n");
}

// generate collectors list for the api/v1/info call

struct collector {
char *plugin;
char *module;
};

struct array_printer {
int c;
BUFFER *wb;
};

int print_collector(void *entry, void *data) {
struct array_printer *ap = (struct array_printer *)data;
BUFFER *wb = ap->wb;
Expand Down
10 changes: 0 additions & 10 deletions web/api/formatters/charts2json.h
Expand Up @@ -5,16 +5,6 @@

#include "rrd2json.h"

struct collector {
char *plugin;
char *module;
};

struct array_printer {
int c;
BUFFER *wb;
};

extern void charts2json(RRDHOST *host, BUFFER *wb);
extern void chartcollectors2json(RRDHOST *host, BUFFER *wb);

Expand Down
89 changes: 88 additions & 1 deletion web/api/netdata-swagger.json
Expand Up @@ -18,13 +18,16 @@
"/info": {
"get": {
"summary": "Get netdata basic information",
"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",
"description": "The info endpoint returns basic information about netdata. It provides:\n* netdata version\n* netdata unique id\n* list of hosts mirrored (includes itself)\n* Operating System, Virtualization and Container technology information\n* List of active collector plugins and modules\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",
"responses": {
"200": {
"description": "netdata basic information",
"schema": {
"$ref": "#/definitions/info"
}
},
"503": {
"description": "netdata daemon not ready (used for health checks)"
}
}
}
Expand Down Expand Up @@ -706,6 +709,90 @@
"host2.example.com"
]
},
"os_name": {
"type": "string",
"description": "Operating System Name",
"example": "Manjaro Linux"
},
"os_id": {
"type": "string",
"description": "Operating System ID",
"example": "manjaro"
},
"os_id_like": {
"type": "string",
"description": "Known OS similar to this OS",
"example": "arch"
},
"os_version": {
"type": "string",
"description": "Operating System Version",
"example": "18.0.4"
},
"os_version_id": {
"type": "string",
"description": "Operating System Version ID",
"example": "unknown"
},
"os_detection": {
"type": "string",
"description": "OS parameters detection method",
"example": "Mixed"
},
"kernel_name": {
"type": "string",
"description": "Kernel Name",
"example": "Linux"
},
"kernel_version": {
"type": "string",
"description": "Kernel Version",
"example": "4.19.32-1-MANJARO"
},
"architecture": {
"type": "string",
"description": "Kernel architecture",
"example": "x86_64"
},
"virtualization": {
"type": "string",
"description": "Virtualization Type",
"example": "kvm"
},
"virt_detection": {
"type": "string",
"description": "Virtualization detection method",
"example": "systemd-detect-virt"
},
"container": {
"type": "string",
"description": "Container technology",
"example": "docker"
},
"container_detection": {
"type": "string",
"description": "Container technology detection method",
"example": "dockerenv"
},
"collectors": {
"type": "array",
"items": {
"type": "object",
"description": "Array of collector plugins and modules",
"properties": {
"plugin": {
"type": "string",
"description": "Collector plugin",
"example": "python.d.plugin"
},
"module": {
"type": "string",
"description": "Module of the collector plugin",
"example": "dockerd"
}
}
}
},
"alarms": {
"type": "object",
"description": "number of alarms in the server.",
Expand Down
70 changes: 70 additions & 0 deletions web/api/netdata-swagger.yaml
Expand Up @@ -20,6 +20,8 @@ paths:
* netdata version
* netdata unique id
* list of hosts mirrored (includes itself)
* Operating System, Virtualization and Container technology information
* List of active collector plugins and modules
* number of alarms in the host
* number of alarms in normal state
* number of alarms in warning state
Expand All @@ -29,6 +31,8 @@ paths:
description: netdata basic information
schema:
$ref: '#/definitions/info'
'503':
description: netdata daemon not ready (used for health checks)
/charts:
get:
summary: 'Get a list of all charts available at the server'
Expand Down Expand Up @@ -460,6 +464,72 @@ definitions:
example:
- host1.example.com
- host2.example.com
os_name:
type: string
description: Operating System Name
example: Manjaro Linux
os_id:
type: string
description: Operating System ID
example: manjaro
os_id_like:
type: string
description: Known OS similar to this OS
example: arch
os_version:
type: string
description: Operating System Version
example: 18.0.4
os_version_id:
type: string
description: Operating System Version ID
example: unknown
os_detection:
type: string
description: OS parameters detection method
example: Mixed
kernel_name:
type: string
description: Kernel Name
example: Linux
kernel_version:
type: string
description: Kernel Version
example: 4.19.32-1-MANJARO
architecture:
type: string
description: Kernel architecture
example: x86_64
virtualization:
type: string
description: Virtualization Type
example: kvm
virt_detection:
type: string
description: Virtualization detection method
example: systemd-detect-virt
container:
type: string
description: Container technology
example: docker
container_detection:
type: string
description: Container technology detection method
example: dockerenv
collectors:
type: array
items:
type: object
description: Array of collector plugins and modules
properties:
plugin:
type: string
description: Collector plugin
example: python.d.plugin
module:
type: string
description: Module of the collector plugin
example: dockerd
alarms:
type: object
description: number of alarms in the server.
Expand Down
2 changes: 1 addition & 1 deletion web/api/web_api_v1.c
Expand Up @@ -717,7 +717,7 @@ static inline void web_client_api_request_v1_info_mirrored_hosts(BUFFER *wb) {

inline int web_client_api_request_v1_info(RRDHOST *host, struct web_client *w, char *url) {
(void)url;
if (!netdata_ready) return 400;
if (!netdata_ready) return 503;

BUFFER *wb = w->response.data;
buffer_flush(wb);
Expand Down