chore: replace recon by obsserver_cli 1.7.0
This commit is contained in:
parent
f4e3eeb2b2
commit
468102f462
|
@ -5,7 +5,7 @@ delayed {
|
|||
max_delayed_messages = 0
|
||||
}
|
||||
|
||||
recon {
|
||||
observer_cli {
|
||||
enable = true
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ stop(_State) ->
|
|||
maybe_enable_modules() ->
|
||||
emqx:get_config([delayed, enable], true) andalso emqx_delayed:enable(),
|
||||
emqx:get_config([telemetry, enable], true) andalso emqx_telemetry:enable(),
|
||||
emqx:get_config([recon, enable], true) andalso emqx_recon:enable(),
|
||||
emqx:get_config([observer_cli, enable], true) andalso emqx_observer_cli:enable(),
|
||||
emqx_event_message:enable(),
|
||||
emqx_rewrite:enable(),
|
||||
emqx_topic_metrics:enable().
|
||||
|
@ -42,7 +42,7 @@ maybe_enable_modules() ->
|
|||
maybe_disable_modules() ->
|
||||
emqx:get_config([delayed, enable], true) andalso emqx_delayed:disable(),
|
||||
emqx:get_config([telemetry, enable], true) andalso emqx_telemetry:disable(),
|
||||
emqx:get_config([recon, enable], true) andalso emqx_recon:disable(),
|
||||
emqx:get_config([observer_cli, enable], true) andalso emqx_observer_cli:disable(),
|
||||
emqx_event_message:disable(),
|
||||
emqx_rewrite:disable(),
|
||||
emqx_topic_metrics:disable().
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
%% limitations under the License.
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
-module(emqx_recon).
|
||||
-module(emqx_observer_cli).
|
||||
|
||||
-export([ enable/0
|
||||
, disable/0
|
||||
|
@ -27,51 +27,27 @@
|
|||
%% enable/disable
|
||||
%%--------------------------------------------------------------------
|
||||
enable() ->
|
||||
emqx_ctl:register_command(recon, {?MODULE, cmd}, []),
|
||||
emqx_ctl:register_command(observer, {?MODULE, cmd}, []).
|
||||
|
||||
disable() ->
|
||||
emqx_ctl:unregister_command(recon),
|
||||
emqx_ctl:unregister_command(observer).
|
||||
|
||||
cmd(["status"]) ->
|
||||
observer_cli:start();
|
||||
cmd(["memory"]) ->
|
||||
Print = fun(Key, Keyword) ->
|
||||
emqx_ctl:print("~-20s: ~w~n", [concat(Key, Keyword), recon_alloc:memory(Key, Keyword)])
|
||||
end,
|
||||
[Print(Key, Keyword) || Key <- [usage, used, allocated, unused], Keyword <- [current, max]];
|
||||
|
||||
cmd(["allocated"]) ->
|
||||
Print = fun(Keyword, Key, Val) -> emqx_ctl:print("~-20s: ~w~n", [concat(Key, Keyword), Val]) end,
|
||||
Alloc = fun(Keyword) -> recon_alloc:memory(allocated_types, Keyword) end,
|
||||
[Print(Keyword, Key, Val) || Keyword <- [current, max], {Key, Val} <- Alloc(Keyword)];
|
||||
|
||||
cmd(["bin_leak"]) ->
|
||||
[emqx_ctl:print("~p~n", [Row]) || Row <- recon:bin_leak(100)];
|
||||
|
||||
cmd(["node_stats"]) ->
|
||||
recon:node_stats_print(10, 1000);
|
||||
|
||||
cmd(["remote_load", Mod]) ->
|
||||
emqx_ctl:print("~p~n", [remote_load(list_to_atom(Mod))]);
|
||||
|
||||
cmd(["proc_count", Attr, N]) ->
|
||||
emqx_ctl:print("~p~n", [recon:proc_count(list_to_atom(Attr), list_to_integer(N))]);
|
||||
cmd(["load", Mod]) ->
|
||||
Module = list_to_existing_atom(Mod),
|
||||
Nodes = nodes(),
|
||||
Res = remote_load(Nodes, Module),
|
||||
emqx_ctl:print("Loaded ~p module on ~p on ~n", [Mod, Nodes, Res]);
|
||||
|
||||
cmd(_) ->
|
||||
emqx_ctl:usage([{"observer status", "observer_cli:start()"},
|
||||
{"recon memory", "recon_alloc:memory/2"},
|
||||
{"recon allocated", "recon_alloc:memory(allocated_types, current|max)"},
|
||||
{"recon bin_leak", "recon:bin_leak(100)"},
|
||||
{"recon node_stats", "recon:node_stats(10, 1000)"},
|
||||
{"recon remote_load Mod", "recon:remote_load(Mod)"},
|
||||
{"recon proc_count Attr N","recon:proc_count(Attr, N)"}]).
|
||||
|
||||
concat(Key, Keyword) ->
|
||||
lists:concat([atom_to_list(Key), "/", atom_to_list(Keyword)]).
|
||||
|
||||
remote_load(Module) -> remote_load(nodes(), Module).
|
||||
{"observer bin_leak", "recon:bin_leak(100)"},
|
||||
{"observer load Mod", "recon:remote_load(Mod) to all nodes"}]).
|
||||
|
||||
%% recon:remote_load/1 has a bug, when nodes() returns [], it is
|
||||
%% taken by recon as a node name.
|
2
bin/emqx
2
bin/emqx
|
@ -681,7 +681,7 @@ case "$1" in
|
|||
|
||||
shift
|
||||
|
||||
relx_nodetool rpc emqx_ctl run_command "$@"
|
||||
relx_nodetool rpc_infinity emqx_ctl run_command "$@"
|
||||
;;
|
||||
rpc)
|
||||
assert_node_alive
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
, {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {tag, "2.0.4"}}}
|
||||
, {emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.4.2"}}}
|
||||
, {rulesql, {git, "https://github.com/emqx/rulesql", {tag, "0.1.2"}}}
|
||||
, {observer_cli, "1.6.1"} % NOTE: depends on recon 2.5.x
|
||||
, {observer_cli, "1.7.0"} % NOTE: depends on recon 2.5.x
|
||||
, {getopt, "1.0.2"}
|
||||
, {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {tag, "0.14.1"}}}
|
||||
, {hocon, {git, "https://github.com/emqx/hocon.git", {tag, "0.12.1"}}}
|
||||
|
|
Loading…
Reference in New Issue