From dc1fa08a8835d008a180e33deae71604a060fa48 Mon Sep 17 00:00:00 2001 From: Vladimir Kobal Date: Wed, 12 Aug 2020 15:36:58 +0300 Subject: Fix for ignored LXC containers (#9645) --- collectors/cgroups.plugin/cgroup-name.sh.in | 11 +++++++---- collectors/cgroups.plugin/sys_fs_cgroup.c | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'collectors') diff --git a/collectors/cgroups.plugin/cgroup-name.sh.in b/collectors/cgroups.plugin/cgroup-name.sh.in index ad0ab0b663..5d19014f41 100755 --- a/collectors/cgroups.plugin/cgroup-name.sh.in +++ b/collectors/cgroups.plugin/cgroup-name.sh.in @@ -101,10 +101,10 @@ function k8s_get_name() { fi if kubectl --kubeconfig=$KUBE_CONFIG get pod --all-namespaces >/dev/null 2>&1; then #shellcheck disable=SC2086 - NAME="$(kubectl --kubeconfig=$KUBE_CONFIG get pod --all-namespaces --output='json' | - jq -r '.items[] | "k8s_\(.metadata.namespace)_\(.metadata.name)_\(.metadata.uid)_" + (.status.containerStatuses[]? | "\(.name) \(.containerID)")' | - grep "$id" | - cut -d' ' -f1 + NAME="$(kubectl --kubeconfig=$KUBE_CONFIG get pod --all-namespaces --output='json' | + jq -r '.items[] | "k8s_\(.metadata.namespace)_\(.metadata.name)_\(.metadata.uid)_" + (.status.containerStatuses[]? | "\(.name) \(.containerID)")' | + grep "$id" | + cut -d' ' -f1 )" else 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 else error "proxmox config file missing ${FILENAME} or netdata does not have read access. Please ensure netdata is a member of www-data group." fi + elif [[ ${CGROUP} =~ lxc.payload.* ]]; then + # LXC 4.0 + NAME="$(echo "${CGROUP}" | sed 's/lxc\.payload\.\(.*\)/\1/g')" fi [ -z "${NAME}" ] && NAME="${CGROUP}" diff --git a/collectors/cgroups.plugin/sys_fs_cgroup.c b/collectors/cgroups.plugin/sys_fs_cgroup.c index 007669456e..87f13e11e9 100644 --- a/collectors/cgroups.plugin/sys_fs_cgroup.c +++ b/collectors/cgroups.plugin/sys_fs_cgroup.c @@ -379,7 +379,7 @@ void read_cgroup_plugin_configuration() { " !/libvirt " " !/lxc " " !/lxc/*/* " // #1397 #2649 - " !/lxc.monitor " + " !/lxc.monitor* " " !/lxc.pivot " " !/lxc.payload " " !/machine " @@ -403,6 +403,7 @@ void read_cgroup_plugin_configuration() { " !/lxc/*/* " // #2161 #2649 " !/lxc.monitor " " !/lxc.payload/*/* " + " !/lxc.payload.* " " * " ), NULL, SIMPLE_PATTERN_EXACT); -- cgit v1.2.3