Last active
February 2, 2024 00:17
-
-
Save amoslanka/6225215 to your computer and use it in GitHub Desktop.
Install StatsD on an Ubuntu box, including creating an upstart service and the option to build a graphite box or configure Librato as a backend.
This file contains 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
# | |
# Assumes an independent box (we'll call this one "graphite") | |
# | |
# Stay up to date | |
sudo apt-get update | |
sudo apt-get upgrade | |
# Install git | |
sudo apt-get install g++ curl libssl-dev -y | |
# Install python stuff | |
sudo apt-get install python-pip python-dev build-essential python-django-tagging python-django -Y | |
sudo pip install --upgrade pip | |
sudo pip install --upgrade virtualenv | |
# Graphite is comprised of Whisper, Carbon, and the Webapp | |
mkdir graphite && cd graphite | |
pip install whisper | |
pip install carbon | |
pip install graphite-web | |
# TO BE COMPLETED... | |
# https://gist.github.com/jgeurts/3112065 | |
# https://gist.github.com/jasonroelofs/944849 | |
# http://graphite.readthedocs.org/en/0.9.10/install.html | |
# http://numbers.brighterplanet.com/2012/08/27/graphite-beyond-the-basics/ |
This file contains 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
# Install the librato backend plugin | |
cd ~/statsd | |
npm install statsd-librato-backend | |
# Edit the config file | |
vim config.js | |
# Set up Librato as a backend to the config object: | |
# { | |
# backends: ["statsd-librato-backend"] | |
# } | |
# Add Librato config to the config object: | |
# librato: { | |
# email: "[email protected]", | |
# token: "xxxxxxxxxxxxxxxx, | |
# source: "unique name for this node" | |
# } | |
# The config values could be substituded for environment variables, such as | |
# - process.env.LIBRATO_EMAIL, | |
# - process.env.LIBRATO_TOKEN, | |
# - process.env.LIBRATO_SOURCE | |
# And the corresponding environment variables could be added to the ~/.env file |
This file contains 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
# | |
# Assumes an independent box (we'll call this one "statsd") | |
# | |
# Stay up to date | |
sudo apt-get update | |
sudo apt-get upgrade | |
# Install git | |
sudo apt-get install g++ curl libssl-dev -y | |
sudo apt-get install git-core -y | |
# Install Nodejs | |
sudo apt-get install python-software-properties python make -y | |
sudo add-apt-repository ppa:chris-lea/node.js | |
sudo apt-get update | |
sudo apt-get install nodejs -y | |
# Clone the statsd project | |
git clone https://github.com/etsy/statsd.git | |
cd ./statsd | |
# Create a config file for statsd | |
cp ./statsd/exampleConfig.js ./statsd/config.js | |
$EDITOR ./statsd/config.js | |
# Install foreman so we can run our process though and Procfile and easily export to Upstart | |
sudo gem install foreman | |
# echo -e "\nexport PATH=/usr/local/bin:~/bin:$PATH\n" >> ~/.bashrc && source ~/.bashrc | |
# Shoreman would be another option, but doesn't have an export command | |
# mkdir ~/bin && curl https://github.com/hecticjeff/shoreman/raw/master/shoreman.sh -sLo ~/bin/shoreman && chmod 755 ~/bin/shoreman | |
# Create .env and Procfile | |
echo "statsd: node ./statsd/stats.js ./statsd/config.js" >> Procfile | |
touch .env | |
This file contains 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
# Export to upstart | |
sudo foreman export upstart /etc/init -a statsd -u $USER | |
# Start the process | |
sudo start statsd | |
# Stop the process when necessary | |
sudo stop statsd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment