fix(system_monitor): Fix conditional start
This commit is contained in:
parent
3b4eade1ad
commit
5a1b18ae86
|
@ -1033,6 +1033,7 @@ in the VM exceeds this value"
|
||||||
sc(string(),
|
sc(string(),
|
||||||
#{ mapping => "system_monitor.db_hostname"
|
#{ mapping => "system_monitor.db_hostname"
|
||||||
, desc => "Hostname of the PostgreSQL database that collects the data points"
|
, desc => "Hostname of the PostgreSQL database that collects the data points"
|
||||||
|
, default => ""
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
, {"db_port",
|
, {"db_port",
|
||||||
|
|
|
@ -64,13 +64,13 @@ start_sysmon() ->
|
||||||
application:set_env(system_monitor, node_status_fun, {?MODULE, node_status}),
|
application:set_env(system_monitor, node_status_fun, {?MODULE, node_status}),
|
||||||
application:set_env(system_monitor, status_checks, [{?MODULE, update_vips, false, 10}]),
|
application:set_env(system_monitor, status_checks, [{?MODULE, update_vips, false, 10}]),
|
||||||
case application:get_env(system_monitor, db_hostname) of
|
case application:get_env(system_monitor, db_hostname) of
|
||||||
undefined ->
|
{ok, [_|_]} ->
|
||||||
%% If there is no sink for the events, there is no reason
|
|
||||||
%% to run system_monitor_top, ignore it:
|
|
||||||
ok;
|
|
||||||
_ ->
|
|
||||||
application:set_env(system_monitor, callback_mod, system_monitor_pg),
|
application:set_env(system_monitor, callback_mod, system_monitor_pg),
|
||||||
_ = application:ensure_all_started(system_monitor, temporary),
|
_ = 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
|
ok
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
2
mix.exs
2
mix.exs
|
@ -176,7 +176,7 @@ defmodule EMQXUmbrella.MixProject do
|
||||||
emqx_plugin_libs: :load,
|
emqx_plugin_libs: :load,
|
||||||
esasl: :load,
|
esasl: :load,
|
||||||
observer_cli: :permanent,
|
observer_cli: :permanent,
|
||||||
system_monitor: :permanent,
|
system_monitor: :load,
|
||||||
emqx_http_lib: :permanent,
|
emqx_http_lib: :permanent,
|
||||||
emqx_resource: :permanent,
|
emqx_resource: :permanent,
|
||||||
emqx_connector: :permanent,
|
emqx_connector: :permanent,
|
||||||
|
|
|
@ -302,7 +302,7 @@ relx_apps(ReleaseType, Edition) ->
|
||||||
, {emqx_plugin_libs, load}
|
, {emqx_plugin_libs, load}
|
||||||
, {esasl, load}
|
, {esasl, load}
|
||||||
, observer_cli
|
, observer_cli
|
||||||
, system_monitor
|
, {system_monitor, load} % started by emqx_machine
|
||||||
, emqx_http_lib
|
, emqx_http_lib
|
||||||
, emqx_resource
|
, emqx_resource
|
||||||
, emqx_connector
|
, emqx_connector
|
||||||
|
|
Loading…
Reference in New Issue