diff options
Diffstat (limited to 'web/api/web_api_v1.c')
-rw-r--r-- | web/api/web_api_v1.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/web/api/web_api_v1.c b/web/api/web_api_v1.c index 991a9ec8b..7c0d728bf 100644 --- a/web/api/web_api_v1.c +++ b/web/api/web_api_v1.c @@ -208,6 +208,7 @@ inline int web_client_api_request_v1_alarms(RRDHOST *host, struct web_client *w, buffer_flush(w->response.data); w->response.data->contenttype = CT_APPLICATION_JSON; health_alarms2json(host, w->response.data, all); + buffer_no_cacheable(w->response.data); return 200; } @@ -717,6 +718,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 503; BUFFER *wb = w->response.data; buffer_flush(wb); @@ -732,9 +734,28 @@ inline int web_client_api_request_v1_info(RRDHOST *host, struct web_client *w, c buffer_strcat(wb, "\t\"alarms\": {\n"); web_client_api_request_v1_info_summary_alarm_statuses(host, wb); - buffer_strcat(wb, "\t}\n"); + buffer_strcat(wb, "\t},\n"); + + buffer_sprintf(wb, "\t\"os_name\": %s,\n", (host->system_info->os_name) ? host->system_info->os_name : "\"\""); + buffer_sprintf(wb, "\t\"os_id\": \"%s\",\n", (host->system_info->os_id) ? host->system_info->os_id : ""); + buffer_sprintf(wb, "\t\"os_id_like\": \"%s\",\n", (host->system_info->os_id_like) ? host->system_info->os_id_like : ""); + buffer_sprintf(wb, "\t\"os_version\": \"%s\",\n", (host->system_info->os_version) ? host->system_info->os_version : ""); + buffer_sprintf(wb, "\t\"os_version_id\": \"%s\",\n", (host->system_info->os_version_id) ? host->system_info->os_version_id : ""); + buffer_sprintf(wb, "\t\"os_detection\": \"%s\",\n", (host->system_info->os_detection) ? host->system_info->os_detection : ""); + buffer_sprintf(wb, "\t\"kernel_name\": \"%s\",\n", (host->system_info->kernel_name) ? host->system_info->kernel_name : ""); + buffer_sprintf(wb, "\t\"kernel_version\": \"%s\",\n", (host->system_info->kernel_version) ? host->system_info->kernel_version : ""); + buffer_sprintf(wb, "\t\"architecture\": \"%s\",\n", (host->system_info->architecture) ? host->system_info->architecture : ""); + buffer_sprintf(wb, "\t\"virtualization\": \"%s\",\n", (host->system_info->virtualization) ? host->system_info->virtualization : ""); + buffer_sprintf(wb, "\t\"virt_detection\": \"%s\",\n", (host->system_info->virt_detection) ? host->system_info->virt_detection : ""); + buffer_sprintf(wb, "\t\"container\": \"%s\",\n", (host->system_info->container) ? host->system_info->container : ""); + buffer_sprintf(wb, "\t\"container_detection\": \"%s\",\n", (host->system_info->container_detection) ? host->system_info->container_detection : ""); + + buffer_strcat(wb, "\t\"collectors\": ["); + chartcollectors2json(host, wb); + buffer_strcat(wb, "\n\t]\n"); buffer_strcat(wb, "}"); + buffer_no_cacheable(wb); return 200; } |