Skip to content

Instantly share code, notes, and snippets.

@ntulip
Created May 2, 2012 01:31
Show Gist options
  • Save ntulip/2572899 to your computer and use it in GitHub Desktop.
Save ntulip/2572899 to your computer and use it in GitHub Desktop.
Graphite Install Ubuntu 11.04 Natty
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
####################################
sudo apt-get update
wget http://launchpad.net/graphite/1.0/0.9.8/+download/graphite-web-0.9.8.tar.gz
wget http://launchpad.net/graphite/1.0/0.9.8/+download/carbon-0.9.8.tar.gz
wget http://launchpad.net/graphite/1.0/0.9.8/+download/whisper-0.9.8.tar.gz
tar -zxvf graphite-web-0.9.8.tar.gz
tar -zxvf carbon-0.9.8.tar.gz
tar -zxvf whisper-0.9.8.tar.gz
mv graphite-web-0.9.8 graphite
mv carbon-0.9.8 carbon
mv whisper-0.9.8 whisper
rm carbon-0.9.8.tar.gz
rm graphite-web-0.9.8.tar.gz
rm whisper-0.9.8.tar.gz
sudo apt-get install --assume-yes apache2 apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common libapr1 libaprutil1 libaprutil1-dbd-sqlite3 python3.1 libpython3.1 python3.1-minimal libapache2-mod-wsgi libaprutil1-ldap memcached python-cairo-dev python-django python-ldap python-memcache python-pysqlite2 sqlite3 erlang-os-mon erlang-snmp rabbitmq-server bzr expect ssh libapache2-mod-python
####################################
# INSTALL WHISPER
####################################
cd ~/whisper
sudo python setup.py install
####################################
# INSTALL CARBON
####################################
cd ~/carbon
sudo python setup.py install
# CONFIGURE CARBON
####################
cd /opt/graphite/conf
sudo cp carbon.conf.example carbon.conf
sudo cp storage-schemas.conf.example storage-schemas.conf
sudo nano storage-schemas.conf
### edited storage-schemas.conf to be the following
[stats]
priority = 110
pattern = .*
retentions = 10:2160,60:10080,600:262974
###
####################################
# CONFIGURE GRAPHITE (webapp)
####################################
cd ~/graphite
sudo python check-dependencies.py
sudo python setup.py install
# CONFIGURE APACHE
###################
cd ~/graphite/examples
sudo cp example-graphite-vhost.conf /etc/apache2/sites-available/default
sudo nano
# replace @DJANGO_ROOT@ line (line 35) with the following:
# Alias /media/ "/usr/lib/pymodules/python2.7/django/contrib/admin/media/"
sudo /etc/init.d/apache2 reload
sudo cp /opt/graphite/conf/graphite.wsgi.example /opt/graphite/conf/graphite.wsgi
####################################
# INITIAL DATABASE CREATION
####################################
cd /opt/graphite/webapp/graphite/
sudo python manage.py syncdb
# follow prompts to setup django admin user
sudo chown -R www-data:www-data /opt/graphite/storage/
sudo /etc/init.d/apache2 restart
cd /opt/graphite/webapp/graphite
sudo cp local_settings.py.example local_settings.py
sudo vim /opt/graphite/webapp/graphite/render/glyph.py
# at line 598 and add these lines before the "yVariance = ..." line
if yMaxValue <= yMinValue:
yMaxValue = yMinValue + 1
####################################
# START CARBON
####################################
cd /opt/graphite/
sudo ./bin/carbon-cache.py start
####################################
# Fix Permissions
####################################
sudo chgrp www-data /opt/graphite/storage/log/webapp
sudo 775 /opt/graphite/storage/log/webapp
sudo chgrp www-data /opt/graphite/storage
sudo chgrp www-data /opt/graphite/storage/graphite.db
sudo 775 /opt/graphite/storage
sudo 775 /opt/graphite/storage/graphite.db
####################################
# SEND DATA TO GRAPHITE
####################################
cd ~/graphite/examples
sudo chmod +x example-client.py
# [optional] edit example-client.py to report data faster
# sudo vim example-client.py
sudo ./example-client.py
####################################
# BASIC REQUIREMENTS
# http://geek.michaelgrace.org/2011/09/installing-statsd-on-ubuntu-server-10-04/
####################################
cd ~/
sudo apt-get install g++ curl libssl-dev git-core
# download the Node source, compile and install it
git clone https://github.com/joyent/node.git
cd node
./configure
make
sudo make install
# install the Node package manager for later use
curl http://npmjs.org/install.sh | sudo sh
npm -v
# clone the statsd project
cd ~/
git clone https://github.com/etsy/statsd.git
cd statsd
cp exampleConfig.js local.js
# start statsd
sudo node stats.js local.js 2>&1 >> ~/node.log &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment