add broker, bridges, listeners commands
This commit is contained in:
parent
c5a72bd1fb
commit
c52857f398
|
@ -1,27 +0,0 @@
|
||||||
%%------------------------------------------------------------------------------
|
|
||||||
%% Copyright (c) 2012-2015, Feng Lee <feng@emqtt.io>
|
|
||||||
%%
|
|
||||||
%% 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).
|
|
|
@ -148,12 +148,100 @@ case "$1" in
|
||||||
$NODETOOL rpc emqttd_ctl userdel $@
|
$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 <Node> <Topic>"
|
||||||
|
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 <Node> <Topic>"
|
||||||
|
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 "Usage: $SCRIPT"
|
||||||
echo " status #query emqttd status"
|
echo " status #query emqttd status"
|
||||||
echo " cluster [<Node>] #query or cluster nodes"
|
echo " listeners #query emqttd listeners"
|
||||||
echo " useradd <Username> <Password> #add user"
|
echo " broker [stats | metrics] #query broker stats/metrics"
|
||||||
echo " userdel <Username> #delete user"
|
echo " cluster [<Node>] #query or cluster nodes"
|
||||||
|
echo " bridges #querey bridges"
|
||||||
|
echo " start_bridge <Node> <Topic> #start bridge"
|
||||||
|
echo " stop_bridge <Node> <Topic> #stop bridge"
|
||||||
|
echo " useradd <Username> <Password> #add user"
|
||||||
|
echo " userdel <Username> #delete user"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue