Skip to content

Instantly share code, notes, and snippets.

@albertohm
Last active February 4, 2019 23:59
Show Gist options
  • Save albertohm/5697429 to your computer and use it in GitHub Desktop.
Save albertohm/5697429 to your computer and use it in GitHub Desktop.
Install and configure graphite on ubuntu

Install python-pip

sudo apt-get install python-pip libcairo2 python-cairo

Install Graphite and Dependencies

pip install carbon
pip install whisper
pip install django
pip install django-tagging
pip install graphite-web

Configure the APP

Change the SECRET_KEY

Edit the /opt/graphite/webapp/graphite/app_settings.py file and set the SECRET_KEY variable.

Create default database

By default the error ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value is showed, so I need to add manually a new database.

Edit with the /opt/graphite/webapp/graphite/app_settings.py file and add at the bottom:

DATABASES = {
    'default': {
        'NAME': '/opt/graphite/storage/graphite.db',
        'ENGINE': 'django.db.backends.sqlite3',
        'USER': '',
        'PASSWORD': '',
        'HOST': '',
        'PORT': ''
    }
}

You can also use postgresql, mysql or ado_mssql instead of sqlite3.

Sync the db

Now you can sync the db and adjust permissions by running:

cd /opt/graphite/webapp/graphite
sudo python manage.py syncdb
sudo chown -R ubuntu:ubuntu /opt/graphite/storage/

Move example configs

cd /opt/graphite/conf
cp storage-schemas.conf.example storage-schemas.conf
cp carbon.conf.example carbon.conf

Allowed hosts

You may also need to set some allowed hosts. Just add ALLOWED_HOSTS = ['localhost'] to the /opt/graphite/webapp/graphite/app_settings.py file.

Start carbon

python ./bin/carbon-cache.py start

This doesn't work to me, It gives me an error ImportError: No module named twisted.python.util. So I need to install python-twisted-core from apt by typing: sudo apt-get install python-twisted-core.

Start Graphite

python /opt/graphite/bin/run-graphite-devel-server.py --port 8080 /opt/graphite/

Hope like hell it works

http://localhost:8080

If it works correctly you should see a black image with "No Data" in the Graphite Composer. If you see a broken image, it's probably something to do with py2cairo and cairo.

@evandor
Copy link

evandor commented Oct 3, 2014

In case this helps anyone: I made it work with

...:/opt/graphite/webapp# pip list
apt-xapian-index (0.41)
carbon (0.9.10)
ceres (0.10.0)
chardet (2.0.1)
distribute (0.6.14)
Django (1.5.10)
django-tagging (0.3.2)
GnuPGInterface (0.3.2)
graphite-web (0.9.12)
numpy (1.4.1)
PAM (0.4.2)
pip (1.5.6)
pyOpenSSL (0.10)
pyserial (2.3)
python-apt (0.7.100.1-squeeze1)
python-debian (0.1.18-squeeze1)
reportbug (4.12.6)
setuptools (6.0.2)
Twisted (11.1.0)
Twisted-Core (10.1.0)
unattended-upgrades (0.1)
whisper (0.9.12)
wsgiref (0.1.2)
zope.interface (4.1.1)

and python 2.6.6

@csbzy
Copy link

csbzy commented May 13, 2016

Django(1.8.6) work ok for me!

@muthuramanmuthiah
Copy link

USEFUL 1,,,THANKS

@aussiearef
Copy link

When I run these two lines I get a message saying that manage.py was not found!

cd /opt/graphite/webapp/graphite
sudo python manage.py syncdb

shouldn't manage.py be in Django's directory?

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