fix(system_monitor): Fix conditional start

This commit is contained in:
k32 2022-02-08 11:57:55 +01:00
parent 3b4eade1ad
commit 5a1b18ae86
4 changed files with 8 additions and 7 deletions

View File

@ -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",

View File

@ -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.

View File

@ -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,

View File

@ -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