Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lasse-unity3d/5525172 to your computer and use it in GitHub Desktop.
Save lasse-unity3d/5525172 to your computer and use it in GitHub Desktop.
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Tested/updated for Debian Wheezy on 2013-09-20
####################################
sudo apt-get update
sudo apt-get upgrade
wget http://launchpad.net/graphite/0.9/0.9.10/+download/graphite-web-0.9.10.tar.gz
wget http://launchpad.net/graphite/0.9/0.9.10/+download/carbon-0.9.10.tar.gz
wget http://launchpad.net/graphite/0.9/0.9.10/+download/whisper-0.9.10.tar.gz
tar -zxvf graphite-web-0.9.10.tar.gz
tar -zxvf carbon-0.9.10.tar.gz
tar -zxvf whisper-0.9.10.tar.gz
ln -s graphite-web-0.9.10 graphite
ln -s carbon-0.9.10 carbon
ln -s whisper-0.9.10 whisper
rm carbon-0.9.10.tar.gz
rm graphite-web-0.9.10.tar.gz
rm whisper-0.9.10.tar.gz
sudo apt-get install --assume-yes apache2 apache2-mpm-worker libaprutil1-dbd-sqlite3 python3.2-dev python-twisted-core libpython3.2 libapache2-mod-wsgi libaprutil1-ldap memcached python-cairo-dev python-django python-ldap python-memcache python-pysqlite2 sqlite3 rabbitmq-server libapache2-mod-python python-setuptools
sudo easy_install django-tagging
####################################
# 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
echo '
### edited storage-schemas.conf to be the following
[stats]
priority = 110
pattern = .*
retentions = 10:2160,60:10080,600:262974
###
' | sudo tee -a storage-schemas.conf
####################################
# 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 cp /opt/graphite/conf/graphite.wsgi.example /opt/graphite/conf/graphite.wsgi
sudo vim /etc/apache2/sites-available/default
# Change:
# WSGISocketPrefix run/wsgi
# to:
# WSGISocketPrefix /var/run/apache2/wsgi
# This doesn't seem to be needed:
# moved 'WSGIImportScript /opt/gr..' to right before virtual host since it gave me an error saying
# WSGIImportScript cannot occur within <VirtualHost> section
# This doesn't seem to be needed:
# if this path does not exist make it!!!!!!
# /etc/httpd/wsgi
#sudo mkdir /etc/httpd
#sudo mkdir /etc/httpd/wsgi
# It doesn't work yet - carry on...
#sudo /etc/init.d/apache2 reload
# Let graphite write some log files:
sudo chgrp www-data /opt/graphite/storage/log/webapp
sudo chmod g+w www-data /opt/graphite/storage/log/webapp
####################################
# INITIAL DATABASE CREATION
####################################
cd /opt/graphite/webapp/graphite/
sudo cp local_settings.py.example local_settings.py
sudo vi local_settings.py
# Uncomment DATABASES = { ... }
# http://stackoverflow.com/questions/14596322/django-typeerror-decode-argument-1-must-be-string-not-none
export LANG="en_US.UTF-8"
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
####################################
# START CARBON
####################################
cd /opt/graphite/
sudo ./bin/carbon-cache.py start
####################################
# 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
##############################################
# Tell graphite to look in collectd's RRDs
##############################################
cd /opt/graphite/storage/rrd
sudo ln -s /var/lib/collectd/rrd collectd
sudo apt-get install collectd python-rrdtool
sudo service apache2 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment