diff options
author | Andrew Moss <1043609+amoss@users.noreply.github.com> | 2020-01-21 16:08:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-21 16:08:59 +0100 |
commit | 49f6950820f083956ddc2c9327eeae4e9ef0d5ed (patch) | |
tree | c551bb219e2503c55e3b4e668408d4bff9ac99d8 /streaming/rrdpush.c | |
parent | 434c9ba6e17aa80548e1fccbcadccaa1572d76eb (diff) |
Issue 7488 docker labels (#7770)
Improve the metadata detection for containers. The system_info structure has been updated to hold separate copies of OS_NAME, OS_ID, OS_ID_LIKE, OS_VERSION, OS_VERSION_ID and OS_DETECTION for both the container environment and the host. This new information is communicated through the /api/v1/info endpoint. For the streaming interface a partial copy of the info is carried until the stream protocol is upgraded. The anonymous_statistics script has been updated to carry the new data to Google Analytics. Some minor improvements have been made to OS-X / FreeBSD detection, and the detection of virtualization. The docs have been updated to explain how to pass the host environment to the docker container running Netdata.
Diffstat (limited to 'streaming/rrdpush.c')
-rw-r--r-- | streaming/rrdpush.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/streaming/rrdpush.c b/streaming/rrdpush.c index c6c391e4b1..f110a4c92a 100644 --- a/streaming/rrdpush.c +++ b/streaming/rrdpush.c @@ -552,6 +552,9 @@ static int rrdpush_sender_thread_connect_to_master(RRDHOST *host, int default_po } #endif + /* TODO: During the implementation of #7265 switch the set of variables to HOST_* and CONTAINER_* if the + version negotiation resulted in a high enough version. + */ #define HTTP_HEADER_SIZE 8192 char http[HTTP_HEADER_SIZE + 1]; int eol = snprintfz(http, HTTP_HEADER_SIZE, @@ -581,12 +584,12 @@ static int rrdpush_sender_thread_connect_to_master(RRDHOST *host, int default_po , host->os , host->timezone , (host->tags) ? host->tags : "" - , (host->system_info->os_name) ? host->system_info->os_name : "" - , (host->system_info->os_id) ? host->system_info->os_id : "" - , (host->system_info->os_id_like) ? host->system_info->os_id_like : "" - , (host->system_info->os_version) ? host->system_info->os_version : "" - , (host->system_info->os_version_id) ? host->system_info->os_version_id : "" - , (host->system_info->os_detection) ? host->system_info->os_detection : "" + , (host->system_info->host_os_name) ? host->system_info->host_os_name : "" + , (host->system_info->host_os_id) ? host->system_info->host_os_id : "" + , (host->system_info->host_os_id_like) ? host->system_info->host_os_id_like : "" + , (host->system_info->host_os_version) ? host->system_info->host_os_version : "" + , (host->system_info->host_os_version_id) ? host->system_info->host_os_version_id : "" + , (host->system_info->host_os_detection) ? host->system_info->host_os_detection : "" , (host->system_info->kernel_name) ? host->system_info->kernel_name : "" , (host->system_info->kernel_version) ? host->system_info->kernel_version : "" , (host->system_info->architecture) ? host->system_info->architecture : "" @@ -1394,11 +1397,25 @@ int rrdpush_receiver_thread_spawn(RRDHOST *host, struct web_client *w, char *url else { if(!strcmp(name, "NETDATA_PROTOCOL_VERSION")) stream_flags = LABEL_FLAG_UPDATE_STREAM; - else + else { + // An old Netdata slave does not have a compatible streaming protocol, map to something sane. + if (!strcmp(name, "NETDATA_SYSTEM_OS_NAME")) + name = "NETDATA_HOST_OS_NAME"; + else if (!strcmp(name, "NETDATA_SYSTEM_OS_ID")) + name = "NETDATA_HOST_OS_ID"; + else if (!strcmp(name, "NETDATA_SYSTEM_OS_ID_LIKE")) + name = "NETDATA_HOST_OS_ID_LIKE"; + else if (!strcmp(name, "NETDATA_SYSTEM_OS_VERSION")) + name = "NETDATA_HOST_OS_VERSION"; + else if (!strcmp(name, "NETDATA_SYSTEM_OS_VERSION_ID")) + name = "NETDATA_HOST_OS_VERSION_ID"; + else if (!strcmp(name, "NETDATA_SYSTEM_OS_DETECTION")) + name = "NETDATA_HOST_OS_DETECTION"; if (unlikely(rrdhost_set_system_info_variable(system_info, name, value))) { info("STREAM [receive from [%s]:%s]: request has parameter '%s' = '%s', which is not used.", w->client_ip, w->client_port, key, value); } + } } } |