Skip to content

Instantly share code, notes, and snippets.

@lonefreak
Created November 7, 2012 19:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lonefreak/4033665 to your computer and use it in GitHub Desktop.
Save lonefreak/4033665 to your computer and use it in GitHub Desktop.
Install Graphite 0.9.10 on CentOS 6.2
#! /bin/sh
# GRAPHITE 0.9.10
# FOR CENTOS 6
# Andrew Diller Jan 2012
# Modified by Fabricio Leotti Nov 2012
# THIS SCRIPT DEPENDS ON PYTHON 2.6 (NO MORE, NO LESS)
# Get EPEL Repo installed
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm
# Comment all "mirrorlist=" lines in /etc/yum.repos.d/epel.repo
sed -i s/^mirrorlist=/#mirrorlist=/g /etc/yum.repos.d/epel.repo
# Uncomment all "baseurl=" lines in /etc/yum.repos.d/epel.repo
sed -i s/^#baseurl=/baseurl=/g /etc/yum.repos.d/epel.repo
# Installing dependencies
yum install -y pycairo mod_python Django python-ldap python-memcached python-sqlite2 bitmap bitmap-fonts python-devel python-crypto pyOpenSSL gcc python-zope-filesystem python-zope-interface git gcc-c++ zlib-static
# Installing setuptools (pip dependency)
cd /tmp
curl -O http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg
sh setuptools-0.6c11-py2.6.egg
# Installing pip
cd /tmp
curl -O http://pypi.python.org/packages/source/p/pip/pip-1.0.tar.gz
tar xvfz pip-1.0.tar.gz
cd pip-1.0
python setup.py install
# Install more dependencies
sudo easy_install django-tagging
sudo easy_install twisted
sudo easy_install txamqp
# Install Whisper
pip install whisper
# Install Carbon
pip install carbon
# Install Graphite in default location (/opt/graphite/)
pip install graphite-web
# Configuring
chown -R apache:apache /opt/graphite/storage/
cp /opt/graphite/webapp/graphite/local_settings.py.example /opt/graphite/webapp/graphite/local_settings.py
python /opt/graphite/webapp/graphite/manage.py syncdb
# You just installed Django's auth system, which means you don't have any superusers defined.
# Would you like to create one now? (yes/no): yes
# Username (Leave blank to use 'root'):
# E-mail address: fabricio.leotti@abril.com.br
# Password: 123123
# Password (again): 123123
# Superuser created successfully.
# Installing custom SQL ...
# Installing indexes ...
# No fixtures found.
cp /opt/graphite/conf/carbon.conf.example /opt/graphite/conf/carbon.conf
cp /opt/graphite/conf/storage-schemas.conf.example /opt/graphite/conf/storage-schemas.conf
cat > /opt/graphite/conf/storage-schemas.conf <<EOF
# Carbon's internal metrics. This entry should match what is specified in
# CARBON_METRIC_PREFIX and CARBON_METRIC_INTERVAL settings
[logster.aapg.login.aapg]
pattern = ^logster\.aapg\.login\.aapg$
retentions = 60s:30d
#DEFAULT METRICS
[carbon]
pattern = ^carbon\.
retentions = 60:90d
[default_1min_for_1day]
pattern = .*
retentions = 60s:1d
EOF
touch /etc/httpd/conf.d/graphite.conf
cat > /etc/httpd/conf.d/graphite.conf <<EOF
# 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 <HOST PARA ACESSO AOS RELATORIOS>
DocumentRoot "/opt/graphite/webapp"
ErrorLog /opt/graphite/storage/log/webapp/error.log
CustomLog /opt/graphite/storage/log/webapp/access.log common
<Location "/">
SetHandler python-program
PythonPath "['/opt/graphite/webapp'] + ['/usr/local/lib/python2.6/dist-packages/'] + sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE graphite.settings
PythonDebug Off
PythonAutoReload Off
</Location>
<Location "/content/">
SetHandler None
</Location>
<Location "/media/">
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.4/site-packages/django/contrib/admin/media/"
</VirtualHost>
EOF
chown apache:apache /etc/httpd/conf.d/graphite.conf
chmod -R 777 /opt/graphite/
# Starting carbon
/opt/graphite/bin/carbon-cache.py start
# Restarting Apache
/etc/init.d/httpd restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment