There are lots of tutorials and scripts that show how to install it, most of them use apache to deploy the web interface. The graphite web app is written in Django and as such it's really easy to deploy using nginx.
Enough talking, let's get to work:
Install the required packages:
# Install the required packages for graphite aptitude install -y python2.6 python-pip python-cairo python-django \ python-django-tagging python-twisted python-memcache python-pysqlite2 \ python-simplejson # Install nginx and the required cgi modules aptitude install -y nginx uwsgi-plugin-python uwsgi # install graphite via PIP pip install whisper carbon graphite-webCreate the configuration files:
cd /opt/graphite/conf/ # Create a directory with all configurations # It will allow us to keep this dir clean and use the original # files as templates mkdir examples; mv *.example examples # create a copy of the required files cp examples/storage-schemas.conf.example storage-schemas.conf cp examples/storage-aggregation.conf.example storage-aggregation.conf cp examples/carbon.conf.example carbon.conf cp examples/graphite.wsgi.example wsgi.pyCreate webapp configuration file
cp /opt/graphite/webapp/graphite/{local_settings.py.example,local_settings.py}
Uncomment the parameter "TIME_ZONE" on "/opt/graphite/webapp/graphite/local_settings.py" and replace with the result of "cat /etc/timezone". In my case the resulting edit looks like:
TIME_ZONE = 'America/Caracas'Otherwise the webapp will assume the default time zone for Django apps: 'America/Chicago'.
Create nginx configuration file:
#/etc/nginx/sites-available/graphite
server {
listen 8080;
charset utf-8;
access_log /var/log/nginx/graphite.access.log;
error_log /var/log/nginx/graphite.error.log;
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:3031;
}
}
Enable the virtualhost:ln -s /etc/nginx/sites-available/graphite /etc/nginx/sites-enabled/Create the uwsgi configuration file:
#/etc/uwsgi/apps-available/graphite.ini [uwsgi] processes = 2 socket = 127.0.0.1:3031 gid = www-data uid = www-data chdir = /opt/graphite/conf module = wsgi:applicationFinal uwsgi application configurations:
# enable the uwsgi app ln -s /etc/uwsgi/apps-available/graphite.ini /etc/uwsgi/apps-enabled/ # create the local database for the webapp python /opt/graphite/webapp/graphite/manage.py syncdb # Allow access to www-data to the webapp and storage directories chown -R www-data:www-data /opt/graphite/webapp/ /opt/graphite/storage/Start carbon, the uwsgi and nginx daemons:
/opt/graphite/bin/carbon-cache.py start /etc/init.d/uwsgi restart /etc/init.d/nginx restartCheck http://yourIPAddress:8080 and you should see the graphite web interface.
If you have any issues, remember to check the following log files for possible errors:
/var/log/nginx/graphite.error.log /var/log/uwsgi/app/graphite.logAs a last resource you can set the Django app into debug mode by setting "Debug = True" on "/opt/graphite/webapp/graphite/local_settings.py".It should provide enough information to give you a hint on what may be causing the problem.
