소스 검색

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
Feng Lee 10 년 전
부모
커밋
0dac625e3b
3개의 변경된 파일20개의 추가작업 그리고 1개의 파일을 삭제
  1. 8 0
      CHANGELOG.md
  2. 1 1
      plugins/emqttd_dashboard
  3. 11 0
      src/emqttd_http.erl

+ 8 - 0
CHANGELOG.md

@@ -2,6 +2,14 @@
 emqttd ChangeLog
 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)
 0.10.0-beta (2015-08-20)
 -------------------------
 -------------------------
 
 

+ 1 - 1
plugins/emqttd_dashboard

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

+ 11 - 0
src/emqttd_http.erl

@@ -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
 %%------------------------------------------------------------------------------
 %%------------------------------------------------------------------------------