Skip to content

Instantly share code, notes, and snippets.

@mrjones-plip
Last active February 10, 2026 21:49
Show Gist options
  • Select an option

  • Save mrjones-plip/88c52ec608f757d8d0a5d697ac2d9ef7 to your computer and use it in GitHub Desktop.

Select an option

Save mrjones-plip/88c52ec608f757d8d0a5d697ac2d9ef7 to your computer and use it in GitHub Desktop.
query CHT instances for version, users, active users
# update this var to be your list of instances to query
declare -a arr=("demo-cht.dev.medicmobile.org" "fail-cht.dev.medicmobile.org"
)
echo
echo "URL,Version,Total Users,Active Users,Medic DB"
for i in "${arr[@]}"
do
json=$(curl -qs https://${i}/api/v2/monitoring?connected_user_interval=30 | jq -r '.version.app + "," + (.connected_users.count|tostring) + "," + (.couchdb.users.doc_count|tostring) + "," + (.couchdb.medic.doc_count|tostring)')
if [[ ${#json} -ge 1 ]]; then
echo "${i},,,${json}"
else
echo "${i},FAIL,FAIL,FAIL,FAIL,FAIL"
fi
done
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment