Last active
February 10, 2026 21:49
-
-
Save mrjones-plip/88c52ec608f757d8d0a5d697ac2d9ef7 to your computer and use it in GitHub Desktop.
query CHT instances for version, users, active users
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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