Merge pull request #6505 from JimMoen/v4.x-fix-node-info-format
fix(mgmt): fix node info format for specific node
This commit is contained in:
commit
bec742b1be
|
@ -1,6 +1,6 @@
|
||||||
{application, emqx_management,
|
{application, emqx_management,
|
||||||
[{description, "EMQ X Management API and CLI"},
|
[{description, "EMQ X Management API and CLI"},
|
||||||
{vsn, "4.3.9"}, % strict semver, bump manually!
|
{vsn, "4.3.10"}, % strict semver, bump manually!
|
||||||
{modules, []},
|
{modules, []},
|
||||||
{registered, [emqx_management_sup]},
|
{registered, [emqx_management_sup]},
|
||||||
{applications, [kernel,stdlib,minirest]},
|
{applications, [kernel,stdlib,minirest]},
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
%% -*- mode: erlang -*-
|
%% -*- mode: erlang -*-
|
||||||
{VSN,
|
{VSN,
|
||||||
[ {<<"4\\.3\\.[0-8]+">>,
|
[ {<<"4\\.3\\.[0-9]+">>,
|
||||||
[ {apply,{minirest,stop_http,['http:management']}},
|
[ {apply,{minirest,stop_http,['http:management']}},
|
||||||
{apply,{minirest,stop_http,['https:management']}},
|
{apply,{minirest,stop_http,['https:management']}},
|
||||||
{restart_application, emqx_management}
|
{restart_application, emqx_management}
|
||||||
]},
|
]},
|
||||||
{<<".*">>, []}
|
{<<".*">>, []}
|
||||||
],
|
],
|
||||||
[ {<<"4\\.3\\.[0-8]+">>,
|
[ {<<"4\\.3\\.[0-9]+">>,
|
||||||
[ {apply,{minirest,stop_http,['http:management']}},
|
[ {apply,{minirest,stop_http,['http:management']}},
|
||||||
{apply,{minirest,stop_http,['https:management']}},
|
{apply,{minirest,stop_http,['https:management']}},
|
||||||
{restart_application, emqx_management}
|
{restart_application, emqx_management}
|
||||||
|
|
|
@ -36,11 +36,10 @@ list(_Bindings, _Params) ->
|
||||||
minirest:return({ok, [format(Node, Info) || {Node, Info} <- emqx_mgmt:list_nodes()]}).
|
minirest:return({ok, [format(Node, Info) || {Node, Info} <- emqx_mgmt:list_nodes()]}).
|
||||||
|
|
||||||
get(#{node := Node}, _Params) ->
|
get(#{node := Node}, _Params) ->
|
||||||
minirest:return({ok, emqx_mgmt:lookup_node(Node)}).
|
minirest:return({ok, format(Node, emqx_mgmt:lookup_node(Node))}).
|
||||||
|
|
||||||
format(Node, {error, Reason}) -> #{node => Node, error => Reason};
|
format(Node, {error, Reason}) -> #{node => Node, error => Reason};
|
||||||
|
|
||||||
format(_Node, Info = #{memory_total := Total, memory_used := Used}) ->
|
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)}.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue