Skip to content

Instantly share code, notes, and snippets.

@tierra
Last active June 15, 2018 10:46
Show Gist options
  • Save tierra/aa8bb18ce04b4d055593 to your computer and use it in GitHub Desktop.
Save tierra/aa8bb18ce04b4d055593 to your computer and use it in GitHub Desktop.
Install and run development Graphite / Statsd on OSX

Graphite

sudo pip install Django==1.8 graphite-web carbon
brew install cairo
sudo pip install -r https://raw.githubusercontent.com/graphite-project/graphite-web/master/requirements.txt
cd /opt/graphite
sudo chown -R [YOUR_USERNAME] storage
  • Edit webapp/graphite/settings.py: Set SECRET_KEY to a random string.
PYTHONPATH=/opt/graphite/webapp django-admin.py syncdb --settings=graphite.settings
sudo cp conf/carbon.conf.example conf/carbon.conf
sudo cp conf/storage-schemas.conf.example conf/storage-schemas.conf
sudo cp webapp/graphite/local_settings.py.example webapp/graphite/local_settings.py
  • Edit conf/carbon.conf: Set WHISPER_FALLOCATE_CREATE to False
bin/carbon-cache.py start
bin/run-graphite-devel-server.py /opt/graphite

Statsd

brew install node
git clone https://github.com/etsy/statsd.git
cd statsd
cp exampleConfig.js config.js
  • Edit config.js: Change graphiteHost to localhost.
  • Optionally add debug options shown below.

Your config.js should look similar to this:

{
  graphitePort: 2003
, graphiteHost: "localhost"
, port: 8125
, backends: [ "./backends/graphite" ]
, debug: true
, dumpMessages: true
}

Now you can run the statsd server:

node stats.js config.js
@amarjitdhillon
Copy link

amarjitdhillon commented Oct 26, 2017

I was following along this tutorial, but when setting python path by using PYTHONPATH=/opt/graphite/webapp django-admin.py syncdb --settings=graphite.settings gives me following error

Traceback (most recent call last):
  File "/usr/local/bin/django-admin.py", line 5, in <module>
    management.execute_from_command_line()
  File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 303, in execute
    settings.INSTALLED_APPS
  File "/Library/Python/2.7/site-packages/django/conf/__init__.py", line 48, in __getattr__
    self._setup(name)
  File "/Library/Python/2.7/site-packages/django/conf/__init__.py", line 44, in _setup
    self._wrapped = Settings(settings_module)
  File "/Library/Python/2.7/site-packages/django/conf/__init__.py", line 92, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/opt/graphite/webapp/graphite/settings.py", line 190, in <module>
    from graphite.local_settings import *  # noqa
  File "/opt/graphite/webapp/graphite/local_settings.py", line 215
    django.db.backends.sqlite3
    ^
IndentationError: unexpected indent

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