Skip to content

Instantly share code, notes, and snippets.

@fancyremarker
Last active April 2, 2016 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fancyremarker/331c526618065f719a6acbeec7055a8d to your computer and use it in GitHub Desktop.
Save fancyremarker/331c526618065f719a6acbeec7055a8d to your computer and use it in GitHub Desktop.
Template repo for deploying MongoDB Cloud Monitoring (MMS) agent on Aptible
FROM quay.io/aptible/ubuntu:14.04
WORKDIR /tmp
RUN apt-install curl
RUN curl -OL https://cloud.mongodb.com/download/agent/monitoring/mongodb-mms-monitoring-agent_4.1.0.251-1_amd64.deb && \
dpkg -i mongodb-mms-monitoring-agent_4.1.0.251-1_amd64.deb && \
rm -rf mongodb-mms-monitoring-agent_4.1.0.251-1_amd64.deb
ADD start-monitoring-agent /usr/local/bin/
WORKDIR /
monitoring: /usr/local/bin/start-monitoring-agent
#!/bin/bash
# chmod 0755
CONF_FILE=/etc/mongodb-mms/monitoring-agent.config
sed -i s/mmsApiKey=/mmsApiKey=$MMS_API_KEY/ $CONF_FILE
echo sslRequireValidServerCertificates=false >> $CONF_FILE
if [ -n "$MMS_GROUP_ID" ]; then
echo mmsGroupId=$MMS_GROUP_ID >> $CONF_FILE
fi
mongodb-mms-monitoring-agent -conf $CONF_FILE
@fancyremarker
Copy link
Author

To use, follow these steps:

  1. Create a new app in Aptible. It must reside in the same environment as the database(s) you wish to monitor. We refer to this app's handle as $APP_HANDLE below.

  2. Configure your MMS API key for the app:

    aptible config:set MMS_API_KEY=$KEY --app $APP_HANDLE
    
  3. Clone this Gist and push it back to Aptible:

    git clone https://gist.github.com/331c526618065f719a6acbeec7055a8d.git
    cd 331c526618065f719a6acbeec7055a8d/
    git remote add aptible git@beta.aptible.com:$APP_HANDLE.git
    git push aptible master
    
  4. From the Cloud Manager Web UI, confirm that the new agent appears under "Deployment" –> "Agents." Then, Click "+ Add" –> "Existing MongoDB Deployment," and enter the credentials for your Aptible MongoDB database. Set the following SSL-related values:

    • Use SSL: Yes
    • Client Certificate Mode: Optional
    • CA File Path: /etc/ssl/certs/ca-certificates.crt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment