Skip to content

Instantly share code, notes, and snippets.

@goliatone
Last active January 16, 2020 16:46
Show Gist options
  • Save goliatone/6165059 to your computer and use it in GitHub Desktop.
Save goliatone/6165059 to your computer and use it in GitHub Desktop.
Setup Graphite in Mac OS X with Homebrew

Setup Graphite in Mac OS X with Homebrew

We assume that you have homebrew, python(2.7), and PIP already installed.

Python Dependencies

Runtime platform:

pip install --upgrade distribute
pip install --upgrade pip
pip install ipython
pip install virtualenv

Cairo

Graphic engine:

brew install cairo # depends on glib 
brew install py2cairo

Django

Web engine: pip install Django==1.4.5

Carbon, Whisper, and Ceres

RRD Database engines and daemon:

pip install carbon # depends on zope.interface, twisted, txamqp 
pip install whisper
pip install ceres

Make a temp dir, we are going to clone repos and execute our client/server from there.

mkdir ~/build
cd ~/build
mkdir graphite-project
cd graphite-project

Checkout components and install.

git clone https://github.com/graphite-project/carbon.git
cd carbon
python setup.py install # setup.cfg prefix is /opt/graphite, we copy to local
cp -r /opt/graphite/lib/carbon* /usr/local/lib/python2.7/site-packages/
cp -r /opt/graphite/lib/twisted/plugins/* /usr/local/lib/python2.7/site-packages/twisted/plugins

NOTE: Make twisted and plugins dirs

Make conf dir, copy, and rename default configuration files.

mkdir /usr/local/share/conf
cp /opt/graphite/conf/carbon.conf.example /usr/local/share/conf/carbon.conf
cp /opt/graphite/conf/storage-schemas.conf.example /usr/local/share/conf/storage-schemas.conf
cp /opt/graphite/conf/storage-aggregation.conf.example /usr/local/share/conf/storage-schemas.conf

Update path to storage dir

nano /usr/local/share/conf/carbon.conf # set STORAGE_DIR to /opt/graphite/storage

Install Graphite Web and Dependencies

Graphite-web, regular Django web application. [UPDATE] There is a PIP package for graphite-web, saw it after I installed graphite.

cd ~/build/graphite-project
git clone [email protected]:graphite-project/graphite-web.git
cd graphite-web
./check-dependencies.py

Install dependencies.

pip install pytz
pip install django-tagging
pip install pyparsing==1.5.5
python setup.py install

Setup Web App

Change Django settings to 1.4 compatible format

cd ~/build/graphite-project/graphite-web/webapp/graphite
nano settings.py

Search for DATABASES and update:

##Initialize database settings - Old style (pre 1.2)
#DATABASE_ENGINE = 'django.db.backends.sqlite3'  
#DATABASE_NAME = ''		# Or path to database file if using sqlite3.
#DATABASE_USER = ''		# Not used with sqlite3.
#DATABASE_PASSWORD = '' # Not used with sqlite3.
#DATABASE_HOST = ''		# Set to empty string for localhost. Not used with sqlite3.
#DATABASE_PORT = ''		# Set to empty string for default. Not used with sqlite3.
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(STORAGE_DIR, 'graphite.db'),
    },
}

Copy local settings file and initialize database

cp local_settings.py.example local_settings.py
# Follow the prompts, creating a superuser is optional
python manage.py syncdb  

Run Graphite

Carbon: ~/build/graphite-project/carbon/build/scripts-2.7/carbon-cache.py --debug start

Web Console: ~/build/graphite-project/graphite-web/build/scripts-2.7/run-graphite-devel-server.py /opt/graphite

@mxvsh
Copy link

mxvsh commented Jan 16, 2020

Thanks

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