## Prerequisites
- Homebrew
- Python 2.7
- Git

## Graphite

### Install Cairo

There's an [issue with cairo](http://stackoverflow.com/questions/29311883/i-just-installed-graphite-on-my-mac-but-some-fonts-are-huge) 14.x that results in the axis fonts on the graphs being HUUUUUGE. Downgrading to 12.6 helps:

```bash
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
``` bash
pip install Django==1.8
pip install django-tagging
```

### Install Graphite
``` bash
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
``` bash
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
``` bash
python /opt/graphite/bin/carbon-cache.py start
```
(Ignore this error: `WHISPER_FALLOCATE_CREATE is enabled but linking failed.`)

``` bash
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](http://i.imgur.com/XF5lz.png)

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

``` bash
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

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

### Fire it up!

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



## Resources

* https://github.com/etsy/statsd
* http://graphite.wikidot.com/installation
* http://stackoverflow.com/questions/6886578/how-to-install-pycairo-1-10-on-mac-osx-with-default-python
* http://www.spacevatican.org/2012/9/18/using-statsd-and-graphite-from-a-rails-app/