@cryptotaxi247 / netdata-1 / commits / 204528e61

Report Why ACLK build failed (#8429)

Reports ACLK build failures to GA (if the user didn't opt-out)

Timo committed Mar 26, 2020 at 17:48 UTC 204528e618274918d55b00d96eafe843a2006672
2 files changed +24
configure.ac
+2
@@ -562,6 +562,7 @@ if test "$enable_cloud" = "yes"; then
562 HAVE_libmosquitto_a="yes"
563 else
564 HAVE_libmosquitto_a="no"
565 + AC_DEFINE([ACLK_NO_LIBMOSQ], [1], [Libmosquitto.a was not found during build.])
566 fi
567 AC_MSG_RESULT([${HAVE_libmosquitto_a}])
568
@@ -571,6 +572,7 @@ if test "$enable_cloud" = "yes"; then
572 HAVE_libwebsockets_a="yes"
573 else
574 HAVE_libwebsockets_a="no"
575 + AC_DEFINE([ACLK_NO_LWS], [1], [libwebsockets.a was not found during build.])
576 fi
577 AC_MSG_RESULT([${HAVE_libwebsockets_a}])
578
daemon/main.c
+22
@@ -1339,6 +1339,28 @@ int main(int argc, char **argv) {
1339
1340 send_statistics("START", "-", "-");
1341
1342 + // ------------------------------------------------------------------------
1343 + // Report ACLK build failure
1344 +#ifndef ENABLE_ACLK
1345 + error("This agent doesn't have ACLK.");
1346 + char filename[FILENAME_MAX + 1];
1347 + snprintfz(filename, FILENAME_MAX, "%s/.aclk_report_sent", netdata_configured_varlib_dir);
1348 + if (netdata_anonymous_statistics_enabled > 0 && access(filename, F_OK)) { // -1 -> not initialized
1349 + send_statistics("ACLK_DISABLED", "-", "-");
1350 +#ifdef ACLK_NO_LWS
1351 + send_statistics("BUILD_FAIL_LWS", "-", "-");
1352 +#endif
1353 +#ifdef ACLK_NO_LIBMOSQ
1354 + send_statistics("BUILD_FAIL_MOSQ", "-", "-");
1355 +#endif
1356 + int fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 444);
1357 + if (fd == -1)
1358 + error("Cannot create file '%s'. Please fix this.", filename);
1359 + else
1360 + close(fd);
1361 + }
1362 +#endif
1363 +
1364 // ------------------------------------------------------------------------
1365 // unblock signals
1366