summaryrefslogtreecommitdiffstats
path: root/src/daemon/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/main.c')
-rw-r--r--src/daemon/main.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/daemon/main.c b/src/daemon/main.c
index 30f7457537..6aa13adf65 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -475,7 +475,7 @@ void netdata_cleanup_and_exit(int ret, const char *action, const char *action_re
if (ret)
abort();
else {
- sentry_native_fini();
+ nd_sentry_fini();
exit(ret);
}
#else
@@ -795,6 +795,7 @@ int help(int exitcode) {
" -W sqlite-meta-recover Run recovery on the metadata database and exit.\n\n"
" -W sqlite-compact Reclaim metadata database unused space and exit.\n\n"
" -W sqlite-analyze Run update statistics and exit.\n\n"
+ " -W sqlite-alert-cleanup Perform maintenance on the alerts table.\n\n"
#ifdef ENABLE_DBENGINE
" -W createdataset=N Create a DB engine dataset of N seconds and exit.\n\n"
" -W stresstest=A,B,C,D,E,F,G\n"
@@ -1515,6 +1516,11 @@ int main(int argc, char **argv) {
return 0;
}
+ if(strcmp(optarg, "sqlite-alert-cleanup") == 0) {
+ sql_alert_cleanup(true);
+ return 0;
+ }
+
if(strcmp(optarg, "unittest") == 0) {
unittest_running = true;
@@ -1883,9 +1889,6 @@ int main(int argc, char **argv) {
load_cloud_conf(0);
}
- // @stelfrag: Where is the right place to call this?
- watcher_thread_start();
-
// ------------------------------------------------------------------------
// initialize netdata
{
@@ -2104,9 +2107,11 @@ int main(int argc, char **argv) {
if(become_daemon(dont_fork, user) == -1)
fatal("Cannot daemonize myself.");
+ watcher_thread_start();
+
// init sentry
#ifdef ENABLE_SENTRY
- sentry_native_init();
+ nd_sentry_init();
#endif
// The "HOME" env var points to the root's home dir because Netdata starts as root. Can't use "HOME".
@@ -2153,7 +2158,14 @@ int main(int argc, char **argv) {
struct rrdhost_system_info *system_info = callocz(1, sizeof(struct rrdhost_system_info));
__atomic_sub_fetch(&netdata_buffers_statistics.rrdhost_allocations_size, sizeof(struct rrdhost_system_info), __ATOMIC_RELAXED);
get_system_info(system_info);
- (void) registry_get_this_machine_guid();
+
+ const char *guid = registry_get_this_machine_guid();
+#ifdef ENABLE_SENTRY
+ nd_sentry_set_user(guid);
+#else
+ UNUSED(guid);
+#endif
+
system_info->hops = 0;
get_install_type(&system_info->install_type, &system_info->prebuilt_arch, &system_info->prebuilt_dist);