Skip to content

Instantly share code, notes, and snippets.

@xlson
Created November 14, 2011 08:39
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 xlson/1363542 to your computer and use it in GitHub Desktop.
Save xlson/1363542 to your computer and use it in GitHub Desktop.
Installing graphite on debian/ubuntu
Setup deps graphite
aptitude install python2.6
aptitude install python-cairo
aptitude install python-django
aptitude install python-django-tagging
aptitude install python2.6-twisted-core
aptitude install apache2
aptitude install libapache2-mod-wsgi
aptitude install memcached python-memcache
Installing graphite
wget http://launchpad.net/graphite/0.9/0.9.9/+download/whisper-0.9.9.tar.gz
wget http://launchpad.net/graphite/0.9/0.9.9/+download/carbon-0.9.9.tar.gz
wget http://launchpad.net/graphite/0.9/0.9.9/+download/graphite-web-0.9.9.tar.gz
cd whisper-0.9.9 && python2.6 setup.py install && cd ..
cd carbon-0.9.9 && python2.6 setup.py install && cd ..
cd graphite-web-0.9.9
./checkDependencies.py
if check deps is ok:
python2.6 setup.py install
Setup sqlite db
cd /opt/graphite/webapp/graphite
python2.6 manage.py syncdb
useradd graphite
chown www-data:www-data /opt/graphite/storage/log/webapp/
chown www-data:www-data /opt/graphite/storage/
chown www-data:www-data /opt/graphite/storage/graphite.db
chown graphite:graphite /opt/graphite/storage/whisper/
mkdir /opt/graphite/storage/carbon-cache
chown graphite:graphite /opt/graphite/storage/carbon-cache
Configure graphite
cd /opt/graphite/conf
cp carbon.conf.example carbon.conf
edit carbon.conf; replace user with graphite
cp storage-schemas.conf.example storage-schemas.conf
edit schema
retentions = 10s:1d, 1m:14d, 1h:365d
Setup apache
cd /opt/graphite/conf
cp graphite.wsgi.example graphite.wsgi
cd /opt/graphite/webapp/graphite
cp local_settings.py.example local_settings.py
edit file:
MEMCACHE_HOSTS = ['127.0.0.1:11211']
vi /etc/apache2/sites-available/graphite
<--- SNIPPET --->
# This needs to be in your server's config somewhere, probably
# the main httpd.conf
# NameVirtualHost *:80
# You may need to manually edit this file to fit your needs.
# This configuration assumes the default installation prefix
# of /opt/graphite/, if you installed graphite somewhere else
# you will need to change all the occurances of /opt/graphite/
# in this file to your chosen install location.
<VirtualHost *:80>
#ServerName 127.0.0.1
DocumentRoot "/opt/graphite/webapp"
ErrorLog /opt/graphite/storage/log/webapp/error.log
CustomLog /opt/graphite/storage/log/webapp/access.log common
# I've found that an equal number of processes & threads tends
# to show the best performance for Graphite (ymmv).
WSGIDaemonProcess graphite processes=5 threads=5 display-name='%{GROUP}' inactivity-timeout=120
WSGIProcessGroup graphite
# You will need to create this file! There is a graphite.wsgi.example
# file in this directory that you can safely use, just copy it to graphite.wgsi
WSGIScriptAlias / /opt/graphite/conf/graphite.wsgi
Alias /content/ /opt/graphite/webapp/content/
<Location "/content/">
SetHandler None
</Location>
# NOTE: In order for the django admin site media to work you
# must change @DJANGO_ROOT@ to be the path to your django
# installation, which is probably something like:
# /usr/lib/python2.6/site-packages/django
#Alias /media/ /usr/lib/python2.7/site-packages/Django-1.3-py2.7.egg/django/contrib/admin/media/
<Location "/media/">
SetHandler None
</Location>
# The graphite.wsgi file has to be accessible by apache. It won't
# be visible to clients because of the DocumentRoot though.
<Directory /opt/graphite/conf/>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
<--- SNIPPET --->
a2dissite default
a2ensite graphite
/etc/init.d/apache reload
Setup carbon daemonen
touch /etc/init.d/carbon
chmod u+x /etc/init.d/carbon
<--- snippet --->
#!/bin/bash
#
# chkconfig: 35 90 12
# description: carbon-cache script
#
cd /opt/graphite
start() {
./bin/carbon-cache.py start
echo "carbon-cache started"
}
stop() {
./bin/carbon-cache.py stop
echo "carbon-cache stopped"
}
### main logic ###
case "$1" in
start)
start
;;
stop)
stop
;;
status)
./bin/carbon-cache.py status
;;
restart|reload|condrestart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac
exit 0
<--- snippet --->
update-rc.d carbon defaults
/etc/init.d/carbon start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment