summaryrefslogtreecommitdiffstats
path: root/daemon/anonymous-statistics.sh.in
diff options
context:
space:
mode:
Diffstat (limited to 'daemon/anonymous-statistics.sh.in')
-rwxr-xr-xdaemon/anonymous-statistics.sh.in133
1 files changed, 60 insertions, 73 deletions
diff --git a/daemon/anonymous-statistics.sh.in b/daemon/anonymous-statistics.sh.in
index f0d9c10ef..47004f3d0 100755
--- a/daemon/anonymous-statistics.sh.in
+++ b/daemon/anonymous-statistics.sh.in
@@ -26,79 +26,66 @@ fi
NETDATA_VERSION=$(echo "${NETDATA_VERSION}" | sed 's/-.*//g' | tr -d 'v')
# -------------------------------------------------------------------------------------------------
-# send the anonymous statistics to GA
-# https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters
-# The maximum index for a cd parameter is 20 so we have effectively run out.
+
+# define body of request to be sent
+REQ_BODY="$(cat << EOF
+{
+ "api_key": "mqkwGT0JNFqO-zX2t0mW6Tec9yooaVu7xCBlXtHnt5Y",
+ "event": "${ACTION} ${ACTION_RESULT}",
+ "properties": {
+ "distinct_id": "${NETDATA_REGISTRY_UNIQUE_ID}",
+ "\$current_url": "agent backend",
+ "\$pathname": "netdata-backend",
+ "\$host": "backend.netdata.io",
+ "\$ip": "127.0.0.1",
+ "event_source": "agent backend",
+ "action": "${ACTION}",
+ "action_result": "${ACTION_RESULT}",
+ "action_data": "${ACTION_DATA}",
+ "netdata_machine_guid": "${NETDATA_REGISTRY_UNIQUE_ID}",
+ "netdata_version": "${NETDATA_VERSION}",
+ "host_os_name": "${NETDATA_HOST_OS_NAME}",
+ "host_os_id": "${NETDATA_HOST_OS_ID}",
+ "host_os_id_like": "${NETDATA_HOST_OS_ID_LIKE}",
+ "host_os_version": "${NETDATA_HOST_OS_VERSION}",
+ "host_os_version_id": "${NETDATA_HOST_OS_VERSION_ID}",
+ "host_os_detection": "${NETDATA_HOST_OS_DETECTION}",
+ "host_is_k8s_node": "${NETDATA_HOST_IS_K8S_NODE}",
+ "system_kernel_name": "${NETDATA_SYSTEM_KERNEL_NAME}",
+ "system_kernel_version": "${NETDATA_SYSTEM_KERNEL_VERSION}",
+ "system_architecture": "${NETDATA_SYSTEM_ARCHITECTURE}",
+ "system_virtualization": "${NETDATA_SYSTEM_VIRTUALIZATION}",
+ "system_virt_detection": "${NETDATA_SYSTEM_VIRT_DETECTION}",
+ "system_container": "${NETDATA_SYSTEM_CONTAINER}",
+ "system_container_detection": "${NETDATA_SYSTEM_CONTAINER_DETECTION}",
+ "container_os_name": "${NETDATA_CONTAINER_OS_NAME}",
+ "container_os_id": "${NETDATA_CONTAINER_OS_ID}",
+ "container_os_id_like": "${NETDATA_CONTAINER_OS_ID_LIKE}",
+ "container_os_version": "${NETDATA_CONTAINER_OS_VERSION}",
+ "container_os_version_id": "${NETDATA_CONTAINER_OS_VERSION_ID}",
+ "container_os_detection": "${NETDATA_CONTAINER_OS_DETECTION}",
+ "system_cpu_detection": "${NETDATA_SYSTEM_CPU_DETECTION}",
+ "system_cpu_freq": "${NETDATA_SYSTEM_CPU_FREQ}",
+ "system_cpu_logical_cpu_count": "${NETDATA_SYSTEM_CPU_LOGICAL_CPU_COUNT}",
+ "system_cpu_model": "${NETDATA_SYSTEM_CPU_MODEL}",
+ "system_cpu_vendor": "${NETDATA_SYSTEM_CPU_VENDOR}",
+ "system_disk_detection": "${NETDATA_SYSTEM_DISK_DETECTION}",
+ "system_ram_detection": "${NETDATA_SYSTEM_RAM_DETECTION}",
+ "system_total_disk_size": "${NETDATA_SYSTEM_TOTAL_DISK_SIZE}",
+ "system_total_ram": "${NETDATA_SYSTEM_TOTAL_RAM}"
+ }
+}
+EOF
+)"
+
+# send the anonymous statistics to the Netdata PostHog
if [ -n "$(command -v curl 2> /dev/null)" ]; then
- curl -X POST -Ss --max-time 2 \
- --data "v=1" \
- --data "tid=UA-64295674-3" \
- --data "aip=1" \
- --data "ds=shell" \
- --data-urlencode "cid=${NETDATA_REGISTRY_UNIQUE_ID}" \
- --data-urlencode "cs=${NETDATA_REGISTRY_UNIQUE_ID}" \
- --data "t=event" \
- --data "ni=1" \
- --data "an=anonymous-statistics" \
- --data-urlencode "av=${NETDATA_VERSION}" \
- --data-urlencode "ec=${ACTION}" \
- --data-urlencode "ea=${ACTION_RESULT}" \
- --data-urlencode "el=${ACTION_DATA}" \
- --data-urlencode "cd1=${NETDATA_HOST_OS_NAME}" \
- --data-urlencode "cd2=${NETDATA_HOST_OS_ID}" \
- --data-urlencode "cd3=${NETDATA_HOST_OS_ID_LIKE}" \
- --data-urlencode "cd4=${NETDATA_HOST_OS_VERSION}" \
- --data-urlencode "cd5=${NETDATA_HOST_OS_VERSION_ID}" \
- --data-urlencode "cd6=${NETDATA_HOST_OS_DETECTION}" \
- --data-urlencode "cd7=${NETDATA_SYSTEM_KERNEL_NAME}" \
- --data-urlencode "cd8=${NETDATA_SYSTEM_KERNEL_VERSION}" \
- --data-urlencode "cd9=${NETDATA_SYSTEM_ARCHITECTURE}" \
- --data-urlencode "cd10=${NETDATA_SYSTEM_VIRTUALIZATION}" \
- --data-urlencode "cd11=${NETDATA_SYSTEM_VIRT_DETECTION}" \
- --data-urlencode "cd12=${NETDATA_SYSTEM_CONTAINER}" \
- --data-urlencode "cd13=${NETDATA_SYSTEM_CONTAINER_DETECTION}" \
- --data-urlencode "cd14=${NETDATA_CONTAINER_OS_NAME}" \
- --data-urlencode "cd15=${NETDATA_CONTAINER_OS_ID}" \
- --data-urlencode "cd16=${NETDATA_CONTAINER_OS_ID_LIKE}" \
- --data-urlencode "cd17=${NETDATA_CONTAINER_OS_VERSION}" \
- --data-urlencode "cd18=${NETDATA_CONTAINER_OS_VERSION_ID}" \
- --data-urlencode "cd19=${NETDATA_CONTAINER_OS_DETECTION}" \
- --data-urlencode "cd20=${NETDATA_HOST_IS_K8S_NODE}" \
- "https://www.google-analytics.com/collect" > /dev/null 2>&1
+ curl -X POST --header "Content-Type: application/json" -d "${REQ_BODY}" https://posthog.netdata.cloud/capture/ > /dev/null 2>&1
else
- wget -q -O - --timeout=1 "https://www.google-analytics.com/collect?\
-&v=1\
-&tid=UA-64295674-3\
-&aip=1\
-&ds=shell\
-&cid=${NETDATA_REGISTRY_UNIQUE_ID}\
-&cs=${NETDATA_REGISTRY_UNIQUE_ID}\
-&t=event\
-&ni=1\
-&an=anonymous-statistics\
-&av=${NETDATA_VERSION}\
-&ec=${ACTION}\
-&ea=${ACTION_RESULT}\
-&el=${ACTION_DATA}\
-&cd1=${NETDATA_HOST_OS_NAME}\
-&cd2=${NETDATA_HOST_OS_ID}\
-&cd3=${NETDATA_HOST_OS_ID_LIKE}\
-&cd4=${NETDATA_HOST_OS_VERSION}\
-&cd5=${NETDATA_HOST_OS_VERSION_ID}\
-&cd6=${NETDATA_HOST_OS_DETECTION}\
-&cd7=${NETDATA_SYSTEM_KERNEL_NAME}\
-&cd8=${NETDATA_SYSTEM_KERNEL_VERSION}\
-&cd9=${NETDATA_SYSTEM_ARCHITECTURE}\
-&cd10=${NETDATA_SYSTEM_VIRTUALIZATION}\
-&cd11=${NETDATA_SYSTEM_VIRT_DETECTION}\
-&cd12=${NETDATA_SYSTEM_CONTAINER}\
-&cd13=${NETDATA_SYSTEM_CONTAINER_DETECTION}\
-&cd14=${NETDATA_CONTAINER_OS_NAME} \
-&cd15=${NETDATA_CONTAINER_OS_ID} \
-&cd16=${NETDATA_CONTAINER_OS_ID_LIKE} \
-&cd17=${NETDATA_CONTAINER_OS_VERSION} \
-&cd18=${NETDATA_CONTAINER_OS_VERSION_ID} \
-&cd19=${NETDATA_CONTAINER_OS_DETECTION} \
-&cd20=${NETDATA_HOST_IS_K8S_NODE} \
-" > /dev/null 2>&1
+ wget -q -O - --no-check-certificate \
+ --method POST \
+ --timeout=1 \
+ --header 'Content-Type: application/json' \
+ --body-data "${REQ_BODY}" \
+ 'https://posthog.netdata.cloud/capture/' > /dev/null 2>&1
fi