diff options
author | Ilya Mashchenko <ilya@netdata.cloud> | 2022-07-05 15:08:37 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-05 15:08:37 +0300 |
commit | 52be249c021a7b718a889d1c97eaee0565904518 (patch) | |
tree | 8baa1c2455e0da1868764b88840077bcc64759ea /collectors | |
parent | dd01f896b466ed8411d58a816db8de2b940f7265 (diff) |
fix(cgroups.plugin): adjust kubepods regex to fix name resolution in a kind cluster (#13302)
Diffstat (limited to 'collectors')
-rwxr-xr-x | collectors/cgroups.plugin/cgroup-name.sh | 9 | ||||
-rw-r--r-- | collectors/cgroups.plugin/sys_fs_cgroup.c | 5 |
2 files changed, 13 insertions, 1 deletions
diff --git a/collectors/cgroups.plugin/cgroup-name.sh b/collectors/cgroups.plugin/cgroup-name.sh index 73405443c8..4716d41494 100755 --- a/collectors/cgroups.plugin/cgroup-name.sh +++ b/collectors/cgroups.plugin/cgroup-name.sh @@ -185,6 +185,13 @@ function k8s_get_kubepod_name() { # | | |-- kubepods-besteffort-pod10fb5647_c724_400c_b9cc_0e6eae3110e7.slice # | | | |-- docker-36e5eb5056dfdf6dbb75c0c44a1ecf23217fe2c50d606209d8130fcbb19fb5a7.scope # + # kind v0.14.0 + # |-- kubelet.slice + # | |-- kubelet-kubepods.slice + # | | |-- kubelet-kubepods-besteffort.slice + # | | | |-- kubelet-kubepods-besteffort-pod7881ed9e_c63e_4425_b5e0_ac55a08ae939.slice + # | | | | |-- cri-containerd-00c7939458bffc416bb03451526e9fde13301d6654cfeadf5b4964a7fb5be1a9.scope + # # NOTE: cgroups plugin # - uses '_' to join dir names (so it is <parent>_<child>_<child>_...) # - replaces '.' with '-' @@ -193,7 +200,7 @@ function k8s_get_kubepod_name() { local cgroup_path="${1}" local id="${2}" - if [[ ! $id =~ ^kubepods ]]; then + if [[ ! $id =~ ^.*kubepods.* ]]; then warning "${fn}: '${id}' is not kubepod cgroup." return 1 fi diff --git a/collectors/cgroups.plugin/sys_fs_cgroup.c b/collectors/cgroups.plugin/sys_fs_cgroup.c index 8c8e187538..b3cecdc7b9 100644 --- a/collectors/cgroups.plugin/sys_fs_cgroup.c +++ b/collectors/cgroups.plugin/sys_fs_cgroup.c @@ -2654,6 +2654,11 @@ static inline void discovery_process_cgroup(struct cgroup *cg) { cg->processed = 1; + if (strlen(cg->chart_id) >= RRD_ID_LENGTH_MAX) { + info("cgroup '%s' (chart id '%s') disabled because chart_id exceeds the limit (RRD_ID_LENGTH_MAX)", cg->id, cg->chart_id); + return; + } + if (is_cgroup_systemd_service(cg)) { cg->enabled = 1; return; |