Created
June 21, 2016 12:20
-
-
Save binarin/cc19252e5c7164b685803c81b4cf6544 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xargs -0 rabbitmqctl eval <<EOF | |
Prop = fun(K, L) -> proplists:get_value(K, L) end, | |
List = rabbit_amqqueue:list(<<"/">>), | |
QName = fun (Q) -> {resource, _VHost, queue, Name} = element(2, Q), Name end, | |
QPid = fun(Q) -> element(7, Q) end, | |
LocalList = lists:filter(fun (It) -> node(QPid(It)) =:= node() end , List), | |
Noop = make_ref(), | |
{ok, InterestingRe} = re:compile(<<"^(\\w*notifications\\.(error|info|warn)|[a-z]+)$">>), | |
IsNameInteresting = fun(Q) -> | |
case re:run(QName(Q), InterestingRe) of | |
{match, _} -> | |
true; | |
_ -> | |
false | |
end | |
end, | |
InterestingList = lists:filter(IsNameInteresting, LocalList), | |
Render = fun(It) -> | |
Info = rabbit_amqqueue:info(It), | |
Name = QName(It), | |
Messages = Prop(messages, Info), | |
Memory = Prop(memory, Info), | |
Consumers = Prop(consumers, Info), | |
Slaves = Prop(slave_pids, Info), | |
SyncSlaves = Prop(synchronized_slave_pids, Info), | |
{Name, Messages, Memory,Consumers, Slaves, SyncSlaves} | |
end, | |
rabbit_misc:filter_exit_map(Render, InterestingList). | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment