Skip to content

Instantly share code, notes, and snippets.

@aaronlerch
Created August 7, 2013 16:46
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save aaronlerch/6175825 to your computer and use it in GitHub Desktop.
Save aaronlerch/6175825 to your computer and use it in GitHub Desktop.
Upstart scripts for MongoDB Monitoring Service agent (MMS) MongoDB Backup Service agent (MBS?)

Download

Download and install the agent(s). These examples are on a standard 64-bit Amazon EC2 Linux AMI.

MMS

wget [path to mms agent download, specified by 10gen]
sudo tar xvzf 10gen-mms-agent-[CUSTOM_NAME].tar.gz -C /opt

Backup

wget [path to backup agent download, specified by 10gen]
sudo tar xvzf 10gen-backup-agent-[CUSTOM_NAME]-linux_amd64.tar.gz -C /opt

Setup

Create the upstart conf scripts as specified in the other files in this gist. They belong under /etc/init/mms-agent.conf and /etc/init/backup-agent.conf

Run

sudo start mms-agent sudo start backup-agent

Notes

  • This is all inspired/copied from https://gist.github.com/jaconel/1923994
  • The backup-agent app looks for local.config using the working directory and not the same directory the app is located in, so you have to cd into the directory first.
description "MongoDB Backup Service Agent"
pre-start script
mkdir -p /var/log/backup-agent/
end script
post-stop script
echo "$(date + '%Y-%m-%d %T,000') INFO backup-agent stopped" >> /var/log/backup-agent/agent.log
end script
start on runlevel [2345]
stop on runlevel [06]
script
cd /opt/backup-agent
exec nohup /usr/bin/env ./backup-agent >> /var/log/backup-agent/agent.log 2>&1
end script
description "MongoDB Monitoring Service (MMS) Agent"
pre-start script
mkdir -p /var/log/mms-agent/
end script
post-stop script
echo "$(date +'%Y-%m-%d %T,000') INFO mms-agent stopped" >> /var/log/mms-agent/agent.log
end script
start on runlevel [2345]
stop on runlevel [06]
exec nohup /usr/bin/env python /opt/mms-agent/agent.py >> /var/log/mms-agent/agent.log 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment