diff --git a/apps/emqttd/src/emqttd_nodes_monitor.erl b/apps/emqttd/src/emqttd_nodes_monitor.erl deleted file mode 100644 index bc2a1cfb3..000000000 --- a/apps/emqttd/src/emqttd_nodes_monitor.erl +++ /dev/null @@ -1,27 +0,0 @@ -%%------------------------------------------------------------------------------ -%% Copyright (c) 2012-2015, Feng Lee -%% -%% Permission is hereby granted, free of charge, to any person obtaining a copy -%% of this software and associated documentation files (the "Software"), to deal -%% in the Software without restriction, including without limitation the rights -%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -%% copies of the Software, and to permit persons to whom the Software is -%% furnished to do so, subject to the following conditions: -%% -%% The above copyright notice and this permission notice shall be included in all -%% copies or substantial portions of the Software. -%% -%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -%% SOFTWARE. -%%------------------------------------------------------------------------------ -%%% @doc -%%% clusted nodes monitor. -%%% -%%% @end -%%%----------------------------------------------------------------------------- --module(emqttd_nodes_monitor). diff --git a/rel/files/emqttd_ctl b/rel/files/emqttd_ctl index 7f558f3f0..4006e017a 100755 --- a/rel/files/emqttd_ctl +++ b/rel/files/emqttd_ctl @@ -148,12 +148,100 @@ case "$1" in $NODETOOL rpc emqttd_ctl userdel $@ ;; + broker) + if [ $# -gt 2 ]; then + echo "Usage: $SCRIPT broker [stats | metrics]" + exit 1 + fi + + # Make sure the local node IS running + RES=`$NODETOOL ping` + if [ "$RES" != "pong" ]; then + echo "emqttd is not running!" + exit 1 + fi + shift + + $NODETOOL rpc emqttd_ctl broker $@ + ;; + + bridges) + if [ $# -gt 1 ]; then + echo "Usage: $SCRIPT bridges" + exit 1 + fi + # Make sure the local node IS running + RES=`$NODETOOL ping` + if [ "$RES" != "pong" ]; then + echo "emqttd is not running!" + exit 1 + fi + shift + + $NODETOOL rpc emqttd_ctl bridges $@ + ;; + + start_bridge) + if [ $# -ne 3 ]; then + echo "Usage: $SCRIPT start_bridge " + exit 1 + fi + + # Make sure the local node IS running + RES=`$NODETOOL ping` + if [ "$RES" != "pong" ]; then + echo "emqttd is not running!" + exit 1 + fi + shift + + $NODETOOL rpc emqttd_ctl start_bridge $@ + ;; + + stop_bridge) + if [ $# -ne 3 ]; then + echo "Usage: $SCRIPT stop_bridge " + exit 1 + fi + + # Make sure the local node IS running + RES=`$NODETOOL ping` + if [ "$RES" != "pong" ]; then + echo "emqttd is not running!" + exit 1 + fi + shift + + $NODETOOL rpc emqttd_ctl stop_bridge $@ + ;; + + listeners) + if [ $# -gt 1 ]; then + echo "Usage: $SCRIPT listeners" + exit 1 + fi + # Make sure the local node IS running + RES=`$NODETOOL ping` + if [ "$RES" != "pong" ]; then + echo "emqttd is not running!" + exit 1 + fi + shift + + $NODETOOL rpc emqttd_ctl listeners $@ + ;; + *) echo "Usage: $SCRIPT" - echo " status #query emqttd status" - echo " cluster [] #query or cluster nodes" - echo " useradd #add user" - echo " userdel #delete user" + echo " status #query emqttd status" + echo " listeners #query emqttd listeners" + echo " broker [stats | metrics] #query broker stats/metrics" + echo " cluster [] #query or cluster nodes" + echo " bridges #querey bridges" + echo " start_bridge #start bridge" + echo " stop_bridge #stop bridge" + echo " useradd #add user" + echo " userdel #delete user" exit 1 ;;