refactor(emqx_mgmt_api_nodes): delete config_path

config path is not always relative to file:get_cwd.
also rephrase some of the descriptions
This commit is contained in:
Zaiming (Stone) Shi 2022-02-16 22:17:41 +01:00
parent 2a6d11c7f1
commit 8f203696ed
1 changed files with 10 additions and 13 deletions

View File

@ -49,18 +49,17 @@ properties() ->
{load1, string, <<"CPU average load in 1 minute">>}, {load1, string, <<"CPU average load in 1 minute">>},
{load5, string, <<"CPU average load in 5 minute">>}, {load5, string, <<"CPU average load in 5 minute">>},
{load15, string, <<"CPU average load in 15 minute">>}, {load15, string, <<"CPU average load in 15 minute">>},
{max_fds, integer, <<"Maximum file descriptor limit for the operating system">>}, {max_fds, integer, <<"File descriptors limit">>},
{memory_total, string, <<"VM allocated system memory">>}, {memory_total, string, <<"Allocated memory">>},
{memory_used, string, <<"VM occupied system memory">>}, {memory_used, string, <<"Used memory">>},
{node_status, string, <<"Node status">>}, {node_status, string, <<"Node status">>},
{otp_release, string, <<"Erlang/OTP version used by EMQX Broker">>}, {otp_release, string, <<"Erlang/OTP version">>},
{process_available, integer, <<"Number of available processes">>}, {process_available, integer, <<"Erlang processes limit">>},
{process_used, integer, <<"Number of used processes">>}, {process_used, integer, <<"Running Erlang processes">>},
{uptime, integer, <<"EMQX Broker runtime, millisecond">>}, {uptime, integer, <<"System uptime, milliseconds">>},
{version, string, <<"EMQX Broker version">>}, {version, string, <<"Release version">>},
{sys_path, string, <<"EMQX system file location">>}, {sys_path, string, <<"Path to system files">>},
{log_path, string, <<"EMQX log file location">>}, {log_path, string, <<"Path to log files">>},
{config_path, string, <<"EMQX config file location">>},
{role, string, <<"Node role">>} {role, string, <<"Node role">>}
]). ]).
@ -166,7 +165,6 @@ get_stats(Node) ->
format(_Node, Info = #{memory_total := Total, memory_used := Used}) -> format(_Node, Info = #{memory_total := Total, memory_used := Used}) ->
{ok, SysPathBinary} = file:get_cwd(), {ok, SysPathBinary} = file:get_cwd(),
SysPath = list_to_binary(SysPathBinary), SysPath = list_to_binary(SysPathBinary),
ConfigPath = <<SysPath/binary, "/etc/emqx.conf">>,
LogPath = case log_path() of LogPath = case log_path() of
undefined -> undefined ->
<<"not found">>; <<"not found">>;
@ -177,7 +175,6 @@ format(_Node, Info = #{memory_total := Total, memory_used := Used}) ->
Info#{ memory_total := emqx_mgmt_util:kmg(Total) Info#{ memory_total := emqx_mgmt_util:kmg(Total)
, memory_used := emqx_mgmt_util:kmg(Used) , memory_used := emqx_mgmt_util:kmg(Used)
, sys_path => SysPath , sys_path => SysPath
, config_path => ConfigPath
, log_path => LogPath}. , log_path => LogPath}.
log_path() -> log_path() ->