Created
January 21, 2019 18:02
-
-
Save xymor/c759e5accc5ca2b73c6d5e68a4eae086 to your computer and use it in GitHub Desktop.
Monitor your OpLog using AWS Cloudwatch
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
#!/bin/bash | |
JSON=`mongo --quiet -u root -p pass --authenticationDatabase admin --eval "JSON.stringify(db.getReplicationInfo())" database.com.br:27017/local` | |
TIMEDIFF=`echo $JSON | jq '.timeDiffHours'` | |
echo $TIMEDIFF | |
aws cloudwatch put-metric-data --region sa-east-1 --metric-name MongoTimeDiffHours --namespace Midas --value "`echo $TIMEDIFF`" --timestamp `date -u "+%Y-%m-%dT%H:%M:%SZ"` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment