#!/bin/bash mongostat=`which mongostat` # Change connection settings to match your mongodb user='' password='' port='27017' ad='admin' if [ $? -eq 0 ] then echo '<<>>' "${mongostat}" -u "$user" -p "$password" --port "$port" --authenticationDatabase "$ad" --humanReadable false --noheaders -n 1 1 --json fi