@cryptotaxi247 / netdata-1 / commits / 43628db5e

Minor updates to anonymous statistics (#5295)

Chris Akritidis committed Jan 30, 2019 at 13:08 UTC 43628db5e954e0376e5cf8c27573e83c1cd702f4
3 files changed +36 -27
collectors/apps.plugin/apps_plugin.c
+3
@@ -16,6 +16,9 @@ void netdata_cleanup_and_exit(int ret) {
16 }
17
18 void send_statistics( const char *action, const char *action_result, const char *action_data) {
19 + (void) action;
20 + (void) action_result;
21 + (void) action_data;
22 return;
23 }
24 // callbacks required by popen()
collectors/cgroups.plugin/cgroup-network.c
+3
@@ -25,6 +25,9 @@ void netdata_cleanup_and_exit(int ret) {
25 }
26
27 void send_statistics( const char *action, const char *action_result, const char *action_data) {
28 + (void) action;
29 + (void) action_result;
30 + (void) action_data;
31 return;
32 }
33
daemon/anonymous-statistics.sh.in
+30 -27
@@ -67,10 +67,14 @@ ARCHITECTURE="$(uname -m)"
67
68 VIRTUALIZATION="unknown"
69 VIRT_DETECTION="none"
70 +CONTAINER="unknown"
71 +CONT_DETECTION="none"
72
73 if [ -n "$(command -v systemd-detect-virt 2>/dev/null)" ]; then
72 - VIRTUALIZATION="$(systemd-detect-virt)"
74 + VIRTUALIZATION="$(systemd-detect-virt -v)"
75 VIRT_DETECTION="systemd-detect-virt"
76 + CONTAINER="$(systemd-detect-virt -c)"
77 + CONT_DETECTION="systemd-detect-virt"
78 else
79 if grep -q "^flags.*hypervisor" /proc/cpuinfo 2>/dev/null; then
80 VIRTUALIZATION="hypervisor"
@@ -79,36 +83,35 @@ else
83 fi
84
85 # -------------------------------------------------------------------------------------------------
82 -# detect containers
83 -
84 -CONTAINER="none"
85 -CONT_DETECTION="none"
86 +# detect containers with heuristics
87
87 -IFS='(, ' read -r process _ </proc/1/sched
88 -if [ "${process}" = "netdata" ]; then
89 - CONTAINER="container"
90 - CONT_DETECTION="process"
91 -fi
88 +if [ "${CONTAINER}" = "unknown" ] ; then
89 + IFS='(, ' read -r process _ </proc/1/sched
90 + if [ "${process}" = "netdata" ]; then
91 + CONTAINER="container"
92 + CONT_DETECTION="process"
93 + fi
94
93 -# ubuntu and debian supply /bin/running-in-container
94 -# https://www.apt-browse.org/browse/ubuntu/trusty/main/i386/upstart/1.12.1-0ubuntu4/file/bin/running-in-container
95 -if /bin/running-in-container >/dev/null 2>&1; then
96 - CONTAINER="container"
97 - CONT_DETECTION="/bin/running-in-container"
98 -fi
95 + # ubuntu and debian supply /bin/running-in-container
96 + # https://www.apt-browse.org/browse/ubuntu/trusty/main/i386/upstart/1.12.1-0ubuntu4/file/bin/running-in-container
97 + if /bin/running-in-container >/dev/null 2>&1; then
98 + CONTAINER="container"
99 + CONT_DETECTION="/bin/running-in-container"
100 + fi
101
100 -# lxc sets environment variable 'container'
101 -#shellcheck disable=SC2154
102 -if [ -n "${container}" ]; then
103 - CONTAINER="lxc"
104 - CONT_DETECTION="containerenv"
105 -fi
102 + # lxc sets environment variable 'container'
103 + #shellcheck disable=SC2154
104 + if [ -n "${container}" ]; then
105 + CONTAINER="lxc"
106 + CONT_DETECTION="containerenv"
107 + fi
108
107 -# docker creates /.dockerenv
108 -# http://stackoverflow.com/a/25518345
109 -if [ -f "/.dockerenv" ]; then
110 - CONTAINER="docker"
111 - CONT_DETECTION="dockerenv"
109 + # docker creates /.dockerenv
110 + # http://stackoverflow.com/a/25518345
111 + if [ -f "/.dockerenv" ]; then
112 + CONTAINER="docker"
113 + CONT_DETECTION="dockerenv"
114 + fi
115 fi
116
117 # -------------------------------------------------------------------------------------------------