How to install Graphite on OS X Yosemite

Written by Abdullah Diaa

I’ve been playing around with Etsy/statsD recently trying to use to debug Node.js apps.

Here’s a detailed instructions how to install it on OS X Yosemite 10.10.4 :

#Requirements:

  • Python 2.6 or greater.
  • py2cairo.
  • Django 1.4 or greater.
  • django-tagging 0.3.1 or greater.
  • Twisted 8.0 or greater (10.0+ recommended).

#Installation:

  1. Let’s start by installing py2cairo/glib:

    brew install cairo
    brew install py2cairo
    
  2. Install django and django-tagging:

    sudo pip install Django==1.8.3
    sudo pip install django-tagging==0.4
    
  3. Install Carbon, Whisper and Ceres Graphite components: Carbon is one of the components of Graphite, and is responsible for receiving metrics over the network and writing them down to disk using a storage backend. Whisper is a file-based time-series database format for Graphite. Ceres provides a file format for incoming metrics to be persisted when received from the network.

    sudo pip install carbon
    sudo pip install whisper
    sudo pip install https://github.com/graphite-project/ceres/tarball/master
    
  4. Install Twisted: Twisted is an event-driven networking engine

    sudo pip install Twisted==15.2.1
    
  5. Finally install Graphite, Graphite defaults to an installation layout that puts the entire install in its own directory: /opt/graphite:

    sudo pip install graphite-web
    sudo chown -R $(whoami):staff /opt/graphite
    

#Configuration Graphite default configuration layout is /opt/graphite/webapp/graphite/local_settings.py.example:

cd /opt/graphite/webapp/graphite
cp local_settings.example local_settings

The database configuration is specified by the DATABASES dictionary in local_settings.py file, be default sqlite is used, let’s initialize the database:

cd /opt/graphite/webapp/graphite
PYTHONPATH=/opt/graphite/webapp django-admin.py syncdb --settings=graphite.settings django-admin.py syncdb --settings=graphite.settings

Finally let’s configure carbon and initialize it:

pushd /opt/graphite/conf
cp carbon.conf.example carbon.conf
cp storage-schemas.conf.example storage-schemas.conf
python /opt/graphite/bin/carbon-cache.py start
python /opt/graphite/bin/run-graphite-devel-server.py /opt/graphite

Et voilà, Graphite is ready: Graphite UI