I need to monitor rabbitmq cluster status.
REST API doesn't provide information about partitions
. So I need to use app rabbitmqctl
:
# rabbitmqctl cluster_status
Cluster status of node 'rabbit@rabbit-1' ...
[{nodes,[{disc,['rabbit@rabbit-1','rabbit@rabbit-2',
'rabbit@rabbit-3']}]},
{running_nodes,['rabbit@rabbit-3','rabbit@rabbit-2',
'rabbit@rabbit-1']},
{cluster_name,<<"rabbit@rabbit-1">>},
{partitions,[]},
{alarms,[{'rabbit@rabbit-3',[]},
{'rabbit@rabbit-2',[nodedown]},
{'rabbit@rabbit-1',[]}]}]
I need to check {partitions,[]},
. If there is empty []
it is ok. Otherwise I have problem.
I found example of use erlang from bash:
erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell
Is possible to parse rabbitmqctl
stdout using erl
(or other tool) and return info "empty / not empty" or return code?
I absolutely don't know Erlang.
If anyone help me, I will be happy :-)
you can use this API
http://your_ip:15672/api/nodes
where you can check if a node is up or down
name: "rabbit@t-srv-rabbit-cent04",
type: "disc",
running: false,
+cluster_links: (0)[...],
or partitions
},
-{
-partitions: (0)[
],
os_pid: "8070",
fd_total: 300000,
sockets_total: 269908,
mem_limit: 1590196633,
you don't need erlang shell