diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-11-09 08:26:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-11-09 08:26:49 +0000 |
commit | 557d39be2a575c8a340ead48af2fc6e709d52a00 (patch) | |
tree | 5f0b3a62a1a0ff8eedf21d5f06ffab03dfac2785 /src/daemon | |
parent | Releasing debian version 1.47.2-1. (diff) | |
download | netdata-557d39be2a575c8a340ead48af2fc6e709d52a00.tar.xz netdata-557d39be2a575c8a340ead48af2fc6e709d52a00.zip |
Merging upstream version 1.47.5.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/daemon')
-rwxr-xr-x | src/daemon/system-info.sh | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/daemon/system-info.sh b/src/daemon/system-info.sh index aaca7fd4b..5c8d70b7e 100755 --- a/src/daemon/system-info.sh +++ b/src/daemon/system-info.sh @@ -361,6 +361,17 @@ fi # ------------------------------------------------------------------------------------------------- # Detect the total system disk space +is_inside_lxc_container() { + mounts_file="/proc/self/mounts" + + [ ! -r "$mounts_file" ] && return 1 + + # Check if lxcfs is mounted on /proc + awk '$1 == "lxcfs" && $2 ~ "^/proc" { found=1; exit } END { exit !found }' "$mounts_file" + + return $? +} + DISK_SIZE="unknown" DISK_DETECTION="none" @@ -393,7 +404,7 @@ elif [ "${KERNEL_NAME}" = FreeBSD ]; then total="$(df -t ${types} -c -k | tail -n 1 | awk '{print $2}')" DISK_SIZE="$((total * 1024))" else - if [ -d /sys/block ] && [ -r /proc/devices ]; then + if [ -d /sys/block ] && [ -r /proc/devices ] && ! is_inside_lxc_container; then dev_major_whitelist='' # This is a list of device names used for block storage devices. @@ -424,7 +435,7 @@ else else DISK_DETECTION="df" include_fs_types="ext*|btrfs|xfs|jfs|reiser*|zfs" - DISK_SIZE=$(($(df -T -P | tail -n +2 | sort -u -k 1 | grep "${include_fs_types}" | awk '{print $3}' | tr '\n' '+' | head -c -1) * 1024)) + DISK_SIZE=$(($(df -T -P | tail -n +2 | sort -u -k 1 | grep -E "${include_fs_types}" | awk '{print $3}' | tr '\n' '+' | head -c -1) * 1024)) fi fi |