diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-03-31 12:58:11 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-03-31 12:58:11 +0000 |
commit | f99c4526d94d3e04124c5c48ab4a3da6ca53a458 (patch) | |
tree | a2ed8860030cc49f492b09b3222d593c65619800 /daemon | |
parent | Adding upstream version 1.29.3. (diff) | |
download | netdata-f99c4526d94d3e04124c5c48ab4a3da6ca53a458.tar.xz netdata-f99c4526d94d3e04124c5c48ab4a3da6ca53a458.zip |
Adding upstream version 1.30.0.upstream/1.30.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | daemon/README.md | 4 | ||||
-rwxr-xr-x | daemon/anonymous-statistics.sh.in | 133 | ||||
-rw-r--r-- | daemon/buildinfo.c | 255 | ||||
-rw-r--r-- | daemon/buildinfo.h | 2 | ||||
-rw-r--r-- | daemon/common.h | 4 | ||||
-rw-r--r-- | daemon/config/README.md | 5 | ||||
-rw-r--r-- | daemon/main.c | 7 | ||||
-rw-r--r-- | daemon/main.h | 2 | ||||
-rw-r--r-- | daemon/unit_test.c | 2 |
9 files changed, 249 insertions, 165 deletions
diff --git a/daemon/README.md b/daemon/README.md index ec1f1c7cc..359b3ea39 100644 --- a/daemon/README.md +++ b/daemon/README.md @@ -395,10 +395,10 @@ all programs), edit `netdata.conf` and set: process nice level = -1 ``` -then execute this to restart netdata: +then execute this to [restart Netdata](/docs/configure/start-stop-restart.md): ```sh -sudo service netdata restart +sudo systemctl restart netdata ``` #### Example 2: Netdata with nice -1 on systemd systems 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 diff --git a/daemon/buildinfo.c b/daemon/buildinfo.c index de02a72e1..b16390544 100644 --- a/daemon/buildinfo.c +++ b/daemon/buildinfo.c @@ -6,224 +6,309 @@ // Optional features #ifdef ENABLE_ACLK -#define FEAT_CLOUD "YES" +#define FEAT_CLOUD 1 +#define FEAT_CLOUD_MSG "" +#ifdef ACLK_NG +#define ACLK_IMPL "Next Generation" #else +#define ACLK_IMPL "Legacy" +#endif +#else +#define ACLK_IMPL "" #ifdef DISABLE_CLOUD -#define FEAT_CLOUD "NO (by user request e.g. '--disable-cloud')" +#define FEAT_CLOUD 0 +#define FEAT_CLOUD_MSG "(by user request)" #else -#define FEAT_CLOUD "NO" +#define FEAT_CLOUD 0 +#define FEAT_CLOUD_MSG "" #endif #endif #ifdef ENABLE_DBENGINE -#define FEAT_DBENGINE "YES" +#define FEAT_DBENGINE 1 #else -#define FEAT_DBENGINE "NO" +#define FEAT_DBENGINE 0 #endif #if defined(HAVE_X509_VERIFY_PARAM_set1_host) && HAVE_X509_VERIFY_PARAM_set1_host == 1 -#define FEAT_TLS_HOST_VERIFY "YES" +#define FEAT_TLS_HOST_VERIFY 1 #else -#define FEAT_TLS_HOST_VERIFY "NO" +#define FEAT_TLS_HOST_VERIFY 0 #endif #ifdef ENABLE_HTTPS -#define FEAT_NATIVE_HTTPS "YES" +#define FEAT_NATIVE_HTTPS 1 #else -#define FEAT_NATIVE_HTTPS "NO" +#define FEAT_NATIVE_HTTPS 0 #endif // Optional libraries #ifdef ENABLE_JSONC -#define FEAT_JSONC "YES" +#define FEAT_JSONC 1 #else -#define FEAT_JSONC "NO" +#define FEAT_JSONC 0 #endif #ifdef ENABLE_JEMALLOC -#define FEAT_JEMALLOC "YES" +#define FEAT_JEMALLOC 1 #else -#define FEAT_JEMALLOC "NO" +#define FEAT_JEMALLOC 0 #endif #ifdef ENABLE_TCMALLOC -#define FEAT_TCMALLOC "YES" +#define FEAT_TCMALLOC 1 #else -#define FEAT_TCMALLOC "NO" +#define FEAT_TCMALLOC 0 #endif #ifdef HAVE_CAPABILITY -#define FEAT_LIBCAP "YES" +#define FEAT_LIBCAP 1 #else -#define FEAT_LIBCAP "NO" +#define FEAT_LIBCAP 0 #endif +#ifndef ACLK_NG #ifdef ACLK_NO_LIBMOSQ -#define FEAT_MOSQUITTO "NO" +#define FEAT_MOSQUITTO 0 #else -#define FEAT_MOSQUITTO "YES" +#define FEAT_MOSQUITTO 1 #endif #ifdef ACLK_NO_LWS -#define FEAT_LWS "NO" +#define FEAT_LWS 0 +#define FEAT_LWS_MSG "" #else #ifdef ENABLE_ACLK #include <libwebsockets.h> #endif #ifdef BUNDLED_LWS -#define FEAT_LWS "YES static" +#define FEAT_LWS 1 +#define FEAT_LWS_MSG "static" #else -#define FEAT_LWS "YES shared-lib" +#define FEAT_LWS 1 +#define FEAT_LWS_MSG "shared-lib" #endif #endif +#endif /* ACLK_NG */ #ifdef NETDATA_WITH_ZLIB -#define FEAT_ZLIB "YES" +#define FEAT_ZLIB 1 #else -#define FEAT_ZLIB "NO" +#define FEAT_ZLIB 0 #endif #ifdef STORAGE_WITH_MATH -#define FEAT_LIBM "YES" +#define FEAT_LIBM 1 #else -#define FEAT_LIBM "NO" +#define FEAT_LIBM 0 #endif #ifdef HAVE_CRYPTO -#define FEAT_CRYPTO "YES" +#define FEAT_CRYPTO 1 #else -#define FEAT_CRYPTO "NO" +#define FEAT_CRYPTO 0 #endif // Optional plugins #ifdef ENABLE_APPS_PLUGIN -#define FEAT_APPS_PLUGIN "YES" +#define FEAT_APPS_PLUGIN 1 #else -#define FEAT_APPS_PLUGIN "NO" +#define FEAT_APPS_PLUGIN 0 #endif #ifdef HAVE_FREEIPMI -#define FEAT_IPMI "YES" +#define FEAT_IPMI 1 #else -#define FEAT_IPMI "NO" +#define FEAT_IPMI 0 #endif #ifdef HAVE_CUPS -#define FEAT_CUPS "YES" +#define FEAT_CUPS 1 #else -#define FEAT_CUPS "NO" +#define FEAT_CUPS 0 #endif -#ifdef HAVE_LIBMNL -#define FEAT_NFACCT "YES" +#ifdef HAVE_NFACCT +#define FEAT_NFACCT 1 #else -#define FEAT_NFACCT "NO" +#define FEAT_NFACCT 0 #endif #ifdef HAVE_LIBXENSTAT -#define FEAT_XEN "YES" +#define FEAT_XEN 1 #else -#define FEAT_XEN "NO" +#define FEAT_XEN 0 #endif #ifdef HAVE_XENSTAT_VBD_ERROR -#define FEAT_XEN_VBD_ERROR "YES" +#define FEAT_XEN_VBD_ERROR 1 #else -#define FEAT_XEN_VBD_ERROR "NO" +#define FEAT_XEN_VBD_ERROR 0 #endif #ifdef HAVE_LIBBPF -#define FEAT_EBPF "YES" +#define FEAT_EBPF 1 #else -#define FEAT_EBPF "NO" +#define FEAT_EBPF 0 #endif #ifdef HAVE_SETNS -#define FEAT_CGROUP_NET "YES" +#define FEAT_CGROUP_NET 1 #else -#define FEAT_CGROUP_NET "NO" +#define FEAT_CGROUP_NET 0 #endif #ifdef ENABLE_PERF_PLUGIN -#define FEAT_PERF "YES" +#define FEAT_PERF 1 #else -#define FEAT_PERF "NO" +#define FEAT_PERF 0 #endif #ifdef ENABLE_SLABINFO -#define FEAT_SLABINFO "YES" +#define FEAT_SLABINFO 1 #else -#define FEAT_SLABINFO "NO" +#define FEAT_SLABINFO 0 #endif // Optional Exporters #ifdef HAVE_KINESIS -#define FEAT_KINESIS "YES" +#define FEAT_KINESIS 1 #else -#define FEAT_KINESIS "NO" +#define FEAT_KINESIS 0 #endif #ifdef ENABLE_EXPORTING_PUBSUB -#define FEAT_PUBSUB "YES" +#define FEAT_PUBSUB 1 #else -#define FEAT_PUBSUB "NO" +#define FEAT_PUBSUB 0 #endif #ifdef HAVE_MONGOC -#define FEAT_MONGO "YES" +#define FEAT_MONGO 1 #else -#define FEAT_MONGO "NO" +#define FEAT_MONGO 0 #endif #ifdef ENABLE_PROMETHEUS_REMOTE_WRITE -#define FEAT_REMOTE_WRITE "YES" +#define FEAT_REMOTE_WRITE 1 #else -#define FEAT_REMOTE_WRITE "NO" +#define FEAT_REMOTE_WRITE 0 #endif +#define FEAT_YES_NO(x) ((x) ? "YES" : "NO") void print_build_info(void) { printf("Configure options: %s\n", CONFIGURE_COMMAND); printf("Features:\n"); - printf(" dbengine: %s\n", FEAT_DBENGINE); - printf(" Native HTTPS: %s\n", FEAT_NATIVE_HTTPS); - printf(" Netdata Cloud: %s\n", FEAT_CLOUD); - printf(" TLS Host Verification: %s\n", FEAT_TLS_HOST_VERIFY); + printf(" dbengine: %s\n", FEAT_YES_NO(FEAT_DBENGINE)); + printf(" Native HTTPS: %s\n", FEAT_YES_NO(FEAT_NATIVE_HTTPS)); + printf(" Netdata Cloud: %s %s\n", FEAT_YES_NO(FEAT_CLOUD), FEAT_CLOUD_MSG); +#if FEAT_CLOUD == 1 + printf(" Cloud Implementation: %s\n", ACLK_IMPL); +#endif + printf(" TLS Host Verification: %s\n", FEAT_YES_NO(FEAT_TLS_HOST_VERIFY)); printf("Libraries:\n"); - printf(" jemalloc: %s\n", FEAT_JEMALLOC); - printf(" JSON-C: %s\n", FEAT_JSONC); - printf(" libcap: %s\n", FEAT_LIBCAP); - printf(" libcrypto: %s\n", FEAT_CRYPTO); - printf(" libm: %s\n", FEAT_LIBM); + printf(" jemalloc: %s\n", FEAT_YES_NO(FEAT_JEMALLOC)); + printf(" JSON-C: %s\n", FEAT_YES_NO(FEAT_JSONC)); + printf(" libcap: %s\n", FEAT_YES_NO(FEAT_LIBCAP)); + printf(" libcrypto: %s\n", FEAT_YES_NO(FEAT_CRYPTO)); + printf(" libm: %s\n", FEAT_YES_NO(FEAT_LIBM)); +#ifndef ACLK_NG #if defined(ENABLE_ACLK) - printf(" LWS: %s v%d.%d.%d\n", FEAT_LWS, LWS_LIBRARY_VERSION_MAJOR, LWS_LIBRARY_VERSION_MINOR, LWS_LIBRARY_VERSION_PATCH); + printf(" LWS: %s %s v%d.%d.%d\n", FEAT_YES_NO(FEAT_LWS), FEAT_LWS_MSG, LWS_LIBRARY_VERSION_MAJOR, LWS_LIBRARY_VERSION_MINOR, LWS_LIBRARY_VERSION_PATCH); #else - printf(" LWS: %s\n", FEAT_LWS); + printf(" LWS: %s %s\n", FEAT_YES_NO(FEAT_LWS), FEAT_LWS_MSG); +#endif + printf(" mosquitto: %s\n", FEAT_YES_NO(FEAT_MOSQUITTO)); #endif - printf(" mosquitto: %s\n", FEAT_MOSQUITTO); - printf(" tcalloc: %s\n", FEAT_TCMALLOC); - printf(" zlib: %s\n", FEAT_ZLIB); + printf(" tcalloc: %s\n", FEAT_YES_NO(FEAT_TCMALLOC)); + printf(" zlib: %s\n", FEAT_YES_NO(FEAT_ZLIB)); printf("Plugins:\n"); - printf(" apps: %s\n", FEAT_APPS_PLUGIN); - printf(" cgroup Network Tracking: %s\n", FEAT_CGROUP_NET); - printf(" CUPS: %s\n", FEAT_CUPS); - printf(" EBPF: %s\n", FEAT_EBPF); - printf(" IPMI: %s\n", FEAT_IPMI); - printf(" NFACCT: %s\n", FEAT_NFACCT); - printf(" perf: %s\n", FEAT_PERF); - printf(" slabinfo: %s\n", FEAT_SLABINFO); - printf(" Xen: %s\n", FEAT_XEN); - printf(" Xen VBD Error Tracking: %s\n", FEAT_XEN_VBD_ERROR); + printf(" apps: %s\n", FEAT_YES_NO(FEAT_APPS_PLUGIN)); + printf(" cgroup Network Tracking: %s\n", FEAT_YES_NO(FEAT_CGROUP_NET)); + printf(" CUPS: %s\n", FEAT_YES_NO(FEAT_CUPS)); + printf(" EBPF: %s\n", FEAT_YES_NO(FEAT_EBPF)); + printf(" IPMI: %s\n", FEAT_YES_NO(FEAT_IPMI)); + printf(" NFACCT: %s\n", FEAT_YES_NO(FEAT_NFACCT)); + printf(" perf: %s\n", FEAT_YES_NO(FEAT_PERF)); + printf(" slabinfo: %s\n", FEAT_YES_NO(FEAT_SLABINFO)); + printf(" Xen: %s\n", FEAT_YES_NO(FEAT_XEN)); + printf(" Xen VBD Error Tracking: %s\n", FEAT_YES_NO(FEAT_XEN_VBD_ERROR)); printf("Exporters:\n"); - printf(" AWS Kinesis: %s\n", FEAT_KINESIS); - printf(" GCP PubSub: %s\n", FEAT_PUBSUB); - printf(" MongoDB: %s\n", FEAT_MONGO); - printf(" Prometheus Remote Write: %s\n", FEAT_REMOTE_WRITE); + printf(" AWS Kinesis: %s\n", FEAT_YES_NO(FEAT_KINESIS)); + printf(" GCP PubSub: %s\n", FEAT_YES_NO(FEAT_PUBSUB)); + printf(" MongoDB: %s\n", FEAT_YES_NO(FEAT_MONGO)); + printf(" Prometheus Remote Write: %s\n", FEAT_YES_NO(FEAT_REMOTE_WRITE)); +}; + + +#define FEAT_JSON_BOOL(x) ((x) ? "true" : "false") +// This intentionally does not use JSON-C so it works even if JSON-C is not present +// This is used for anonymous statistics reporting, so it intentionally +// does not include the configure options, which would be very easy to use +// for tracking custom builds (and complicate outputting valid JSON). +void print_build_info_json(void) { + printf("{\n"); + printf(" \"features\": {\n"); + printf(" \"dbengine\": %s,\n", FEAT_JSON_BOOL(FEAT_DBENGINE)); + printf(" \"native-https\": %s,\n", FEAT_JSON_BOOL(FEAT_NATIVE_HTTPS)); + printf(" \"cloud\": %s,\n", FEAT_JSON_BOOL(FEAT_CLOUD)); +#ifdef DISABLE_CLOUD + printf(" \"cloud-disabled\": true,\n"); +#else + printf(" \"cloud-disabled\": false,\n"); +#endif +#if FEAT_CLOUD == 1 + printf(" \"cloud-implementation\": \"%s\",\n", ACLK_IMPL); +#endif + printf(" \"tls-host-verify\": %s\n", FEAT_JSON_BOOL(FEAT_TLS_HOST_VERIFY)); + printf(" },\n"); + + printf(" \"libs\": {\n"); + printf(" \"jemalloc\": %s,\n", FEAT_JSON_BOOL(FEAT_JEMALLOC)); + printf(" \"jsonc\": %s,\n", FEAT_JSON_BOOL(FEAT_JSONC)); + printf(" \"libcap\": %s,\n", FEAT_JSON_BOOL(FEAT_LIBCAP)); + printf(" \"libcrypto\": %s,\n", FEAT_JSON_BOOL(FEAT_CRYPTO)); + printf(" \"libm\": %s,\n", FEAT_JSON_BOOL(FEAT_LIBM)); +#ifndef ACLK_NG +#if defined(ENABLE_ACLK) + printf(" \"lws\": %s,\n", FEAT_JSON_BOOL(FEAT_LWS)); + printf(" \"lws-version\": \"%d.%d.%d\",\n", LWS_LIBRARY_VERSION_MAJOR, LWS_LIBRARY_VERSION_MINOR, LWS_LIBRARY_VERSION_PATCH); + printf(" \"lws-type\": \"%s\",\n", FEAT_LWS_MSG); +#else + printf(" \"lws\": %s,\n", FEAT_JSON_BOOL(FEAT_LWS)); +#endif + printf(" \"mosquitto\": %s,\n", FEAT_JSON_BOOL(FEAT_MOSQUITTO)); +#endif + printf(" \"tcmalloc\": %s,\n", FEAT_JSON_BOOL(FEAT_TCMALLOC)); + printf(" \"zlib\": %s\n", FEAT_JSON_BOOL(FEAT_ZLIB)); + printf(" },\n"); + + printf(" \"plugins\": {\n"); + printf(" \"apps\": %s,\n", FEAT_JSON_BOOL(FEAT_APPS_PLUGIN)); + printf(" \"cgroup-net\": %s,\n", FEAT_JSON_BOOL(FEAT_CGROUP_NET)); + printf(" \"cups\": %s,\n", FEAT_JSON_BOOL(FEAT_CUPS)); + printf(" \"ebpf\": %s,\n", FEAT_JSON_BOOL(FEAT_EBPF)); + printf(" \"ipmi\": %s,\n", FEAT_JSON_BOOL(FEAT_IPMI)); + printf(" \"nfacct\": %s,\n", FEAT_JSON_BOOL(FEAT_NFACCT)); + printf(" \"perf\": %s,\n", FEAT_JSON_BOOL(FEAT_PERF)); + printf(" \"slabinfo\": %s,\n", FEAT_JSON_BOOL(FEAT_SLABINFO)); + printf(" \"xen\": %s,\n", FEAT_JSON_BOOL(FEAT_XEN)); + printf(" \"xen-vbd-error\": %s\n", FEAT_JSON_BOOL(FEAT_XEN_VBD_ERROR)); + printf(" },\n"); + + printf(" \"exporters\": {\n"); + printf(" \"kinesis\": %s,\n", FEAT_JSON_BOOL(FEAT_KINESIS)); + printf(" \"pubsub\": %s,\n", FEAT_JSON_BOOL(FEAT_PUBSUB)); + printf(" \"mongodb\": %s,\n", FEAT_JSON_BOOL(FEAT_MONGO)); + printf(" \"prom-remote-write\": %s\n", FEAT_JSON_BOOL(FEAT_REMOTE_WRITE)); + printf(" }\n"); + printf("}\n"); }; diff --git a/daemon/buildinfo.h b/daemon/buildinfo.h index 76912ea67..05e5efb5a 100644 --- a/daemon/buildinfo.h +++ b/daemon/buildinfo.h @@ -5,4 +5,6 @@ extern void print_build_info(void); +extern void print_build_info_json(void); + #endif // NETDATA_BUILDINFO_H diff --git a/daemon/common.h b/daemon/common.h index 68af95740..1a58ddda8 100644 --- a/daemon/common.h +++ b/daemon/common.h @@ -66,7 +66,11 @@ #include "claim/claim.h" // netdata agent cloud link +#ifndef ACLK_NG #include "aclk/legacy/agent_cloud_link.h" +#else +#include "aclk/aclk.h" +#endif // global GUID map functions diff --git a/daemon/config/README.md b/daemon/config/README.md index a1e2b04b5..b1e790a21 100644 --- a/daemon/config/README.md +++ b/daemon/config/README.md @@ -28,10 +28,11 @@ The configuration file is a `name = value` dictionary. Netdata will not complain ## Applying changes -After `netdata.conf` has been modified, Netdata needs to be restarted for changes to apply: +After `netdata.conf` has been modified, Netdata needs to be [restarted](/docs/configure/start-stop-restart.md) for +changes to apply: ```bash -sudo service netdata restart +sudo systemctl restart netdata ``` If the above does not work, try the following: diff --git a/daemon/main.c b/daemon/main.c index 7c002ac47..346486a84 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -50,6 +50,7 @@ void netdata_cleanup_and_exit(int ret) { rrdeng_exit(&multidb_ctx); #endif } + sql_close_database(); // unlink the pid if(pidfile[0]) { @@ -80,7 +81,7 @@ struct netdata_static_thread static_threads[] = { NETDATA_PLUGIN_HOOK_IDLEJITTER NETDATA_PLUGIN_HOOK_STATSD -#ifdef ENABLE_ACLK +#if defined(ENABLE_ACLK) || defined(ACLK_NG) NETDATA_ACLK_HOOK #endif @@ -1258,6 +1259,10 @@ int main(int argc, char **argv) { print_build_info(); return 0; } + else if(strcmp(optarg, "buildinfojson") == 0) { + print_build_info_json(); + return 0; + } else { fprintf(stderr, "Unknown -W parameter '%s'\n", optarg); return help(1); diff --git a/daemon/main.h b/daemon/main.h index 9d9f4ef0f..4000ab70b 100644 --- a/daemon/main.h +++ b/daemon/main.h @@ -19,7 +19,7 @@ struct option_def { const char val; /** The name of the long option. */ const char *description; - /** Short descripton what the option does */ + /** Short description what the option does */ /** Name of the argument displayed in SYNOPSIS */ const char *arg_name; /** Default value if not set */ diff --git a/daemon/unit_test.c b/daemon/unit_test.c index e6a69e354..9a17aa762 100644 --- a/daemon/unit_test.c +++ b/daemon/unit_test.c @@ -371,7 +371,7 @@ int unit_test_str2ld() { return -1; } } - else if(mine != sys && abs(mine-sys) > 0.000001) { + else if(mine != sys && ABS(mine-sys) > 0.000001) { fprintf(stderr, "Value '%s' is parsed as %" LONG_DOUBLE_MODIFIER ", but system believes it is %" LONG_DOUBLE_MODIFIER ", delta %" LONG_DOUBLE_MODIFIER ".\n", values[i], mine, sys, sys-mine); return -1; } |