diff options
| author | Joseph Yiasemides <joseph.yiasemides@erlang-solutions.com> | 2016-01-06 18:17:09 +0100 |
|---|---|---|
| committer | Joseph Yiasemides <joseph.yiasemides@erlang-solutions.com> | 2016-01-11 13:55:04 +0000 |
| commit | f846b6847f04767a3c752997930fa65081b005e0 (patch) | |
| tree | c79bc8e178b21d350e32382bf95fe73d932692e1 | |
| parent | ece8197016fcb9f91362efef6897aab5bf7d4908 (diff) | |
| download | rabbitmq-server-git-f846b6847f04767a3c752997930fa65081b005e0.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}. |
