Graphite is actually a bit of a niche application. Specifically, it is designed to handle numeric time-series data. For example, Graphite would be good at graphing stock prices because they are numbers that change over time. However Graphite is a complex system, and if you only have a few hundred distinct things you want to graph (stocks prices in the S&P 500) then Graphite is probably overkill. But if you need to graph a lot of different things (like dozens of performance metrics from thousands of servers) and you don’t necessarily know the names of those things in advance (who wants to maintain such huge configuration?) then Graphite is for you.

How scalable is Graphite?

From a CPU perspective, Graphite scales horizontally on both the frontend and the backend, meaning you can simply add more machines to the mix to get more throughput. It is also fault tolerant in the sense that losing a backend machine will cause a minimal amount of data loss (whatever that machine had cached in memory) and will not disrupt the system if you have sufficient capacity remaining to handle the load.

From an I/O perspective, under load Graphite performs lots of tiny I/O operations on lots of different files very rapidly. This is because each distinct metric sent to Graphite is stored in its own database file, similar to how many tools (drraw, Cacti, Centreon, etc) built on top of RRD work. In fact, Graphite originally did use RRD for storage until fundamental limitations arose that required a new storage engine.

High volume (a few thousand distinct metrics updating minutely) pretty much requires a good RAID array. Graphite’s backend caches incoming data if the disks cannot keep up with the large number of small write operations that occur (each data point is only a few bytes, but most disks cannot do more than a few thousand I/O operations per second, even if they are tiny). When this occurs, Graphite’s database engine, whisper, allows carbon to write multiple data points at once, thus increasing overall throughput only at the cost of k INSTALLATION OF GRAPHITE SERVER.

Do not take this intallation documentation as a literal bible of how to install Graphite. Systems will vary and needs will vary and I can almost guarantee that you will have to make some tweaks, changes and adjustments relative to your system and your particular needs in order to get a working Graphite installation that makes you happy. I cannot guarantee that you will not completely crash your system while trying to install Qmail (though you’d have to try pretty darn hard). I have said it on other parts of this site and I will say it now: USE A TESTING SERVER THE FIRST TIME YOU INSTALL GRAPHITE!! ALWAYS DO A TEST INSTALL FIRST! You should never install graphite, or any other program for that matter, on a live production server until you have tested it thoroughly and you are confident in your ability to handle the install and any problems that may arise as a result of the install.

Before You Start! – When installing graphite, I would STRONGLY reccomend that you first conduct a test installation on a test server if you have one available. I would recommend you to install Ubuntu 12.04 full installation for installation of a Graphite server so that all the packages needed will be installed. If you’re new to graphite, chances are you will probably screw the install up the first time through. Do a favor to first install on a test server that has no importance to you, so that in case you come across any issues it can be resolved.

Basic Graphite requirements:

Python 2.4 or greater (2.6+ recommended)
Django 1.0 or greater
django-tagging 0.3.1 or greater
Twisted 8.0 or greater (10.0+ recommended)
zope-interface (often included in Twisted package dependency)
fontconfig and at least one font package (a system package usually)
A WSGI server and web server. Popular choices are: – Apache with mod_wsgi and mod_python – gunicorn with nginx – uWSGI with nginx

Deploying Graphite is a pain in the ass

Graphite is such a strange beast. It was developed at Orbitz (maybe to track how many airlines still give out free peanuts?) and is open-sourced under the Apache license. It is written in Python and is actually made up of 3 main parts:

Graphite-web: A Django project that provides a GUI for graphite. This is what you see when you visit a Graphite install in your browser. It also has an admin area that lets you set up users that are allowed to create and save graphs. You can deploy this like any other Django app via wsgi.
Carbon: Carbon is a daemon that runs constantly in the background. Its main job is to take in statistics from the network and write them to disk. It also does something both complicated and fascinating called “aggregation” which I will explore later.
Whisper: Whisper is a time-series database file format. It doesn’t actually run as a server or anything, it’s just a standard format for storing time-series data. These databases are a fixed size, and once the data gets old it falls off the other end. Whisper is a replacement for RRDTool, which I will talk about later. Whisper will also be replaced eventually by its successor,

Understanding what you are about to do

Though I really hope you know this by now, you are about to install a complete graphite server solution on whatever server you have chosen. You will be replacing whatever graphite server software is currently on your server with statsd and a lot of extra software to enhance graphite functionality.

What you need to know before beginning the installation

The installation and setup of a python based graphite server, whether through this site or any other site, is not easy. I would not recommend this installation to anyone who is a newcomer to the Linux/Unix world. If you are such a person, I would STRONLY recommend that you take step back and familiarize yourself with general Linux/UInix knowledge before diving into this installation. In other words, if you are a newbie you WILL have a hard time with this installation. That’s a fact.

What to expect from this installation guide

First and foremost, know this: The Source installation of Graphite DOES WORK. It’s been tested time and time again. But don’t get me wrong, the guide is not a work of perfection. I’m sure there are a few minor mistakes or typos here and there, but the install does work as a whole and any MAJOR problems you encounter are typically going to be due to something you’ve done wrong or something you’re system isn’t doing right. It is completely normal for most everyone to experience some problems during the install. That’s life. Get used to it. While I make all efforts to make this guide easy and error free, the ease of the installation process really depends on the skill of the individual person attempting the install. As I said, most everyone experiences a problem or 2 along the way. If you are a newbie, these problems can be very difficult to overcome without help. If you are a seasoned sysadmin, you should be able to use common sense to fix most problems as they come up. It is for this reason that experienced Linux/Unix people find this guide to be excellent while newbies have a more hit or miss experience. Some love it, some get frustrated. So goes the life of the newbie. But the frustration that newbies feel at time arises out of that person’s own inabilities and NOT out of some huge flaw in the guide. I’ve used this installtion guide myself countless times verbatim, and it DOES work. To ensure a positive experience, make sure your system is properly prepared and make sure you have the appropriate skill set.

What NOT to expect from this installation guide

While the GRAPHITE guide does work, you SHOULD NOT expect it to be a seamless and flawless experience. System environments and server setups vary, so portions of the installation guide may be more difficult for some users.

This guide is also NOT absolutely perfect. As I said, it DOES work for most people, but I am always finding areas for improvement, clarification and correction. If you ever find an area of the install process that you feel needs improvement, clarification or correction, by all means let me know.

And now, the most important piece of advice before you begin the installation:


A successful graphite installation requires certain packages be installed and certain configurations be present on your server. I’ve put together this page to provide a general checklist for visitors to use before they begin the installation. Keep in mind that, since setups will vary from server to server, you may find some requirements that are not listed here.

Here is what Graphite looks like:


How much disk space should I have available on my server?

The following is the partition schema maintained by us for the server.

/ partition: about 20GB.

/home partition: About 150GB

What software packages should I already have installed on my server?

1. The Apache Web Server – We are using apache2 or latest installed with source.
2. GCC – The gcc compiler. You should already have it installed, but if you don’t you’d better.

Download the Software

The first thing you’ll need to do to get started is to download all the needed software packages for the entire graphite installation process.

So let’s start the installation by getting the needed software. You will notice that below I create a new directory called /downloads and I place the all tarball in that directory before unpacking it. I would strongly recommend you do this as the rest of the instructions on this site are geared toward this source directory structure. Anyway, lets get down to business.

Download and install Pyhton

graphite@hari:~/download$ wget --no-check-certificate
graphite@hari:~/download$ tar -xvf Python-2.7.8.tar.xz
graphite@hari:~/download/Python-2.7.8$ cd Python-2.7.8
graphite@hari:~/download/Python-2.7.8$ sh configure --prefix=/home/graphite/python --enable-shared
graphite@hari:~/download/Python-2.7.8$ make
graphite@hari:~/download/Python-2.7.8$ make install
graphite@hari:~$ vi .bash_profile
export PATH=/home/graphite/python/bin:$PATH
export LD_LIBRARY_PATH=/home/graphite/python/lib/
graphite@hari:~$ . .bash_profile
graphite@hari:~$ python --version
Python 2.7.8

Install apache with mod_wscgi or mod_python

graphite@hari:~/download$ wget
graphite@hari:~/download$ tar -jxvf httpd-2.2.27.tar.bz2
graphite@hari:~# sudo apt-get build-essential
graphite@hari:~# sudo apt-get build-dep apache2
graphite@hari:~# sudo apt-get install openssl libssl-dev
graphite@hari:~/download$ cd httpd-2.2.27
graphite@hari:~/download/httpd-2.2.27$ vi ins
"./configure" \
"--prefix=/home/graphite/apache" \
"--enable-so" \
"--enable-cgi" \
"--enable-info" \
"--enable-rewrite" \
"--enable-speling" \
"--enable-usertrack" \
"--enable-deflate" \
"--enable-ssl" \
"--enable-mime-magic" \
"--with-included-apr" \
graphite@hari:~/download/httpd-2.2.27$ chmod +x ins
graphite@hari:~/download/httpd-2.2.27$ sh ins
graphite@hari:~/download/httpd-2.2.27$ make
graphite@hari:~/download/httpd-2.2.27$ make install

Install Mod_wsgi

graphite@hari:~/download$ tar -zxvf mod_wsgi-3.4.tar.gz
graphite@hari:~/download$ cd mod_wsgi-3.4
graphite@hari:~/download$ ./configure --with-apxs=/home/graphite/apache/bin/apxs
graphite@hari:~/download$ make
graphite@hari:~/download$ make install
graphite@hari:~/apache/conf$ vi httpd.conf
LoadModule wsgi_module /home/graphite/apache/modules/

Download graphite, carbon and whisper

graphite@hari:~/download$ wget
graphite@hari:~/download$ wget
graphite@hari:~/download$ wget
graphite@hari:~/download$ tar -zxvf graphite-web-0.9.10.tar.gz
graphite@hari:~/download$ tar -zxvf carbon-0.9.10.tar.gz
graphite@hari:~/download$ tar -zxvf whisper-0.9.10.tar.gz

Check dependencies and install one by one.

graphite@hari:~/download/graphite-web-0.9.10$ python
[FATAL] Unable to import the 'whisper' module, please download this package from the Graphite project page and install it.
[FATAL] Unable to import the 'cairo' module, do you have pycairo installed for python 2.7.8?
[FATAL] Unable to import the 'django' module, do you have Django installed for python 2.7.8?
[FATAL] Unable to import the 'tagging' module, do you have django-tagging installed for python 2.7.8?
[WARNING] Unable to import Interface from zope.interface.
Without it, you will be unable to run carbon on this server.
Unable to import the 'memcache' module, do you have python-memcached installed for python 2.7.8?
This feature is not required but greatly improves performance.
Unable to import the sqlite module, do you have python-sqlite2 installed for python 2.7.8?
If you plan on using another database backend that Django supports (such as mysql or postgres)
then don't worry about this. However if you do not want to setup the database yourself, you will
need to install sqlite2 and python-sqlite2.
Unable to import the 'ldap' module, do you have python-ldap installed for python 2.7.8?
Without python-ldap, you will not be able to use LDAP authentication in the graphite webapp.
Unable to import the 'twisted' package, do you have Twisted installed for python 2.7.8?
Without Twisted, you cannot run carbon on this server.
Unable to import the 'txamqp' module, this is required if you want to use AMQP.
Note that txamqp requires python 2.5 or greater.
4 necessary dependencies not met. Graphite will not function until these dependencies are fulfilled.
6 optional dependencies not met. Please consider the warning messages before proceeding.

Install Pcaiyro

graphite@hari:~/download$ wget
graphite@hari:~/download$ wget
graphite@hari:~/download$ wget
graphite@hari:~/download$ wget
graphite@hari:~/download$ wget
graphite@hari:~/download$ tar -xzf libffi-3.0.11.tar.gz
graphite@hari:~/download$ unxz glib-2.31.22.tar.xz
graphite@hari:~/download$ tar xf glib-2.31.22.tar
graphite@hari:~/download$ tar xzf pixman-0.26.2.tar.gz
graphite@hari:~/download$ unxz cairo-1.12.2.tar.xz
graphite@hari:~/download$ tar -xjvf py2cairo-1.10.0.tar.bz2
graphite@hari:~/download$ wget
graphite@hari:~/download$ tar -zxvf pkg-config-0.20.tar.gz
graphite@hari:~/download/pkg-config-0.20$ cd pkg-config-0.20
graphite@hari:~/download/pkg-config-0.20$ sh configure --prefix=/home/graphite/python/
graphite@hari:~/download/pkg-config-0.20$ make
graphite@hari:~/download/pkg-config-0.20$ make install
graphite@hari:~/download/glib-2.31.22$ export PKG_CONFIG_PATH=/home/graphite/python/lib/pkgconfig/
graphite@hari:~/download/glib-2.31.22$ export LD_LIBRARY_PATH=/home/graphite/python/lib/
graphite@hari:~/download/glib-2.31.22$ cd libffi-3.0.11
graphite@hari:~/download/glib-2.31.22$ ./configure --prefix=/home/graphite/python/
graphite@hari:~/download/glib-2.31.22$ make
graphite@hari:~/download/glib-2.31.22$ make install
graphite@hari:~/download/glib-2.31.22$ cd ../glib-2.31.22
graphite@hari:~/download/glib-2.31.22$ ./configure --prefix=/home/graphite/python/
graphite@hari:~/download/glib-2.31.22$ make
graphite@hari:~/download/glib-2.31.22$ make install
graphite@hari:~/download/glib-2.31.22$ cd ../pixman-0.26.2
graphite@hari:~/download/pixman-0.26.2$ ./configure --prefix=/home/graphite/python/
graphite@hari:~/download/pixman-0.26.2$ make
graphite@hari:~/download/pixman-0.26.2$ make install
graphite@hari:~/download/pixman-0.26.2$ cd ../cairo-1.12.2
graphite@hari:~/download/cairo-1.12.2$ export PKG_CONFIG_PATH=/home/graphite/python/lib/pkgconfig/
graphite@hari:~/download/cairo-1.12.2$ export LD_LIBRARY_PATH=/home/graphite/python/lib/
graphite@hari:~/download/libpng-1.2.40$ wget
graphite@hari:~/download/libpng-1.2.40$ tar -jxvf download
graphite@hari:~/download/libpng-1.2.40$ cd libpng-1.2.40/
graphite@hari:~/download/libpng-1.2.40$ sh configure --prefix=/home/graphite/python/
graphite@hari:~/download/libpng-1.2.40$ make
graphite@hari:~/download/libpng-1.2.40$ make install
graphite@hari:~/download/cairo-1.12.2$ cd cairo-1.12.2
graphite@hari:~/download/cairo-1.12.2$ ./configure --prefix=/home/graphite/python/
graphite@hari:~/download/cairo-1.12.2$ make
graphite@hari:~/download/cairo-1.12.2$ make install
graphite@hari:~/download/cairo-1.12.2$ cd ../py2cairo-1.10.0
graphite@hari:~/download/py2cairo-1.10.0$ ./waf configure --prefix=/home/graphite/python/
graphite@hari:~/download/py2cairo-1.10.0$ ./waf build
graphite@hari:~/download/py2cairo-1.10.0$ ./waf install

Install Django

graphite@hari:~$ wget
graphite@hari:~$ cd Django-1.4.15
graphite@hari:~/Django-1.4.15$ python install
Traceback (most recent call last):
File "", line 4, in
from setuptools import setup, find_packages
ImportError: No module named setuptools
graphite@hari:~/download$ wget --no-check-certificate
graphite@hari:~/download$ tar -zxvf setuptools-1.1.6.tar.gz
graphite@hari:~/download/setuptools-1.1.6$ cd setuptools-1.1.6
graphite@hari:~/download/setuptools-1.1.6$ python install
graphite@hari:~/download$ cd django-django-66580fe
graphite@hari:~/download/django-django-66580fe$ python install

Install Django-tagging

graphite@hari:~/download$ wget --no-check-certificate
graphite@hari:~/download$ tar -zxvf django-tagging-0.3.2.tar.gz
graphite@hari:~/download/django-tagging-0.3.2$ python install

Install python-memcached

graphite@hari:~/download$ wget --no-check-certificate
graphite@hari:~/download$ tar -zxvf python-memcached-1.53.tar.gz
graphite@hari:~/download/python-memcached-1.53$ python install

Install zope.interface

graphite@hari:~/download$ wget
graphite@hari:~/download$ unzip
graphite@hari:~/download$ cd master
graphite@hari:~/download$ cd zope.interface-master/
graphite@hari:~/download$ python install

Install Twisted

graphite@hari:~/download$ wget
graphite@hari:~/download$ tar -jxvf Twisted-8.2.0.tar.bz2
graphite@hari:~/download/Twisted-8.2.0$ python install

Install txamqp

graphite@hari:~/download$ wget
graphite@hari:~/download$ ta r -zxvf python-txamqp_0.3.orig.tar.gz
graphite@hari:~/download$ cd python-txamqp-0.3/
graphite@hari:~/download/python-txamqp-0.3$ python install

Install of sqlite2 and python- sqlite2

graphite@hari:~/download$ wget
graphite@hari:~/download$ tar -zxvf sqlite-2.8.16.tar.gz
graphite@hari:~/download$ cd sqlite-2.8.16
graphite@hari:~/download/sqlite-2.8.16$ sh configure --prefix=/home/graphite/python/
graphite@hari:~/download/sqlite-2.8.16$ make
graphite@hari:~/download/sqlite-2.8.16$ make install
graphite@hari:~/download$ wget --no-check-certificate
graphite@hari:~/download$ tar -zxvf pysqlite-2.6.3.tar.gz
graphite@hari:~/download$ cd pysqlite-2.6.3
graphite@hari:~/download/pysqlite-2.6.3$ python install

Now we are done with all the dependencies of graphite-web

graphite@hari:~/download/graphite-web-0.9.10$ python
Unable to import the 'ldap' module, do you have python-ldap installed for python 2.7.8?
Without python-ldap, you will not be able to use LDAP authentication in the graphite webapp.
All necessary dependencies are met.
1 optional dependencies not met. Please consider the warning messages before proceeding.

Install statsd and configure statsd

graphite@hari:~$ wget
graphite@hari:~$ unzip
graphite@hari:~$ cd statsd-master/
graphite@hari:~$ vi localConfig.js
graphitePort: 2003
, graphiteHost: "localhost"
, port: 8125
, graphite: {
legacyNamespace: false

Graphite and carbon installation

graphite@hari:~/download/graphite-web-0.9.10$ python install --prefix=/home/graphite/python --install-lib=/home/graphite/python/webapp
graphite@hari:~/download/carbon-0.9.10$ python install --prefix=/home/graphite/python --install-lib=/home/graphite/python/lib

Create a Storage Schema for Statsd

graphite@hari:~$ cd graphite/
graphite@hari:~/graphite$ cd conf/
graphite@hari:~/graphite/conf$ cp storage-schemas.conf.example storage-schemas.conf
graphite@hari:~/graphite$ vi storage-schemas.conf
pattern = ^stats.*
retentions = 10s:1d,1m:7d,10m:1y

Create a Data Aggregation Configuration

graphite@hari:~/graphite/conf$ cp storage-aggregation.conf.example storage-aggregation.conf
graphite@hari:~/graphite/conf$ vi storage-aggregation.conf
pattern = \.min$
xFilesFactor = 0.1
aggregationMethod = min
pattern = \.max$
xFilesFactor = 0.1
aggregationMethod = max
pattern = \.count$
xFilesFactor = 0
aggregationMethod = sum
pattern = \.lower(_\d+)?$
xFilesFactor = 0.1
aggregationMethod = min
pattern = \.upper(_\d+)?$
xFilesFactor = 0.1
aggregationMethod = max
pattern = \.sum$
xFilesFactor = 0
aggregationMethod = sum
pattern = ^.*\.gauges\..*
xFilesFactor = 0
aggregationMethod = last
pattern = .*
xFilesFactor = 0.5
aggregationMethod = average

Some /home/graphite/python/conf files changes

graphite@hari:~/python/conf$ cp relay-rules.conf.example relay-rules.conf
graphite@hari:~/python/conf$ cp dashboard.conf.example dashboard.conf
graphite@hari:~/python/conf$ cp graphTemplates.conf.example graphTemplates.conf
graphite@hari:~/python/conf$ cp carbon.conf.example carbon.conf
graphite@hari:~/python/conf$ cp carbon.amqp.conf.example carbon.amqp.conf


PYTZ installation

graphite@hari:~/download$ wget --no-check-certificate
graphite@hari:~/download$ tar -jxvf pytz-2014.7.tar.bz2
graphite@hari:~/download$ cd pytz-2014.7

Pyparsing installation

graphite@hari:~/download$ wget --no-check-certificate
graphite@hari:~/download$ tar -zxvf pyparsing-1.5.7.tar.gz
graphite@hari:~/download$ cd pyparsing-1.5.7
graphite@hari:~/download$ python install

Configuration of to build database

graphite@hari:~/python/webapp/graphite$ vi
TIME_ZONE = 'America/Los_Angeles'
DEBUG = True
GRAPHITE_ROOT = '/home/graphite/python'
CONF_DIR = '/home/graphite/python/conf'
STORAGE_DIR = '/home/graphite/python/storage'
CONTENT_DIR = '/graphite/graphite/python/webapp/content'
DASHBOARD_CONF = '/home/graphite/python/conf/dashboard.conf'
GRAPHTEMPLATES_CONF = '/home/graphite/python/conf/graphTemplates.conf'
WHISPER_DIR = '/home/graphite/python/storage/whisper'
RRD_DIR = '/home/graphite/python/storage/rrd'
DATA_DIRS = [WHISPER_DIR, RRD_DIR] # Default: set from the above variables
LOG_DIR = '/home/graphite/python/storage/log/webapp'
INDEX_FILE = '/home/graphite/python/storage/index'
'default': {
'NAME': '/home/graphite/python/storage/graphite.db',
'ENGINE': 'django.db.backends.sqlite3',
'USER': 'graphite',
'PASSWORD': 'root123',
'HOST': '',
'PORT': ''
SECRET_KEY = 'abcd'
graphite@hari:~/python/webapp/graphite$ python syncdb

Use the username and password to login created with python syncdb



Leave a Reply

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

You are commenting using your 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