Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt
Fedora 4 comes with built-in profiling machinery that keeps track of how many times specific services have been requested, how long each request takes to be serviced, etc.

 

There are presently two ways of visualizing the output of this "metrics" collection.

This guide is designed to When you want to track the metrics from your Fedora 4 repository, this guide can help you install and configure a Graphite instance. The directions below are based on the instructions provided by Graphite.

 

Table of Contents

Prerequisites

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.

...

On a Debian system, the following commands should install the above.

Code Block
sudo apt-get update
sudo apt-get install git -y
sudo apt-get install apache2-mpm-prefork -y
sudo apt-get install libapache2-mod-wsgi -y
sudo apt-get install python-cairo -y
sudo apt-get install python2.7 -y
sudo apt-get install python-django -y
sudo apt-get install python-django-tagging -y
sudo apt-get install python-simplejson -y

Graphite modules

Anchor
download-install
download-install
Setup 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.

/Users/fedora_user/graphite_downloads] 
> ll
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

On an Linux-based system, the following commands should get the correct branches of the three Graphite modules.

Code Block
cd
git clone https://github.com/graphite-project/whisper.git
git clone https://github.com/graphite-project/carbon.git
git clone https://github.com/graphite-project/graphite-web.git
pushd carbon/
git checkout 0.9.x
popd;pushd graphite-web
git checkout 0.9.x
popd;pushd whisper
git checkout 0.9.x
popd

Your starting directory may look something like the following.

No Format
ls -l /home/ubuntu
drwxrwxr-x  9 ubuntu ubuntu 4096 Sep 18 20:59 carbon/
drwxrwxr-x 11 ubuntu ubuntu 4096 Sep 18 20:59 graphite-web/
drwxrwxr-x  4 ubuntu ubuntu 4096 Sep 18 20:59 whisper/

Anchor
install-whisper
install-whisper
Install whisper

Code Block

...

cd whisper
sudo python setup.py install
cd ..

Anchor
install-carbon
install-carbon
Install Carbon

Code Block
cd carbon
sudo python setup.py install
cd ..

This installs to /opt/graphite by default.

...

Anchor
install-graphite-web

...

install-graphite-web

...

Install Graphite-web

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.

Code Block
cd graphite-web
sudo python check-dependencies.py

Install

Code Block
sudo python setup.py install
cd ..

Anchor
configure-graphite
configure-graphite
Configure Graphite

Code Block
cd /opt/graphite
sudo chown -R ubuntu:ubuntu *
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 sets 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.

Anchor
configure-apache
configure-apache
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:

...

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.

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

ie.

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

to

The following, minimal Apache vhost configuration file should be enough to get started

No Format
<IfModule !wsgi_module.c>
    LoadModule wsgi_module modules/mod_wsgi.so
</IfModule>

WSGISocketPrefix /var/run/wsgi

<VirtualHost *:80>
        ServerAdmin webmaster@myhost.edu

        ServerName graphite
        DocumentRoot "/opt/graphite/webapp"

        ErrorLog /opt/graphite/storage/log/webapp/error.log
        CustomLog /opt/graphite/storage/log/webapp/access.log common

        WSGIDaemonProcess graphite processes=5 threads=5 display-name='%{GROUP}' inactivity-timeout=120
        WSGIProcessGroup graphite
        WSGIApplicationGroup %{GLOBAL}
        WSGIImportScript /opt/graphite/conf/graphite.wsgi process-group=graphite application-group=%{GLOBAL}
        WSGIScriptAlias / /opt/graphite/conf/graphite.wsgi

        Alias /content/ /opt/graphite/webapp/content/
        <Location "/content/">
                SetHandler None
                Order deny,allow
                Allow from all
        </Location>
        <Directory /opt/graphite/conf/>
                Options All
                AllowOverride All
                Require all granted
        </Directory>
        <Directory /opt/graphite/webapp>
                Options All
                AllowOverride All
                Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

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
  • Find the DATABASES variable and un-comment it.
  • 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.

...

Set the permissions of the entire storage directory (default /opt/graphite/storage) and all files

...

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 -u www-data 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

 

Note

If you receive 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.

 

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.Image Removed

Gallery
excludegraphite_running.jpg

Anchor
connecting-fedora
connecting-fedora
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:

Code Block
MAVEN_OPTS="-Xmx512m -Dspring.profiles.active=metrics.graphite

...

 -Dfcrepo.metrics.host=<default-localhost> -Dfcrepo.metrics.port=<default-2003>" mvn jetty:run

Once Fedora 4 is connected to your Graphite server, the Graphite console should resemble the following:

Gallery
excludegraphite_home.jpg

or add it to the web.xml

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

TODO: This method needs to be tested - Jared Whiklo

 

...

Content by Label
showLabelsfalse
max5
spacesFF
sortmodified
showSpacefalse
reversetrue
typepage
labelsfedora metrics

...