@cryptotaxi247 / netdata-1 / commits / 806b6fadf

Fix the new cloud info in the info endpoint (#8430)

Andrew Moss committed Mar 19, 2020 at 09:27 UTC 806b6fadfdba64c0f08cc7a1ecf3573aa5620dfd
3 files changed +42 -10
configure.ac
+20 -7
@@ -161,14 +161,27 @@ AC_ARG_ENABLE(
161 ,
162 [enable_jsonc="detect"]
163 )
164 -if test "${ACLK}" = "yes"; then
164 +
165 +# -----------------------------------------------------------------------------
166 +# Check if cloud is enabled and if the functionality is available
167 +
168 AC_ARG_ENABLE(
166 - [aclk],
167 - ,
168 - [aclk_required="${enableval}"],
169 - [aclk_required="detect"]
169 + [cloud],
170 + [AS_HELP_STRING([--disable-cloud],
171 + [Disables all cloud functionality])],
172 + [],
173 + [enable_cloud="no"]
174 )
175 +
176 +AC_MSG_CHECKING([if cloud functionality should be enabled])
177 +if test "${enable_cloud}" != "no"; then
178 + AC_DEFINE([ENABLE_CLOUD], [1], [netdata cloud functionality])
179 + aclk_required="detect"
180 +else
181 + aclk_required="no"
182 fi
183 +AC_MSG_RESULT([${enable_cloud}])
184 +AM_CONDITIONAL([ENABLE_CLOUD], [test "${enable_cloud}" = "yes"])
185
186 # -----------------------------------------------------------------------------
187 # netdata required checks
@@ -543,8 +556,7 @@ AM_CONDITIONAL([ENABLE_CAPABILITY], [test "${with_libcap}" = "yes"])
556 # -----------------------------------------------------------------------------
557 # ACLK
558
546 -#currently env var ACLK must be set to 'yes' to even consider building ACLK
547 -if test "${ACLK}" = "yes"; then
559 +if test "$enable_cloud" = "yes"; then
560 AC_MSG_CHECKING([if libmosquitto static lib is present])
561 if test -f "externaldeps/mosquitto/libmosquitto.a"; then
562 HAVE_libmosquitto_a="yes"
@@ -1258,6 +1270,7 @@ AC_ARG_ENABLE(
1270 [enable_unit_tests="yes"]
1271 )
1272
1273 +
1274 PKG_CHECK_MODULES(
1275 [CMOCKA],
1276 [cmocka],
netdata-installer.sh
+6 -2
@@ -189,7 +189,7 @@ USAGE: ${PROGRAM} [options]
189 This results in more frequent updates.
190 --disable-go Disable installation of go.d.plugin.
191 --enable-ebpf Enable eBPF Kernel plugin (Default: disabled, feature preview)
192 - --disable-cloud Disable the agent-cloud link, required for Netdata Cloud functionality.
192 + --disable-cloud Disable all cloud functionality.
193 --enable-plugin-freeipmi Enable the FreeIPMI plugin. Default: enable it when libipmimonitoring is available.
194 --disable-plugin-freeipmi
195 --disable-https Explicitly disable TLS support
@@ -277,7 +277,11 @@ while [ -n "${1}" ]; do
277 "--enable-ebpf") NETDATA_ENABLE_EBPF=1 ;;
278 "--disable-cloud")
279 NETDATA_DISABLE_CLOUD=1
280 - NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-aclk/} --disable-aclk"
280 + NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-cloud/} --disable-cloud"
281 + ;;
282 + "--cloud-testing") # Temporary, until we flip the feature flag. Internal use only
283 + NETDATA_DISABLE_CLOUD=0
284 + NETDATA_CONFIGURE_OPTIONS="${NETDATA_CONFIGURE_OPTIONS//--disable-cloud/} --enable-cloud"
285 ;;
286 "--install")
287 NETDATA_PREFIX="${2}/netdata"
web/api/web_api_v1.c
+16 -1
@@ -859,7 +859,22 @@ inline int web_client_api_request_v1_info_fill_buffer(RRDHOST *host, BUFFER *wb)
859
860 buffer_strcat(wb, "\t\"collectors\": [");
861 chartcollectors2json(host, wb);
862 - buffer_strcat(wb, "\n\t]\n");
862 + buffer_strcat(wb, "\n\t],\n");
863 +
864 +#ifdef ENABLE_CLOUD
865 + buffer_strcat(wb, "\t\"cloud-enabled\": true,\n");
866 +#else
867 + buffer_strcat(wb, "\t\"cloud-enabled\": false,\n");
868 +#endif
869 +#ifdef ENABLE_ACLK
870 + buffer_strcat(wb, "\t\"cloud-available\": true,\n");
871 +#else
872 + buffer_strcat(wb, "\t\"cloud-available\": false,\n");
873 +#endif
874 + if (is_agent_claimed() == NULL)
875 + buffer_strcat(wb, "\t\"agent-claimed\": false\n");
876 + else
877 + buffer_strcat(wb, "\t\"agent-claimed\": true\n");
878
879 buffer_strcat(wb, "}");
880 return 0;