summaryrefslogtreecommitdiffstats
path: root/daemon/anonymous-statistics.sh.in
diff options
context:
space:
mode:
authorChris Akritidis <43294513+cakrit@users.noreply.github.com>2019-03-13 12:47:20 +0100
committerGitHub <noreply@github.com>2019-03-13 12:47:20 +0100
commitb7998ec82d579bd0550e23f880decdcee61264f5 (patch)
tree834bb528d86c9cff943fe33220952de4cbceca8b /daemon/anonymous-statistics.sh.in
parent97699c5c60342be372d776da4829167adfdfc133 (diff)
When running from within a k8s pod, use the k8s API to get the cgroup name (#5576)
* When running from within a k8s pod, use the k8s API to get the pod name * Check the last part of an underscore-delimited or slash-delimited container id * Add a docker image builder that adds a single image to a user-specified registry, for use in k8s * When running in k8s, disable cgroups that the pod API does not return * Use longer name for k8s containers * Add reference to build-test.sh to packaging/docker/README.md * Anonymous statistics should not break when /proc/1/sched is not available
Diffstat (limited to 'daemon/anonymous-statistics.sh.in')
-rwxr-xr-xdaemon/anonymous-statistics.sh.in13
1 files changed, 7 insertions, 6 deletions
diff --git a/daemon/anonymous-statistics.sh.in b/daemon/anonymous-statistics.sh.in
index f4375b1015..d4622c6d9a 100755
--- a/daemon/anonymous-statistics.sh.in
+++ b/daemon/anonymous-statistics.sh.in
@@ -85,13 +85,14 @@ fi
# -------------------------------------------------------------------------------------------------
# detect containers with heuristics
-if [ "${CONTAINER}" = "unknown" ] ; then
- IFS='(, ' read -r process _ </proc/1/sched
- if [ "${process}" = "netdata" ]; then
- CONTAINER="container"
- CONT_DETECTION="process"
+if [ "${CONTAINER}" = "unknown" ]; then
+ if [ -f /proc/1/sched ] ; then
+ IFS='(, ' read -r process _ </proc/1/sched
+ if [ "${process}" = "netdata" ]; then
+ CONTAINER="container"
+ CONT_DETECTION="process"
+ fi
fi
-
# ubuntu and debian supply /bin/running-in-container
# https://www.apt-browse.org/browse/ubuntu/trusty/main/i386/upstart/1.12.1-0ubuntu4/file/bin/running-in-container
if /bin/running-in-container >/dev/null 2>&1; then