Skip to content

Commit 93b9e37

Browse files
Joseph Yiasemidesmichaelklishin
Joseph Yiasemides
authored andcommitted
Include alarm information in output for cluster status
After this change `rabbitmqctl cluster_status` will print information about alarms raised across a cluster.
1 parent 7e1022d commit 93b9e37

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/rabbit_control_main.erl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,10 @@ action(status, Node, [], _Opts, Inform) ->
365365

366366
action(cluster_status, Node, [], _Opts, Inform) ->
367367
Inform("Cluster status of node ~p", [Node]),
368-
display_call_result(Node, {rabbit_mnesia, status, []});
368+
Status = unsafe_rpc(Node, rabbit_mnesia, status, []),
369+
io:format("~p~n", [Status ++ [{alarms,
370+
[alarms_by_node(Name) || Name <- nodes_in_cluster(Node)]}]]),
371+
ok;
369372

370373
action(environment, Node, _App, _Opts, Inform) ->
371374
Inform("Application environment of node ~p", [Node]),
@@ -878,3 +881,11 @@ prettify_typed_amqp_value(_Type, Value) -> Value.
878881
split_list([]) -> [];
879882
split_list([_]) -> exit(even_list_needed);
880883
split_list([A, B | T]) -> [{A, B} | split_list(T)].
884+
885+
nodes_in_cluster(Node) ->
886+
unsafe_rpc(Node, rabbit_mnesia, cluster_nodes, [running]).
887+
888+
alarms_by_node(Name) ->
889+
Status = unsafe_rpc(Name, rabbit, status, []),
890+
{_, As} = lists:keyfind(alarms, 1, Status),
891+
{Name, As}.

0 commit comments

Comments
 (0)