Merge pull request #263 from emqtt/dev

0.10.1 and fix issue #262 - Add 'http://host:8083/mqtt/status' page for health check #262
This commit is contained in:
Feng Lee 2015-08-25 14:54:21 +08:00
commit 0dac625e3b
3 changed files with 20 additions and 1 deletions

View File

@ -2,6 +2,14 @@
emqttd ChangeLog
==================
0.10.1-beta (2015-08-25)
-------------------------
Bugfix: issue#259 - when clustered the emqttd_dashboard port is close, and the 'emqttd' application cannot stop normally.
Feature: issue#262 - Add 'http://host:8083/mqtt/status' Page for health check
0.10.0-beta (2015-08-20)
-------------------------

@ -1 +1 @@
Subproject commit c87d9c4580e568917b4b026c809becf2cccd469e
Subproject commit edbb6dc0862973137b056248efb5940d003d75be

View File

@ -39,6 +39,17 @@
handle_request(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
%%------------------------------------------------------------------------------