Old Release

This documentation covers an old version of Fedora. Looking for another version? See all documentation.

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

When you want to track the metrics from your Fedora 4 repository, this guide can help you install and configure a Graphite instance.

You will need the following software pre-installed:

  1. Apache HTTPD
  2. mod_wsgi
  3. Cairo
  4. Python (2.6, 2.7)
  5. Django (1.6)
  6. Various Python modules
    1. pycairo
    2. django-tagging
    3. json or simplejson

You can find the original Graphite installation instructions here, for the sake of completeness much will be repeated below.

Download Whisper, Carbon and Graphite-web

Clone the GitHub repositories  (use either the 0.9.x [stable] branch or master  [unstable/alpha] branch).

Note: The source files found at https://launchpad.net/graphite/+download/ are very out of date and do not support Django versions greater than 1.4.

My starting directory looks like.

> ll /Users/fedora_user/graphite_downloads
total 0
drwxr-xr-x  19 fedora_user  staff  646  5 Sep 12:31 carbon
drwxr-xr-x  23 fedora_user  staff  782  4 Sep 15:37 graphite-web
drwxr-xr-x  10 fedora_user  staff  340  5 Sep 08:58 whisper

Install whisper

cd whisper
sudo python setup.py install
cd ..

Install Carbon

cd carbon
sudo python setup.py install
cd ..

This installs to /opt/graphite by default.

Install Graphite-web

cd graphite-web
sudo python check-dependencies.py

Check for any fatal errors and resolve them, (ie. missing modules, libraries). There are 3 warnings that can be ignored (they are related to optional features). Once you are ready.

sudo python setup.py install
cd ..

Configure Graphite

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

This setups up a default data retention period of gathering data every second and storing it for 1 day. You can configure this by editing the storage-schemas.conf file.

Configure Apache

There is an Apache Virtual Hosts file provided in the graphite-web/examples directory. You can use this to configure your Apache installation.

Things to pay attention to in this file:

  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>
        

Setup Database

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

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

Then edit local_setttings.py.

  • Set the SECRET_KEY
  • Set Logging section to:
# Logging
LOG_RENDERING_PERFORMANCE = True
LOG_CACHE_PERFORMANCE = True
LOG_METRIC_ACCESS = True
  • 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

cd /opt/graphite/webapp/graphite
sudo python manage.py syncdb
  • If you are using the default sqlite3 database, create an administrator username/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.
  • 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 the entire storage directory (default /opt/graphite/storage) and all files are owned by the webserver process.

Start Data Collector

cd /opt/graphite/bin/
sudo python carbon-cache.py start
Password:
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 the message

'WHISPER_FALLOCATE_CREATE is enabled but linking failed.'

This can be disabled by setting

WHISPER_FALLOCATE_CREATE = False

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

Stronger security

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

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:

> ll /opt/graphite/storage
total 104
drwxr-xr-x 6 www-data www-data  4096 Sep  8 21:50 ./
drwxr-xr-x 8 ubuntu   root      4096 Sep  8 21:42 ../
-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 and the web application access to read them.

Restart Apache

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

Connecting Fedora

To enable Metrics reporting to Graphite, activate the Spring profile metrics.graphite. The system properties fcrepo.metrics.host (defaults to localhost) and fcrepo.metrics.port (defaults to 2003) can also be set.

When testing with Maven use

MAVEN_OPTS="-Xmx512m -Dspring.profiles.active=metrics.graphite" mvn jetty:run

or add it to the web.xml

<context-param>
  <param-name>spring.profiles.active</param-name>
  <param-value>metrics.graphite</param-value>
</context-param>

Connecting Fedora to a remote Graphite server

To enable metrics collection on a remote server use the above configuration for Graphite (by default Graphite is very open).

For Fedora you can add the hostname/IP address and port (if different from the default).

When using Maven:

MAVEN_OPTS="-Xmx512m -Dspring.profiles.active=metrics.graphite -Dfcrepo.metrics.host=remote-host -Dfcrepo.metrics.port=2003" mvn jetty:run

 

: fcrepo.metrics.host does not seem to work as a <context-param> - Jared Whiklo

 

  • No labels