|
114 | 114 | [stop, stop_app, start_app, wait, reset, force_reset, rotate_logs,
|
115 | 115 | join_cluster, change_cluster_node_type, update_cluster_nodes,
|
116 | 116 | forget_cluster_node, rename_cluster_node, cluster_status, status,
|
117 |
| - environment, eval, force_boot, help, node_health_check, hipe_compile]). |
| 117 | + environment, eval, force_boot, help, hipe_compile]). |
118 | 118 |
|
119 | 119 | %% [Command | {Command, DefaultTimeoutInMilliSeconds}]
|
120 | 120 | -define(COMMANDS_WITH_TIMEOUT,
|
121 | 121 | [list_user_permissions, list_policies, list_queues, list_exchanges,
|
122 | 122 | list_bindings, list_connections, list_channels, list_consumers,
|
123 | 123 | list_vhosts, list_parameters,
|
124 |
| - purge_queue]). |
| 124 | + purge_queue, |
| 125 | + {node_health_check, 70000}]). |
125 | 126 |
|
126 | 127 | %%----------------------------------------------------------------------------
|
127 | 128 |
|
@@ -578,17 +579,6 @@ action(eval, Node, [Expr], _Opts, _Inform) ->
|
578 | 579 | action(help, _Node, _Args, _Opts, _Inform) ->
|
579 | 580 | io:format("~s", [rabbit_ctl_usage:usage()]);
|
580 | 581 |
|
581 |
| -action(node_health_check, Node, _Args, _Opts, Inform) -> |
582 |
| - Inform("Checking health of node ~p", [Node]), |
583 |
| - try |
584 |
| - rabbit_health_check:node(Node), |
585 |
| - io:format("Health check passed~n") |
586 |
| - catch |
587 |
| - {node_is_ko, ErrorMsg, ErrorCode} -> |
588 |
| - io:format("Heath check failed:~n~s~n", [ErrorMsg]), |
589 |
| - halt(ErrorCode) |
590 |
| - end; |
591 |
| - |
592 | 582 | action(Command, Node, Args, Opts, Inform) ->
|
593 | 583 | %% For backward compatibility, run commands accepting a timeout with
|
594 | 584 | %% the default timeout.
|
@@ -682,7 +672,17 @@ action(list_consumers, Node, _Args, Opts, Inform, Timeout) ->
|
682 | 672 | Inform("Listing consumers", []),
|
683 | 673 | VHostArg = list_to_binary(proplists:get_value(?VHOST_OPT, Opts)),
|
684 | 674 | call(Node, {rabbit_amqqueue, consumers_all, [VHostArg]},
|
685 |
| - rabbit_amqqueue:consumer_info_keys(), Timeout). |
| 675 | + rabbit_amqqueue:consumer_info_keys(), Timeout); |
| 676 | + |
| 677 | +action(node_health_check, Node, _Args, _Opts, Inform, Timeout) -> |
| 678 | + Inform("Checking health of node ~p", [Node]), |
| 679 | + case rabbit_health_check:node(Node, Timeout) of |
| 680 | + ok -> |
| 681 | + io:format("Health check passed~n"), |
| 682 | + ok; |
| 683 | + Other -> |
| 684 | + Other |
| 685 | + end. |
686 | 686 |
|
687 | 687 | format_parse_error({_Line, Mod, Err}) -> lists:flatten(Mod:format_error(Err)).
|
688 | 688 |
|
|
0 commit comments