@cryptotaxi247 / netdata-1 / commits / dc1fa08a8

Fix for ignored LXC containers (#9645)

Vladimir Kobal committed Aug 12, 2020 at 15:36 UTC dc1fa08a8835d008a180e33deae71604a060fa48
2 files changed +9 -5
collectors/cgroups.plugin/cgroup-name.sh.in
+7 -4
@@ -101,10 +101,10 @@ function k8s_get_name() {
101 fi
102 if kubectl --kubeconfig=$KUBE_CONFIG get pod --all-namespaces >/dev/null 2>&1; then
103 #shellcheck disable=SC2086
104 - NAME="$(kubectl --kubeconfig=$KUBE_CONFIG get pod --all-namespaces --output='json' |
105 - jq -r '.items[] | "k8s_\(.metadata.namespace)_\(.metadata.name)_\(.metadata.uid)_" + (.status.containerStatuses[]? | "\(.name) \(.containerID)")' |
106 - grep "$id" |
107 - cut -d' ' -f1
104 + NAME="$(kubectl --kubeconfig=$KUBE_CONFIG get pod --all-namespaces --output='json' |
105 + jq -r '.items[] | "k8s_\(.metadata.namespace)_\(.metadata.name)_\(.metadata.uid)_" + (.status.containerStatuses[]? | "\(.name) \(.containerID)")' |
106 + grep "$id" |
107 + cut -d' ' -f1
108 )"
109 else
110 warning "kubectl cannot get pod list, check for configuration file in $KUBE_CONFIG, or set this path to env \$KUBE_CONFIG"
@@ -227,6 +227,9 @@ if [ -z "${NAME}" ]; then
227 else
228 error "proxmox config file missing ${FILENAME} or netdata does not have read access. Please ensure netdata is a member of www-data group."
229 fi
230 + elif [[ ${CGROUP} =~ lxc.payload.* ]]; then
231 + # LXC 4.0
232 + NAME="$(echo "${CGROUP}" | sed 's/lxc\.payload\.\(.*\)/\1/g')"
233 fi
234
235 [ -z "${NAME}" ] && NAME="${CGROUP}"
collectors/cgroups.plugin/sys_fs_cgroup.c
+2 -1
@@ -379,7 +379,7 @@ void read_cgroup_plugin_configuration() {
379 " !/libvirt "
380 " !/lxc "
381 " !/lxc/*/* " // #1397 #2649
382 - " !/lxc.monitor "
382 + " !/lxc.monitor* "
383 " !/lxc.pivot "
384 " !/lxc.payload "
385 " !/machine "
@@ -403,6 +403,7 @@ void read_cgroup_plugin_configuration() {
403 " !/lxc/*/* " // #2161 #2649
404 " !/lxc.monitor "
405 " !/lxc.payload/*/* "
406 + " !/lxc.payload.* "
407 " * "
408 ), NULL, SIMPLE_PATTERN_EXACT);
409