Skip to content

Instantly share code, notes, and snippets.

@muhqu
Created September 8, 2011 08:34
Show Gist options
  • Save muhqu/1202932 to your computer and use it in GitHub Desktop.
Save muhqu/1202932 to your computer and use it in GitHub Desktop.
#!/bin/bash
DB_URL=http://localhost:5984
DB_READS_300=$(curl -sg $DB_URL'/_stats/couchdb/database_reads?range=300' \
| python -m 'json.tool' \
| grep current \
| sed -e 's/[^0-9\.]//g' \
|| echo 0)
DB_READS_SEC=$(echo "scale=4; $DB_READS_300/300" | bc)
DB_WRITES_300=$(curl -sg $DB_URL'/_stats/couchdb/database_writes?range=300' \
| python -m 'json.tool' \
| grep current \
| sed -e 's/[^0-9\.]//g' \
|| echo 0)
DB_WRITES_SEC=$(echo "scale=4; $DB_WRITES_300/300" | bc)
echo "Couch Database Reads per sec, 5min avg : $DB_READS_SEC"
echo "Couch Database Writes per sec, 5min avg : $DB_WRITES_SEC"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment