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.

@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