Building the web-based dashboard for monitoring and analysis with Graphite (1)


Part I – Setting Up

After several times to try to install Graphite (version 0.9.12) on CentOS 6.3 but failed for some various reasons (e.x, file permission issue, using Django version incompatibility with Graphite,…). Finally, I resolved this trivial step. Giving many thanks to the oldest friend in my team :). So, this is a small shell scripting to get work done automatically. If you find something wrong in it, please let’s me know. Thanks :)

#####
# REF. http://graphite.readthedocs.org/en/latest
#####

#!/bin/bash

# 1. PIP
cd /opt
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
python ez_setup.py
wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
python get-pip.py

# 2. Dependencies
yum install -y python-devel httpd mod_wsgi mod_python pycairo python-sqlite2 python-zope-interface python-twisted python-simplejson python-memcached python-ldap fontconfig bitmap bitmap-fonts gcc-c++ gcc make curl curl-devel zlib zlib-devel openssl openssl-devel
pip install Django==1.5.4
pip install django-tagging

# 3. Graphite
pip install whisper
pip install carbon
pip install graphite-web

# 4. Configure
cd /opt/graphite
cp conf/carbon.conf.example conf/carbon.conf
cp conf/storage-schemas.conf.example conf/storage-schemas.conf
cp conf/graphite.wsgi.example conf/graphite.wsgi
cp webapp/graphite/local_settings.py.example webapp/graphite/local_settings.py
cp examples/example-graphite-vhost.conf /etc/httpd/conf.d/graphite-vhost.conf

sed -i ‘s/run\/wsgi/\/var\/run\/wsgi/g’ /etc/httpd/conf.d/graphite-vhost.conf
sed -i ‘s/@DJANGO_ROOT@\/contrib\/admin\/media\//\/usr\/lib\/python2.6\/site-packages\/django\/contrib\/admin\/media\//g’ /etc/httpd/conf.d/graphite-vhost.conf
echo ”
ServerName localhost:80
NameVirtualHost *:80″ >> /etc/httpd/conf/httpd.conf

mkdir -p /usr/lib/python2.6/site-packages/django/contrib/admin/media/
python /opt/graphite/webapp/graphite/manage.py syncdb
chown -R apache.apache /opt/graphite

# 5. Start
/opt/graphite/bin/carbon-cache.py start
chown -R apache.apache /opt/graphite
chkconfig httpd on
/etc/init.d/httpd start

I will try to share more my throughts on this topic in the future posts. If you are interested in Graphite, maybe you already read this article, and not, I recommend it to you. :)
http://www.aosabook.org/en/graphite.html

-mt.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s