Just a small remark - you won’t see unhealthy hosts with that query, for example in "(not reachable/healthy) state. To fix it, just change this string to
members.
filter(x=> x.stateStr != "PRIMARY").
map(x=> {
return `${x.name} is ${(primary - x.optimeDate)/1000} Seconds behind the primary`
});