This commit is contained in:
Feng 2015-08-25 13:49:28 +08:00
parent 2e22de6123
commit 4698d040fd
1 changed files with 11 additions and 0 deletions

View File

@ -39,6 +39,17 @@
handle_request(Req) -> handle_request(Req) ->
handle_request(Req:get(method), Req:get(path), Req). handle_request(Req:get(method), Req:get(path), Req).
handle_request('GET', "/mqtt/status", Req) ->
{InternalStatus, _ProvidedStatus} = init:get_status(),
AppStatus =
case lists:keysearch(emqttd, 1, application:which_applications()) of
false -> not_running;
{value, _Ver} -> running
end,
Status = io_lib:format("Node ~s is ~s~nemqttd is ~s~n",
[node(), InternalStatus, AppStatus]),
Req:ok({"text/plain", iolist_to_binary(Status)});
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------
%% HTTP Publish API %% HTTP Publish API
%%------------------------------------------------------------------------------ %%------------------------------------------------------------------------------