Merge pull request #537 from emqtt/issue#534
Fix issue#534 - Add './bin/emqttd_ctl vm ports' CLI
This commit is contained in:
commit
1e89fcec1e
|
@ -368,7 +368,7 @@ vm([]) ->
|
|||
vm(["all"]);
|
||||
|
||||
vm(["all"]) ->
|
||||
[vm([Name]) || Name <- ["load", "memory", "process", "io"]];
|
||||
[vm([Name]) || Name <- ["load", "memory", "process", "io", "ports"]];
|
||||
|
||||
vm(["load"]) ->
|
||||
[?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)])
|
||||
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(_) ->
|
||||
?USAGE([{"vm all", "Show info of erlang vm"},
|
||||
{"vm load", "Show load of erlang vm"},
|
||||
{"vm memory", "Show memory of erlang vm"},
|
||||
{"vm process", "Show process of erlang vm"},
|
||||
{"vm io", "Show IO of erlang vm"}]).
|
||||
?USAGE([{"vm all", "Show info of Erlang VM"},
|
||||
{"vm load", "Show load of Erlang VM"},
|
||||
{"vm memory", "Show memory of Erlang VM"},
|
||||
{"vm process", "Show process of Erlang VM"},
|
||||
{"vm io", "Show IO of Erlang VM"},
|
||||
{"vm ports", "Show Ports of Erlang VM"}]).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @doc mnesia Command
|
||||
|
|
|
@ -74,7 +74,8 @@ groups() ->
|
|||
cli_subscriptions,
|
||||
cli_bridges,
|
||||
cli_plugins,
|
||||
cli_listeners]}].
|
||||
cli_listeners,
|
||||
cli_vm]}].
|
||||
|
||||
init_per_suite(Config) ->
|
||||
application:start(lager),
|
||||
|
@ -419,3 +420,7 @@ cli_bridges(_) ->
|
|||
cli_listeners(_) ->
|
||||
emqttd_cli:listeners([]).
|
||||
|
||||
cli_vm(_) ->
|
||||
emqttd_cli:vm(),
|
||||
emqttd_cli:vm(["ports"]).
|
||||
|
||||
|
|
Loading…
Reference in New Issue