summaryrefslogtreecommitdiffstats
path: root/daemon/system-info.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-05-08 16:27:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-05-08 16:27:08 +0000
commit81581f9719bc56f01d5aa08952671d65fda9867a (patch)
tree0f5c6b6138bf169c23c9d24b1fc0a3521385cb18 /daemon/system-info.sh
parentReleasing debian version 1.38.1-1. (diff)
downloadnetdata-81581f9719bc56f01d5aa08952671d65fda9867a.tar.xz
netdata-81581f9719bc56f01d5aa08952671d65fda9867a.zip
Merging upstream version 1.39.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xdaemon/system-info.sh26
1 files changed, 15 insertions, 11 deletions
diff --git a/daemon/system-info.sh b/daemon/system-info.sh
index 1e334a3d..43f761c2 100755
--- a/daemon/system-info.sh
+++ b/daemon/system-info.sh
@@ -96,6 +96,11 @@ if [ "${CONTAINER}" = "unknown" ]; then
CONT_DETECTION="dockerenv"
fi
+ if [ -n "${KUBERNETES_SERVICE_HOST}" ]; then
+ CONTAINER="container"
+ CONT_DETECTION="kubernetes"
+ fi
+
fi
# -------------------------------------------------------------------------------------------------
@@ -391,7 +396,7 @@ else
# These translate to the prefixs of files in `/dev` indicating the device type.
# They are sorted by lowest used device major number, with dynamically assigned ones at the end.
# We use this to look up device major numbers in `/proc/devices`
- device_names='hd sd mfm ad ftl pd nftl dasd intfl mmcblk ub xvd rfd vbd nvme virtblk blkext'
+ device_names='hd sd mfm ad ftl pd nftl dasd intfl mmcblk mmc ub xvd rfd vbd nvme virtblk blkext'
for name in ${device_names}; do
if grep -qE " ${name}\$" /proc/devices; then
@@ -457,7 +462,7 @@ if [ "${VIRTUALIZATION}" != "none" ] && command -v curl > /dev/null 2>&1; then
# Try GCE computeMetadata v1
if [ "${CLOUD_TYPE}" = "unknown" ]; then
- if [ -n "$(curl --fail -s --connect-timeout 1 -m 3 --noproxy "*" -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1")" ]; then
+ if curl --fail -s --connect-timeout 1 -m 3 --noproxy "*" -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1" | grep -sq computeMetadata; then
CLOUD_TYPE="GCP"
CLOUD_INSTANCE_TYPE="$(curl --fail -s --connect-timeout 1 -m 3 --noproxy "*" -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/machine-type")"
[ -n "$CLOUD_INSTANCE_TYPE" ] && CLOUD_INSTANCE_TYPE=$(basename "$CLOUD_INSTANCE_TYPE")
@@ -466,16 +471,15 @@ if [ "${VIRTUALIZATION}" != "none" ] && command -v curl > /dev/null 2>&1; then
fi
fi
- # TODO: needs to be tested in Microsoft Azure
# Try Azure IMDS
- # if [ "${CLOUD_TYPE}" = "unknown" ]; then
- # AZURE_IMDS_DATA="$(curl --fail -s -m 5 -H "Metadata: true" --noproxy "*" "http://169.254.169.254/metadata/instance?version=2021-10-01")"
- # if [ -n "${AZURE_IMDS_DATA}" ]; then
- # CLOUD_TYPE="Azure"
- # CLOUD_INSTANCE_TYPE="$(curl --fail -s -m 5 -H "Metadata: true" --noproxy "*" "http://169.254.169.254/metadata/instance/compute/vmSize?version=2021-10-01&format=text")"
- # CLOUD_INSTANCE_REGION="$(curl --fail -s -m 5 -H "Metadata: true" --noproxy "*" "http://169.254.169.254/metadata/instance/compute/location?version=2021-10-01&format=text")"
- # fi
- # fi
+ if [ "${CLOUD_TYPE}" = "unknown" ]; then
+ AZURE_IMDS_DATA="$(curl --fail -s --connect-timeout 1 -m 3 -H "Metadata: true" --noproxy "*" "http://169.254.169.254/metadata/instance?api-version=2021-10-01")"
+ if [ -n "${AZURE_IMDS_DATA}" ] && echo "${AZURE_IMDS_DATA}" | grep -sq azEnvironment; then
+ CLOUD_TYPE="Azure"
+ CLOUD_INSTANCE_TYPE="$(curl --fail -s --connect-timeout 1 -m 3 -H "Metadata: true" --noproxy "*" "http://169.254.169.254/metadata/instance/compute/vmSize?api-version=2021-10-01&format=text")"
+ CLOUD_INSTANCE_REGION="$(curl --fail -s --connect-timeout 1 -m 3 -H "Metadata: true" --noproxy "*" "http://169.254.169.254/metadata/instance/compute/location?api-version=2021-10-01&format=text")"
+ fi
+ fi
fi
fi