Note
This guide is for Graphite 0.9.10 and Debian 7.
Graphite web interface requires a database this example use SQLite3.
Install:
$ apt-get install libcairo2-dev python-virtualenv memcached
$ useradd -d /usr/local/src/graphite -M -s /bin/false graphite
Then create the virtualenv:
$ virtualenv /usr/local/src/graphite
$ chown -R graphite.graphite /usr/local/src/graphite
$ OLD_HOME=$HOME
$ export HOME=/usr/local/src/graphite
And upgrade itself:
$ sudo -u graphite /usr/local/src/graphite/bin/pip install -U pip distribute
Some dependencies are not listed in setup.py
, they're in requirements.txt
. Just to be sure it's installed properly run:
$ sudo -u graphite /usr/local/src/graphite/bin/pip install "Django<1.5" "Twisted==11.1.0" txamqp python-memcached pytz simplejson django-tagging gunicorn psycopg2
$ sudo -u graphite /usr/local/src/graphite/bin/pip install http://cairographics.org/releases/py2cairo-1.8.10.tar.gz
Note
This only work with Python 2.7, if you have Python 2.6, change the --install-lib
accordingly.
Install:
$ sudo -u graphite /usr/local/src/graphite/bin/pip install whisper
$ sudo -u graphite /usr/local/src/graphite/bin/pip install carbon --install-option="--prefix=/usr/local/src/graphite" --install-option="--install-lib=/usr/local/src/graphite/lib/python2.7/site-packages"
$ sudo -u graphite /usr/local/src/graphite/bin/pip install graphite-web --install-option="--prefix=/usr/local/src/graphite" --install-option="--install-lib=/usr/local/src/graphite/lib/python2.7/site-packages"
$ export HOME=$OLD_HOME
Go to /usr/local/src/graphite/conf
and copy all files from .conf.example
extension to .conf
.
For a basic deployment with only a single carbon server, you need the following files:
For carbon.conf
just be sure to have the following set:
CACHE_QUERY_INTERFACE = 127.0.0.1 CACHE_QUERY_PORT = 7002
To start the carbon process:
$ sudo -u graphite /usr/local/src/graphite/bin/carbon-cache.py start
This component is a Django applicaiton, the config can't be in the conf
subfolder, it's a Python module in Django settings format.
Copy config template:
$ cp /usr/local/src/graphite/lib/python2.7/site-packages/graphite/local_settings.py.example /usr/local/src/graphite/lib/python2.7/site-packages/graphite/local_settings.py
$ cp /usr/local/src/graphite/conf/graphTemplates.conf.example /usr/local/src/graphite/conf/graphTemplates.conf
Edit it accordingly to your needs, here is settings you must absolutely set:
from graphite.settings import *
LOG_RENDERING_PERFORMANCE = True
LOG_CACHE_PERFORMANCE = True
LOG_METRIC_ACCESS = True
CONF_DIR = '/usr/local/src/graphite/conf'
STORAGE_DIR = '/usr/local/src/graphite/storage'
CONTENT_DIR = '/usr/local/src/graphite/webapp/content'
LOG_DIR = '/usr/local/src/graphite/webapp/log'
INDEX_FILE = STORAGE_DIR + '/index'
DATA_DIRS = [STORAGE_DIR + '/whisper']
GRAPHTEMPLATES_CONF = CONF_DIR + '/graphTemplates.conf'
DOCUMENTATION_URL = "http://graphite.readthedocs.org/"
CLUSTER_SERVERS = []
MEMCACHE_HOSTS = ['127.0.0.1:11211']
CARBONLINK_HOSTS = ["127.0.0.1:7002:a"]
# Timeout to fetch series data
REMOTE_STORE_FETCH_TIMEOUT = 6
# Timeout for metric find requests
REMOTE_STORE_FIND_TIMEOUT = 2.5
# Time before retrying a failed remote webapp
REMOTE_STORE_RETRY_DELAY = 60
CARBONLINK_TIMEOUT = 1.0
# Cache images and data for 1 minute
DEFAULT_CACHE_DURATION = 60
# Time to cache remote metric find results
REMOTE_FIND_CACHE_DURATION = 300
REMOTE_RENDERING = False
LEGEND_MAX_ITEMS = 10
DATABASES = {
'default': {
'NAME': 'graphite',
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'USER': 'graphite',
'PASSWORD': 'xxx', # <-- here put you database password
'HOST': '',
'PORT': ''
}
}
# you can found this at the bottom of the file
from graphite.app_settings import *
INSTALLED_APPS += ('gunicorn',)
Create webapp log directory:
$ mkdir /usr/local/src/graphite/webapp/log
$ chown graphite.graphite /usr/local/src/graphite/webapp/log
Create database schema and initial data:
$ DJANGO_SETTINGS_MODULE=graphite.local_settings sudo -u graphite -E /usr/local/src/graphite/bin/django-admin.py syncdb
Creating tables ...
[snip]
You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (Leave blank to use 'graphite'):
E-mail address: me@myself.com
Password:
Password (again):
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
No fixtures found.
Now it's time to start the web interface:
$ DJANGO_SETTINGS_MODULE=graphite.local_settings sudo -u graphite -E /usr/local/src/graphite/bin/django-admin.py run_gunicorn -n graphite-web -b 0.0.0.0:8000