summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Akritidis <43294513+cakrit@users.noreply.github.com>2019-01-30 13:08:17 +0200
committerCosta Tsaousis <costa@tsaousis.gr>2019-01-30 13:08:17 +0200
commit43628db5e954e0376e5cf8c27573e83c1cd702f4 (patch)
tree66cc1d5d33ed9b2fcac8346218e0dbd64c8d3850
parentec90b63ffddf04289d340bacbb39865fffec9ac4 (diff)
Minor updates to anonymous statistics (#5295)
-rw-r--r--collectors/apps.plugin/apps_plugin.c3
-rw-r--r--collectors/cgroups.plugin/cgroup-network.c3
-rwxr-xr-xdaemon/anonymous-statistics.sh.in57
3 files changed, 36 insertions, 27 deletions
diff --git a/collectors/apps.plugin/apps_plugin.c b/collectors/apps.plugin/apps_plugin.c
index 8f27169891..9f392679d4 100644
--- a/collectors/apps.plugin/apps_plugin.c
+++ b/collectors/apps.plugin/apps_plugin.c
@@ -16,6 +16,9 @@ void netdata_cleanup_and_exit(int ret) {
}
void send_statistics( const char *action, const char *action_result, const char *action_data) {
+ (void) action;
+ (void) action_result;
+ (void) action_data;
return;
}
// callbacks required by popen()
diff --git a/collectors/cgroups.plugin/cgroup-network.c b/collectors/cgroups.plugin/cgroup-network.c
index 13f84ff411..5aeb9a59a8 100644
--- a/collectors/cgroups.plugin/cgroup-network.c
+++ b/collectors/cgroups.plugin/cgroup-network.c
@@ -25,6 +25,9 @@ void netdata_cleanup_and_exit(int ret) {
}
void send_statistics( const char *action, const char *action_result, const char *action_data) {
+ (void) action;
+ (void) action_result;
+ (void) action_data;
return;
}
diff --git a/daemon/anonymous-statistics.sh.in b/daemon/anonymous-statistics.sh.in
index 81f2b00627..f4375b1015 100755
--- a/daemon/anonymous-statistics.sh.in
+++ b/daemon/anonymous-statistics.sh.in
@@ -67,10 +67,14 @@ ARCHITECTURE="$(uname -m)"
VIRTUALIZATION="unknown"
VIRT_DETECTION="none"
+CONTAINER="unknown"
+CONT_DETECTION="none"
if [ -n "$(command -v systemd-detect-virt 2>/dev/null)" ]; then
- VIRTUALIZATION="$(systemd-detect-virt)"
+ VIRTUALIZATION="$(systemd-detect-virt -v)"
VIRT_DETECTION="systemd-detect-virt"
+ CONTAINER="$(systemd-detect-virt -c)"
+ CONT_DETECTION="systemd-detect-virt"
else
if grep -q "^flags.*hypervisor" /proc/cpuinfo 2>/dev/null; then
VIRTUALIZATION="hypervisor"
@@ -79,36 +83,35 @@ else
fi
# -------------------------------------------------------------------------------------------------
-# detect containers
-
-CONTAINER="none"
-CONT_DETECTION="none"
+# detect containers with heuristics
-IFS='(, ' read -r process _ </proc/1/sched
-if [ "${process}" = "netdata" ]; then
- CONTAINER="container"
- CONT_DETECTION="process"
-fi
+if [ "${CONTAINER}" = "unknown" ] ; then
+ IFS='(, ' read -r process _ </proc/1/sched
+ if [ "${process}" = "netdata" ]; then
+ CONTAINER="container"
+ CONT_DETECTION="process"
+ 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
- CONTAINER="container"
- CONT_DETECTION="/bin/running-in-container"
-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
+ CONTAINER="container"
+ CONT_DETECTION="/bin/running-in-container"
+ fi
-# lxc sets environment variable 'container'
-#shellcheck disable=SC2154
-if [ -n "${container}" ]; then
- CONTAINER="lxc"
- CONT_DETECTION="containerenv"
-fi
+ # lxc sets environment variable 'container'
+ #shellcheck disable=SC2154
+ if [ -n "${container}" ]; then
+ CONTAINER="lxc"
+ CONT_DETECTION="containerenv"
+ fi
-# docker creates /.dockerenv
-# http://stackoverflow.com/a/25518345
-if [ -f "/.dockerenv" ]; then
- CONTAINER="docker"
- CONT_DETECTION="dockerenv"
+ # docker creates /.dockerenv
+ # http://stackoverflow.com/a/25518345
+ if [ -f "/.dockerenv" ]; then
+ CONTAINER="docker"
+ CONT_DETECTION="dockerenv"
+ fi
fi
# -------------------------------------------------------------------------------------------------