diff --git a/apps/emqx/src/emqx_schema.erl b/apps/emqx/src/emqx_schema.erl index ceb84532b..8f12abf47 100644 --- a/apps/emqx/src/emqx_schema.erl +++ b/apps/emqx/src/emqx_schema.erl @@ -1033,6 +1033,7 @@ in the VM exceeds this value" sc(string(), #{ mapping => "system_monitor.db_hostname" , desc => "Hostname of the PostgreSQL database that collects the data points" + , default => "" }) } , {"db_port", diff --git a/apps/emqx_machine/src/emqx_machine.erl b/apps/emqx_machine/src/emqx_machine.erl index 9946a4195..602fc3f54 100644 --- a/apps/emqx_machine/src/emqx_machine.erl +++ b/apps/emqx_machine/src/emqx_machine.erl @@ -64,13 +64,13 @@ start_sysmon() -> application:set_env(system_monitor, node_status_fun, {?MODULE, node_status}), application:set_env(system_monitor, status_checks, [{?MODULE, update_vips, false, 10}]), case application:get_env(system_monitor, db_hostname) of - undefined -> - %% If there is no sink for the events, there is no reason - %% to run system_monitor_top, ignore it: - ok; - _ -> + {ok, [_|_]} -> application:set_env(system_monitor, callback_mod, system_monitor_pg), _ = application:ensure_all_started(system_monitor, temporary), + ok; + _ -> + %% If there is no sink for the events, there is no reason + %% to run system_monitor_top, ignore start ok end. diff --git a/mix.exs b/mix.exs index 7ff32113e..9c4fe1eb2 100644 --- a/mix.exs +++ b/mix.exs @@ -176,7 +176,7 @@ defmodule EMQXUmbrella.MixProject do emqx_plugin_libs: :load, esasl: :load, observer_cli: :permanent, - system_monitor: :permanent, + system_monitor: :load, emqx_http_lib: :permanent, emqx_resource: :permanent, emqx_connector: :permanent, diff --git a/rebar.config.erl b/rebar.config.erl index ca97b691b..c5c2659de 100644 --- a/rebar.config.erl +++ b/rebar.config.erl @@ -302,7 +302,7 @@ relx_apps(ReleaseType, Edition) -> , {emqx_plugin_libs, load} , {esasl, load} , observer_cli - , system_monitor + , {system_monitor, load} % started by emqx_machine , emqx_http_lib , emqx_resource , emqx_connector