Fix issue#534 - Add './bin/emqttd_ctl vm ports' CLI
This commit is contained in:
parent
18b8e8195f
commit
17d1598688
|
@ -368,7 +368,7 @@ vm([]) ->
|
||||||
vm(["all"]);
|
vm(["all"]);
|
||||||
|
|
||||||
vm(["all"]) ->
|
vm(["all"]) ->
|
||||||
[vm([Name]) || Name <- ["load", "memory", "process", "io"]];
|
[vm([Name]) || Name <- ["load", "memory", "process", "io", "ports"]];
|
||||||
|
|
||||||
vm(["load"]) ->
|
vm(["load"]) ->
|
||||||
[?PRINT("cpu/~-20s: ~s~n", [L, V]) || {L, V} <- emqttd_vm:loads()];
|
[?PRINT("cpu/~-20s: ~s~n", [L, V]) || {L, V} <- emqttd_vm:loads()];
|
||||||
|
@ -387,12 +387,18 @@ vm(["io"]) ->
|
||||||
?PRINT("io/~-21s: ~w~n", [Key, get_value(Key, IoInfo)])
|
?PRINT("io/~-21s: ~w~n", [Key, get_value(Key, IoInfo)])
|
||||||
end, [max_fds, active_fds]);
|
end, [max_fds, active_fds]);
|
||||||
|
|
||||||
|
vm(["ports"]) ->
|
||||||
|
foreach(fun({Name, Key}) ->
|
||||||
|
?PRINT("ports/~-16s: ~w~n", [Name, erlang:system_info(Key)])
|
||||||
|
end, [{count, port_count}, {limit, port_limit}]);
|
||||||
|
|
||||||
vm(_) ->
|
vm(_) ->
|
||||||
?USAGE([{"vm all", "Show info of erlang vm"},
|
?USAGE([{"vm all", "Show info of Erlang VM"},
|
||||||
{"vm load", "Show load of erlang vm"},
|
{"vm load", "Show load of Erlang VM"},
|
||||||
{"vm memory", "Show memory of erlang vm"},
|
{"vm memory", "Show memory of Erlang VM"},
|
||||||
{"vm process", "Show process of erlang vm"},
|
{"vm process", "Show process of Erlang VM"},
|
||||||
{"vm io", "Show IO of erlang vm"}]).
|
{"vm io", "Show IO of Erlang VM"},
|
||||||
|
{"vm ports", "Show Ports of Erlang VM"}]).
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% @doc mnesia Command
|
%% @doc mnesia Command
|
||||||
|
|
|
@ -74,7 +74,8 @@ groups() ->
|
||||||
cli_subscriptions,
|
cli_subscriptions,
|
||||||
cli_bridges,
|
cli_bridges,
|
||||||
cli_plugins,
|
cli_plugins,
|
||||||
cli_listeners]}].
|
cli_listeners,
|
||||||
|
cli_vm]}].
|
||||||
|
|
||||||
init_per_suite(Config) ->
|
init_per_suite(Config) ->
|
||||||
application:start(lager),
|
application:start(lager),
|
||||||
|
@ -419,3 +420,7 @@ cli_bridges(_) ->
|
||||||
cli_listeners(_) ->
|
cli_listeners(_) ->
|
||||||
emqttd_cli:listeners([]).
|
emqttd_cli:listeners([]).
|
||||||
|
|
||||||
|
cli_vm(_) ->
|
||||||
|
emqttd_cli:vm(),
|
||||||
|
emqttd_cli:vm(["ports"]).
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue