Skip to content

Commit

Permalink
fixup! add cluster_status
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorerlingsson committed Sep 19, 2024
1 parent 5cb855a commit 7406735
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lavinmqctl.cr
Original file line number Diff line number Diff line change
Expand Up @@ -614,14 +614,18 @@ class LavinMQCtl
resp = http.get "/api/nodes"
handle_response(resp, 200)
body = JSON.parse(resp.body)
puts "Node #{body[0].dig("name")} is running LavinMQ v#{body[0].dig("applications")[0].dig("version")} "
puts "Cluster status of node #{body[0].dig("name")}"
puts "This node is running LavinMQ v#{body[0].dig("applications")[0].dig("version")}"
if followers = body[0].dig("followers").as_a
puts ""
puts "Followers:"
puts "ID \t| Address \t\t| Lag"
followers.each do |f|
lag = f.dig("sent_bytes").as_i64 - f.dig("acked_bytes").as_i64
puts "#{f.dig("id")} \t| #{f.dig("remote_address")} \t| #{lag}"
end
else
puts "This node has no followers"
end
end

Expand Down

0 comments on commit 7406735

Please sign in to comment.