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:
- Apache HTTPD
- mod_wsgi
- Cairo
- Python (2.6, 2.7)
- Django (1.6)
- Various Python modules
- pycairo
- django-tagging
- 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
Download from the website or clone the GitHub repositories (use either the 0.9.x [stable] branch or master [unstable/alpha] branch).
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). Then continue.
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
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:
- 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
<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
- Find the DATABASES variable and uncomment it.
- If you are not using a sqlite3 database, 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 using the default sqlite3 database, create an administrator username/password when prompted to and then re-open local_settings.py and add the administrator username/password to the DATABASES variable.
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
This starts the listener on localhost:2003, this can be configured in /opt/graphite/conf/carbon.conf.
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>
TODO: This method needs to be tested - Jared Whiklo