diff options
| author | Joseph Yiasemides <joseph.yiasemides@erlang-solutions.com> | 2016-01-06 18:17:09 +0100 |
|---|---|---|
| committer | Michael Klishin <michael@clojurewerkz.org> | 2016-01-11 19:04:05 +0300 |
| commit | 93b9e37c3ea0cade4e30da0aa1f14fa97c82e669 (patch) | |
| tree | 78065b8e3b0c4e0c5c44858b3cb2a0ce8aa9cdc5 | |
| parent | 7e1022d11be94513360cc9be7c0065ca9590b996 (diff) | |
| download | rabbitmq-server-git-93b9e37c3ea0cade4e30da0aa1f14fa97c82e669.tar.gz | |
Include alarm information in output for cluster status
After this change `rabbitmqctl cluster_status` will print information
about alarms raised across a cluster.
| -rw-r--r-- | src/rabbit_control_main.erl | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/rabbit_control_main.erl b/src/rabbit_control_main.erl index 71234fb6a0..c6e39b17f5 100644 --- a/src/rabbit_control_main.erl +++ b/src/rabbit_control_main.erl @@ -365,7 +365,10 @@ action(status, Node, [], _Opts, Inform) -> action(cluster_status, Node, [], _Opts, Inform) -> Inform("Cluster status of node ~p", [Node]), - display_call_result(Node, {rabbit_mnesia, status, []}); + Status = unsafe_rpc(Node, rabbit_mnesia, status, []), + io:format("~p~n", [Status ++ [{alarms, + [alarms_by_node(Name) || Name <- nodes_in_cluster(Node)]}]]), + ok; action(environment, Node, _App, _Opts, Inform) -> Inform("Application environment of node ~p", [Node]), @@ -878,3 +881,11 @@ prettify_typed_amqp_value(_Type, Value) -> Value. split_list([]) -> []; split_list([_]) -> exit(even_list_needed); split_list([A, B | T]) -> [{A, B} | split_list(T)]. + +nodes_in_cluster(Node) -> + unsafe_rpc(Node, rabbit_mnesia, cluster_nodes, [running]). + +alarms_by_node(Name) -> + Status = unsafe_rpc(Name, rabbit, status, []), + {_, As} = lists:keyfind(alarms, 1, Status), + {Name, As}. |
