Install Graphite on OSX 10.7 Lion

Installing Graphite locally on my machine was a bit annoying. Hope this helps the next person.

1. Virtualenv

Because we are clean and tidy people, let’s start by first creating a new virtualenv

mkvirtualenv graphite

2. Pip

This installs graphite into the default location at /opt/graphite

pip install whisper
pip install carbon
pip install graphite-web

3. Install py2cairo

Follow the instructions here

    1. Download, unpack, and cd into the the py2cairo directory
    2. Activate your virtual environment
    3. Follow the standard build procedure
./waf configure --prefix=$VIRTUAL_ENV
./waf build
./waf install

4. Configure conf files

cp /opt/graphite/carbon.conf.example /opt/graphite/carbon.conf
cp /opt/graphite/storage-schemas.conf.example /opt/graphite/storage-schemas.conf

5. Configure graphite

cp /opt/graphite/webapp/graphite/ /opt/graphite/webapp/graphite/

Then edit

STORAGE_DIR = os.environ.get('GRAPHITE_STORAGE_DIR', join(GRAPHITE_ROOT, 'storage'))

    'default': {
        'NAME': os.path.join(STORAGE_DIR, 'graphite.db'),
        'ENGINE': 'django.db.backends.sqlite3',
        'USER': '',
        'PASSWORD': '',
        'HOST': '',
        'PORT': ''

# Default sqlite db file
# This is set here so that a user-set STORAGE_DIR is available
#if 'sqlite3' in DATABASE_ENGINE \
    #and not DATABASE_NAME:
  #DATABASE_NAME = join(STORAGE_DIR, 'graphite.db')

SECRET_KEY = '<insert your secrey key>'


This makes the settings file compatible with Django 1.5. You can get a secret key generator here.

6. Syncdb

cd /opt/graphite/webapp/graphite
sudo python syncdb

You should see a file called graphite.db in /opt/graphite/storage

7. Run

sudo python /opt/graphite/bin/ start
sudo python /opt/graphite/bin/ /opt/graphite

This is the expected output

graphite hello world

Here’s a test script to see if your graphite is working locally. Got it off

Then under tree, graphite, you should see foo/bar/.

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 )

Google photo

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

Connecting to %s