Feng 10 лет назад
Родитель
Сommit
4698d040fd
1 измененных файлов с 11 добавлено и 0 удалено
  1. 11 0
      src/emqttd_http.erl

+ 11 - 0
src/emqttd_http.erl

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