我需要監視rabbitmq羣集狀態。RabbitMQ集羣狀態:如何從外殼中解析Erlang的梁?
REST API不提供有關partitions
的信息。所以,我需要使用的應用程序rabbitmqctl
:
# rabbitmqctl cluster_status
Cluster status of node '[email protected]' ...
[{nodes,[{disc,['[email protected]','[email protected]',
'[email protected]']}]},
{running_nodes,['[email protected]','[email protected]',
'[email protected]']},
{cluster_name,<<"[email protected]">>},
{partitions,[]},
{alarms,[{'[email protected]',[]},
{'[email protected]',[nodedown]},
{'[email protected]',[]}]}]
我需要檢查{partitions,[]},
。如果有空[]
它is ok。否則我有問題。
我發現使用二郎神例如,從慶典:
erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell
可以解析rabbitmqctl
標準輸出使用erl
(或其他工具),並返回信息「空/不爲空」或返回代碼?
我絕對不知道Erlang。
如果有人幫我,我會很高興:-)
您需要刪除輸入的第一行是因爲它不是Erlang項的一部分,在列表的末尾添加一個點'.',商店,到一個文件中,並那麼你可以用['file:consult/1']來閱讀它(http://erldocs.com/current/kernel/file.html?i=0&search=file:consult#consult/1)。其餘的是數據操作。 –