summaryrefslogtreecommitdiffstats
path: root/database
diff options
context:
space:
mode:
authorIlya Mashchenko <ilya@netdata.cloud>2021-01-18 15:44:14 +0300
committerGitHub <noreply@github.com>2021-01-18 07:44:14 -0500
commit10b745cba808ed2069ae51c23d75c02cf3ca3f65 (patch)
tree191cbb9fb1a93a739383a39a1cf2b838d1f035f5 /database
parentf4193c3b5c013df00b6d05805bf1cc99bebe02bf (diff)
add `_is_k8s_node` label to the host labels (#10501)
* auto format system-info.sh * detect whether the node is k8s node in system-info.sh * fix unmae=>uname * add_is_k8s_node_to_host_labels: Add new variable to structure * add_is_k8s_node_to_host_labels: Add is_k8_node to labels * add_is_k8s_node_to_host_labels: Add is_k8_node inside endpoint * add_is_k8s_node_to_host_labels: Add data to swagge file * change yes/no to true/false * Update web/api/netdata-swagger.json * add_is_k8s_node_to_host_labels: Add anonymous statistic * add_is_k8s_node_to_host_labels: Add information to using-host-labels.md * add_is_k8s_node_to_host_labels: Add variable to stream * add_is_k8s_node_to_host_labels: Change swagger.yaml * add_is_k8s_node_to_host_labels: Adding missing documentation * add_is_k8s_node_to_host_labels: rename variable * add_is_k8s_node_to_host_labels: Rename lables to match variable names * add_is_k8s_node_to_host_labels: Add to wget * add_is_k8s_node_to_host_labels: Add content to swagger files * add_is_k8s_node_to_host_labels: update both swagger files * add_is_k8s_node_to_host_labels: fix wrong exportation Co-authored-by: Thiago Marques <thiagoftsm@gmail.com>
Diffstat (limited to 'database')
-rw-r--r--database/rrd.h1
-rw-r--r--database/rrdhost.c9
2 files changed, 10 insertions, 0 deletions
diff --git a/database/rrd.h b/database/rrd.h
index 86f4226348..f52d34af8a 100644
--- a/database/rrd.h
+++ b/database/rrd.h
@@ -721,6 +721,7 @@ struct rrdhost_system_info {
char *virt_detection;
char *container;
char *container_detection;
+ char *is_k8s_node;
};
struct rrdhost {
diff --git a/database/rrdhost.c b/database/rrdhost.c
index e120e9d445..8b8a2dc2a6 100644
--- a/database/rrdhost.c
+++ b/database/rrdhost.c
@@ -758,6 +758,7 @@ void rrdhost_system_info_free(struct rrdhost_system_info *system_info) {
freez(system_info->virt_detection);
freez(system_info->container);
freez(system_info->container_detection);
+ freez(system_info->is_k8s_node);
freez(system_info);
}
}
@@ -982,6 +983,10 @@ static struct label *rrdhost_load_auto_labels(void)
label_list =
add_label_to_list(label_list, "_virt_detection", localhost->system_info->virt_detection, LABEL_SOURCE_AUTO);
+ if (localhost->system_info->is_k8s_node)
+ label_list =
+ add_label_to_list(label_list, "_is_k8s_node", localhost->system_info->is_k8s_node, LABEL_SOURCE_AUTO);
+
label_list = add_label_to_list(
label_list, "_is_parent", (localhost->next || configured_as_parent()) ? "true" : "false", LABEL_SOURCE_AUTO);
@@ -1523,6 +1528,10 @@ int rrdhost_set_system_info_variable(struct rrdhost_system_info *system_info, ch
freez(system_info->container_detection);
system_info->container_detection = strdupz(value);
}
+ else if(!strcmp(name, "NETDATA_HOST_IS_K8S_NODE")){
+ freez(system_info->is_k8s_node);
+ system_info->is_k8s_node = strdupz(value);
+ }
else if (!strcmp(name, "NETDATA_SYSTEM_CPU_VENDOR"))
return res;
else if (!strcmp(name, "NETDATA_SYSTEM_CPU_MODEL"))