How to determine if a rebalance is recommended using REST

That old, familiar phrase: “Rebalance recommended, some data does not have the desired number of replicas!”

How can I determine that a rebalance is needed through REST? If a rebalance is stopped, /pools/default/tasks will show me:

[
  {
    "status": "notRunning",
    "type": "rebalance"
  }
]

and rebalanceProgress gives a status of “none”:

$ curl -s -u $U:$P http://localhost:8091/pools/default/rebalanceProgress | jq .
{
  "status": "none"
}

when I look at the bucket map with /pools/default/buckets the vBucketServerMap.vBucketMap shows 1024 vBuckets that aren’t evenly dispersed:

$ curl -s -u $U:$P http://localhost:8091/pools/default/buckets | jq .[0].vBucketServerMap.vBucketMap[][] | sort | uniq -c
    977 0
     95 1
    976 2

Is walking through the vBucketMap and counting the nodes my best hope, or is there a simpler way?

Perhaps not the answer you were hoping for, but there IS a feature request for exactly that: MB-19534.

@JFlath: that is a more than adequate answer. Thanks for filling me in. I’ll follow the bug.