Skip to content

Instantly share code, notes, and snippets.

@msluyter
Forked from diver-in-sky/graphite.md
Created September 17, 2012 22:38
Show Gist options
  • Save msluyter/3740218 to your computer and use it in GitHub Desktop.
Save msluyter/3740218 to your computer and use it in GitHub Desktop.
Installing Graphite on OS X Mountain Lion -- note, did not work for me!

Install Python 2.7.3 (if needed)

brew install python

Install cairo & py2cairo

brew install cairo
brew install py2cairo

Verify cairo

$ python
Python 2.7.3 (default, Jun 17 2012, 23:27:13) 
[GCC 4.2.1 Compatible Apple Clang 3.1 (tags/Apple/clang-318.0.58)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cairo
>>> 

Create default directory

sudo mkdir /opt/graphite
chown root:admin /opt/graphite
chmod g+w /opt/graphite 

Create virtualenv (virtualenv should be installed with brewed python)

cd /opt/graphite
virtualenv .ve

Install Graphite and Dependencies

/opt/graphite/.ve/bin/pip install carbon
  -- got an error here regarding Twisted. Doing easy_install twisted fixed this. 
/opt/graphite/.ve/bin/pip install whisper
/opt/graphite/.ve/bin/pip install django
  -- As above, I got an error with pip, but easy_install worked. 
/opt/graphite/.ve/bin/pip install django-tagging
/opt/graphite/.ve/bin/pip install graphite-web
  -- Note, run as sudo or it won't actually install the package under /opt/graphite/webapp

Create default database

cd /opt/graphite/webapp/graphite
 --   This failed for me. To fix it, I had to copy local_settings.py.example to local_settings.py and uncomment the DATABASES entry.
sudo python manage.py syncdb
sudo chown -R nobody:nobody /opt/graphite/storage/

Move example configs

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

Carbon scripts are installed in /usr/local/share/python. Need to symlink

mkdir /opt/graphite/bin
ln -s /usr/local/share/python/carbon-cache.py bin

Start carbon

python ./bin/carbon-cache.py start

Start Graphite

python /usr/local/share/python/run-graphite-devel-server.py /opt/graphite
-- Note: here I got an error from setuptools being unable to locate graphite-web. Reloading virtualenv fixed this.

Hope like hell it works

http://localhost:8080

If it works correclty you should see a black image with "No Data" in the Graphite Composer. If you see a broken image, it's probably something to do with py2cairo and cairo. -- Note, under mountain lion got 500 errors indicating that the cairo library couldn't be found. Even though an "import cairo" from a python prompt would work. Still investigating.

@manchmod
Copy link

manchmod commented Jan 7, 2013

i finally got this working when i rebuilt the virtual env with the system packages (i.e. virtualenv --system-site-packages .ve) ... this is needed to copy the pycairo packages you installed with brew into the virtual environment where you are running the graphite-web from.

also, for some reason it was complaining that django-admin wasn't in my path, so I added /opt/graphite/bin and /opt/graphite/.ve/bin to my path before starting the web service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment