Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
cd /opt/graphite
sudo chown -R ubuntu:ubuntu *
cd /opt/graphite/conf
sudo cp carbon.conf.example carbon.conf
sudo cp storage-schemas.conf.example storage-schemas.conf
sudo cp graphite.wsgi.example graphite.wsgi

...

  1. WSGISocketPrefix run/wsgi

    this needs to be set to a directory that the webserver can write to and can be either a relative or an absolute path.

  2. Both the <Location "/content/"> and <Location "/media/"> do not specify access. You may need to add them.

    ie.

    <Location "/content/">
      SetHandler None
    </Location>

    to

    <Location "/content/">
      SetHandler None
      Order deny,allow
      Allow from all
    </Location>
        

Anchor
setup-database
setup-database
Setup Database

By default Graphite uses a sqlite3 database, but you can configure it to use a MySQL, Postgresql or Oracle database instead.

Code Block
cd /opt/graphite/webapp/graphite
cp local_settings.py.example local_settings.py

Then edit local_setttings.py., to uncomment:

  • Set the SECRET_KEY
  • Set Logging section to:
No Format
SECRET_KEY = 'UNSAFE_DEFAULT <or your own value>'
...
# Logging
LOG_RENDERING_PERFORMANCE = True
LOG_CACHE_PERFORMANCE = True
LOG_METRIC_ACCESS = True
  • Optional: If you are NOT using a sqlite3 database, find the DATABASES variable, un-comment it and change the ENGINE parameter and add required parameters (username, password, hostname, port).Save the file.

Create the database

Code Block
cd /opt/graphite/webapp/graphite
sudo python manage.py syncdb
  • If you are using the default sqlite3 database, create an administrator username/password <username> and <password> when prompted and then re-open local_settings.py, un-comment the DATABASES variable and add the administrator username/password to the DATABASES variable.
No Format
DATABASES = {
    'default': {
        'NAME': '/opt/graphite/storage/graphite.db',
        'ENGINE': 'django.db.backends.sqlite3',
        'USER': '<username>',
        'PASSWORD': '<password>',
        'HOST': '',
        'PORT': ''
    }
}
  • Note: If you receive an error "ImportError: cannot import name execute_manager", you have an old version of graphite-web that requires Django 1.4. Get the latest changes from the GitHub repositories.

If you Make sure that Set the permissions of the entire storage directory (default /opt/graphite/storage) and all files are to be owned by the webserver process.

Code Block
cd /opt/graphite/storage
sudo chown -R www-data:www-data *

Anchor
start-data-collector
start-data-collector
Start Data Collector

Code Block
cd /opt/graphite/bin/
sudo python carbon-cache.py start

...

> Starting carbon-cache (instance a)

This starts the listener on localhost:2003, this can be configured in /opt/graphite/conf/carbon.conf.

Note: On my MacBook Pro, I received If you receive the message:

'WHISPER_FALLOCATE_CREATE is enabled but linking failed.'

...

in /opt/graphite/conf/carbon.conf but this will not harm the running process and does not need to be disabled.

Anchor
stronger-security
stronger-security
Stronger security

Note: If you are not running the carbon-cache.py daemon as root, then you will need to make the /opt/graphite/storage/whisper directory writable by whichever user you will run carbon-cache.py as.

Code Block
sudo chown -R ubuntu /opt/graphite/storage/whisper

For example: If you are running Apache as www-data and the carbon-cache.py as ubuntu then your /opt/graphite/storage directory will look like:

No Format
> ll /opt/graphite/storage

...


-rw-r--r-- 1 www-data www-data     5 Sep  8 21:46 carbon-cache-a.pid
-rw-r--r-- 1 www-data www-data 69632 Sep  8 21:50 graphite.db
-rw-r--r-- 1 www-data www-data   762 Sep  8 21:50 index
drwxr-xr-x 2 www-data www-data  4096 Sep  8 21:40 lists/
drwxr-xr-x 4 www-data www-data  4096 Sep  8 21:46 log/
drwxr-xr-x 2 www-data www-data  4096 Sep  8 21:40 rrd/
drwxr-xr-x 5 ubuntu   www-data  4096 Sep 10 18:19 whisper/

This will allow carbon-cache.py to add new metrics to the whisper tables and still allow the web application to read them.

Anchor
restart-apache
restart-apache
Restart Apache

Code Block
sudo service apache2 restart

If all is well then browsing to your webserver's homepage should look something like this.

...