RabbitMQ running nodes JSON format

64 views
Skip to first unread message

Arnaud Morin

unread,
Aug 13, 2025, 5:21:05 AMAug 13
to rabbitm...@googlegroups.com
Hello team,

I upgraded one of my cluster to 4.1.3, and the json formatter for
cluster_status seems broken:

$ rabbitmqctl cluster_status --formatter json | jq '.running_nodes'
"rabbit@rabbit2rabbit@rabbit3rabbit@rabbit1"

(it's giving a string)

While on a previous cluster:
$ rabbitmqctl cluster_status --formatter json | jq '.running_nodes'
[
"rabbit@rabbit1",
"rabbit@rabbit2",
"rabbit@rabbit3"
]

(it's giving an array)

Is that expected?

From other formatters, it seems that all of them are giving some sort
of array but not the json one anymore.

I can report a bug if necessary, let me know.

Cheers,
Arnaud

Arnaud Morin

unread,
Aug 13, 2025, 6:49:44 AMAug 13
to rabbitm...@googlegroups.com
I was able to dichotomate this using docker:

docker run -d --rm --name rab rabbitmq:4.1.2
is affected

docker run -d --rm --name rab rabbitmq:4.1.1
is NOT affected

Regards

Arnaud Morin

unread,
Aug 13, 2025, 8:19:06 AMAug 13
to rabbitm...@googlegroups.com
I reverted this line: [1]
And then the json formatter is working again

[1] https://github.com/rabbitmq/rabbitmq-server/pull/14118/files#diff-b94d58eca3f5178113f18699a0bc7bca6daa4dd3872d95c2960c007d73cbbe58R21

I suspect one of the convert_erlang_strings is not working as expected?

Michael Klishin

unread,
Aug 13, 2025, 11:43:40 AMAug 13
to rabbitmq-users
--formatter=json was never meant to be used with with commands that produce complex data structures.

There's an HTTP API endpoint that does what you want [1], `GET /api/nodes`.

1. https://www.rabbitmq.com/docs/http-api-reference#get-apinodes

Michael Klishin

unread,
Aug 13, 2025, 11:46:57 AMAug 13
to rabbitmq-users
In Erlang, telling a string from a list is a pain. The PR does try to do that using `unicode:characters_to_binary/2`.

You are welcome to contribute a change, just make sure that `rabbitmqctl environment --formatter=json` still produces a reasonable output.

Luke Bakken

unread,
Aug 13, 2025, 2:36:39 PMAug 13
to rabbitmq-users
I'll look into this.

Luke Bakken

unread,
Aug 13, 2025, 2:58:37 PMAug 13
to rabbitmq-users
It turns out PR 14118 uncovered a small bug elsewhere, in how running nodes are formatted. I'll open a new PR.

Arnaud - great catch, you are probably the only person on Earth who noticed this 😺

Reply all
Reply to author
Forward
0 new messages