Skip to content

Instantly share code, notes, and snippets.

@trusche
Last active May 2, 2019 13:05
Show Gist options
  • Save trusche/bfab931c538bd1a63c80 to your computer and use it in GitHub Desktop.
Save trusche/bfab931c538bd1a63c80 to your computer and use it in GitHub Desktop.
Installing graphite and statsd on OS X Yosemite

Prerequisites

  • Homebrew
  • Python 2.7
  • Git

Graphite

Install Cairo

There's an issue with cairo 14.x that results in the axis fonts on the graphs being HUUUUUGE. Downgrading to 12.6 helps:

cd /usr/local/Library/
git checkout 7073788 /usr/local/Library/Formula/cairo.rb
brew install cairo
brew install py2cairo
sudo pip install cairocffi

Install Django

pip install Django==1.8
pip install django-tagging

Install Graphite

sudo pip install carbon
pip install whisper
sudo pip install graphite-web
sudo pip install Twisted==15.2

sudo chown -R <your username>:staff /opt/graphite

Configure graphite

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

cd webapp/graphite

# Modify this file to change database backend (default is sqlite).
cp local_settings.py{.example,}

# Initialize database
python manage.py syncdb

Start carbon & graphite

python /opt/graphite/bin/carbon-cache.py start

(Ignore this error: WHISPER_FALLOCATE_CREATE is enabled but linking failed.)

python /opt/graphite/bin/run-graphite-devel-server.py /opt/graphite

Hope that it works!

Go to:

http://localhost:8080

You should see this if it works properly:

bacon

If you get a broken image, it most likely means that something is wrong py2cairo and cairo.

Check the debug output here:

http://localhost:8080/render

Optional convenience aliases

Add this to your .bashrc or .bash_profile or .aliasrc:

alias carbon='python /opt/graphite/bin/carbon-cache.py'
alias graphite-web='python /opt/graphite/bin/run-graphite-devel-server.py /opt/graphite'

Statsd

Install Node

brew install nodejs

Clone the repo

sudo git clone https://github.com/etsy/statsd.git /opt/statsd
sudo chown -R trusche:staff /opt/statsd

Configure statsd

cp /opt/statsd/exampleConfig.js /opt/statsd/config.js

Fire it up!

node /opt/statsd/stats.js /opt/statsd/config.js

node statsd /

Resources

@piotr1212
Copy link

For the record:

$ python manage.py syncdb

changed into:
django-admin.py migrate --settings=graphite.settings --run-syncdb

See https://graphite.readthedocs.io/en/latest/config-database-setup.html for more information.

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