Wednesday, 7 June 2017

Installing graphite and statsd on OS X Yosemite Raw

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

view raw statsd.md hosted with ❤ by GitHub

Kill all IRB and PRY process Raw

ps -ef | grep 'irb' | awk '{print $2}' | xargs kill -9
ps -ef | grep 'pry' | awk '{print $2}' | xargs kill -9
view raw gistfile1.sh hosted with ❤ by GitHub