diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_cli.erl | 10 | ||||
| -rw-r--r-- | src/rabbit_control_main.erl | 17 | ||||
| -rw-r--r-- | src/rabbit_plugins_main.erl | 4 |
3 files changed, 20 insertions, 11 deletions
diff --git a/src/rabbit_cli.erl b/src/rabbit_cli.erl index 4aad3c0916..6679d9329e 100644 --- a/src/rabbit_cli.erl +++ b/src/rabbit_cli.erl @@ -255,14 +255,10 @@ print_badrpc_diagnostics(Nodes) -> %% a timeout unless we set our ticktime to be the same. So let's do %% that. rpc_call(Node, Mod, Fun, Args) -> - rpc_call(Node, Mod, Fun, Args, ?RPC_TIMEOUT). + rabbit_misc:rpc_call(Node, Mod, Fun, Args). rpc_call(Node, Mod, Fun, Args, Timeout) -> - case rpc:call(Node, net_kernel, get_net_ticktime, [], Timeout) of - {badrpc, _} = E -> E; - Time -> net_kernel:set_net_ticktime(Time, 0), - rpc:call(Node, Mod, Fun, Args, Timeout) - end. + rabbit_misc:rpc_call(Node, Mod, Fun, Args, Timeout). rpc_call(Node, Mod, Fun, Args, Ref, Pid, Timeout) -> - rpc_call(Node, Mod, Fun, Args++[Ref, Pid], Timeout). + rabbit_misc:rpc_call(Node, Mod, Fun, Args, Ref, Pid, Timeout). diff --git a/src/rabbit_control_main.erl b/src/rabbit_control_main.erl index a9077641ec..b7a7b51242 100644 --- a/src/rabbit_control_main.erl +++ b/src/rabbit_control_main.erl @@ -17,12 +17,13 @@ -module(rabbit_control_main). -include("rabbit.hrl"). -include("rabbit_cli.hrl"). +-include("rabbit_misc.hrl"). -export([start/0, stop/0, parse_arguments/2, action/5, action/6, sync_queue/1, cancel_sync_queue/1, become/1, purge_queue/1]). --import(rabbit_cli, [rpc_call/4, rpc_call/5, rpc_call/7]). +-import(rabbit_misc, [rpc_call/4, rpc_call/5, rpc_call/7]). -define(EXTERNAL_CHECK_INTERVAL, 1000). @@ -83,6 +84,7 @@ report, set_cluster_name, eval, + node_health_check, close_connection, {trace_on, [?VHOST_DEF]}, @@ -111,7 +113,7 @@ [stop, stop_app, start_app, wait, reset, force_reset, rotate_logs, join_cluster, change_cluster_node_type, update_cluster_nodes, forget_cluster_node, rename_cluster_node, cluster_status, status, - environment, eval, force_boot, help]). + environment, eval, force_boot, help, node_health_check]). -define(COMMANDS_WITH_TIMEOUT, [list_user_permissions, list_policies, list_queues, list_exchanges, @@ -544,6 +546,17 @@ action(eval, Node, [Expr], _Opts, _Inform) -> action(help, _Node, _Args, _Opts, _Inform) -> io:format("~s", [rabbit_ctl_usage:usage()]); +action(node_health_check, Node, _Args, _Opts, Inform) -> + Inform("Checking health of node ~p", [Node]), + try + rabbit_health_check:node(Node), + io:format("Health check passed~n") + catch + {node_is_ko, ErrorMsg, ErrorCode} -> + io:format("Heath check failed:~n~s~n", [ErrorMsg]), + halt(ErrorCode) + end; + action(Command, Node, Args, Opts, Inform) -> %% For backward compatibility, run commands accepting a timeout with %% the default timeout. diff --git a/src/rabbit_plugins_main.erl b/src/rabbit_plugins_main.erl index 4aeed4826c..e248989a7a 100644 --- a/src/rabbit_plugins_main.erl +++ b/src/rabbit_plugins_main.erl @@ -173,7 +173,7 @@ format_plugins(Node, Pattern, Opts, #cli{all = All, EnabledImplicitly = Implicit -- Enabled, {StatusMsg, Running} = - case rabbit_cli:rpc_call(Node, rabbit_plugins, active, []) of + case rabbit_misc:rpc_call(Node, rabbit_plugins, active, []) of {badrpc, _} -> {"[failed to contact ~s - status not shown]", []}; Active -> {"* = running on ~s", Active} end, @@ -279,7 +279,7 @@ sync(Node, ForceOnline, #cli{file = File}) -> rpc_call(Node, Online, Mod, Fun, Args) -> io:format("~nApplying plugin configuration to ~s...", [Node]), - case rabbit_cli:rpc_call(Node, Mod, Fun, Args) of + case rabbit_misc:rpc_call(Node, Mod, Fun, Args) of {ok, [], []} -> io:format(" nothing to do.~n", []); {ok, Start, []} -> |
