@cryptotaxi247 / netdata-1 / commits / 52be249c0

fix(cgroups.plugin): adjust kubepods regex to fix name resolution in a kind cluster (#13302)

Ilya Mashchenko committed Jul 5, 2022 at 15:08 UTC 52be249c021a7b718a889d1c97eaee0565904518
2 files changed +13 -1
collectors/cgroups.plugin/cgroup-name.sh
+8 -1
@@ -185,6 +185,13 @@ function k8s_get_kubepod_name() {
185 # | | |-- kubepods-besteffort-pod10fb5647_c724_400c_b9cc_0e6eae3110e7.slice
186 # | | | |-- docker-36e5eb5056dfdf6dbb75c0c44a1ecf23217fe2c50d606209d8130fcbb19fb5a7.scope
187 #
188 + # kind v0.14.0
189 + # |-- kubelet.slice
190 + # | |-- kubelet-kubepods.slice
191 + # | | |-- kubelet-kubepods-besteffort.slice
192 + # | | | |-- kubelet-kubepods-besteffort-pod7881ed9e_c63e_4425_b5e0_ac55a08ae939.slice
193 + # | | | | |-- cri-containerd-00c7939458bffc416bb03451526e9fde13301d6654cfeadf5b4964a7fb5be1a9.scope
194 + #
195 # NOTE: cgroups plugin
196 # - uses '_' to join dir names (so it is <parent>_<child>_<child>_...)
197 # - replaces '.' with '-'
@@ -193,7 +200,7 @@ function k8s_get_kubepod_name() {
200 local cgroup_path="${1}"
201 local id="${2}"
202
196 - if [[ ! $id =~ ^kubepods ]]; then
203 + if [[ ! $id =~ ^.*kubepods.* ]]; then
204 warning "${fn}: '${id}' is not kubepod cgroup."
205 return 1
206 fi
collectors/cgroups.plugin/sys_fs_cgroup.c
+5
@@ -2654,6 +2654,11 @@ static inline void discovery_process_cgroup(struct cgroup *cg) {
2654
2655 cg->processed = 1;
2656
2657 + if (strlen(cg->chart_id) >= RRD_ID_LENGTH_MAX) {
2658 + info("cgroup '%s' (chart id '%s') disabled because chart_id exceeds the limit (RRD_ID_LENGTH_MAX)", cg->id, cg->chart_id);
2659 + return;
2660 + }
2661 +
2662 if (is_cgroup_systemd_service(cg)) {
2663 cg->enabled = 1;
2664 return;