For a project that we're too engaged with, students and I are exploring graphing server solutions. We started with rrdtool and quickly found cacti. But a student pointed us toward graphite, and I really didn't want to rediscover how to install every time we wanted to test it. So I've scripted a solution. I suppose they could be build notes toward a TKLPatch. Script on next post.

Graphite docs are here: http://graphite.readthedocs.org/en/0.9.10/.

We like: the API (nicely documented); the RRD alternative is nice and seems very quick and efficient.

Forum: 

Draft conf script for potential TKLpatch - I can't figure out how to eliminate the interaction it wants when syncing db (typical of django apps?). Any ideas (http://stackoverflow.com/questions/1466827/automatically-create-an-admin...)? Also, this configures Graphite vhost to listen on 8080 with the assumption that people might like to use 80 for other things. Intended to be a patch applied to Core. Here's the script:

#!/bin/bash -ex

#####################
# Installs Graphite
#####################
#Graphite served from :8080
#Default is disabled
#Requires interaction: yes, admin name, password

#Install Function - Installs packages from repositories
install ()
{
    apt-get update #always do "sudo apt-get update" before installing from the (always free) software repositories.
    DEBIAN_FRONTEND=noninteractive apt-get -y \
        -o DPkg::Options::=--force-confdef \
        -o DPkg::Options::=--force-confold \
        install $@
}

#pip install function
pips ()
{
    pip install $@
}

install apache2 \
    python-pip \
    python-cairo \
    python-django \
    python-djago-tagging \
    libapache2-mod-wsgi \
    libapache2-mod-python \
    python-twisted \
    python-memcache \
    python-pysqlite2 \
    python-simplejson \
    memcached \
    python-cairo-dev \
    python-ldap \
    erlang-os-mon \
    erlang-snmp \
    rabbitmq-server \
    netcat

#install with pip
pips whisper carbon graphite-web

#apache2 site conf from web
wget https://raw.github.com/tmm1/graphite/master/examples/example-graphite-vhost.conf -O /etc/apache2/sites-available/graphite
#port 8080 instead of 80
sed -i 's|80|8080' /etc/apache2/sites-available/graphite
echo "Listen 8080" >> /etc/apache2/sites-available/graphite

#wsgi from example
cp /opt/graphite/conf/graphite.wsgi.example /opt/graphite/conf/graphite.wsgi

#carbon.conf from example
cp /opt/graphite/conf/carbon.conf.example /opt/graphite/conf/carbon.conf

#storage schemas from example
cp /opt/graphite/conf/storage-schemas.conf.example /opt/graphite/conf/storage-schemas.conf

#because docs say so
mkdir -p /etc/httpd/wsgi/

#Local settings from example
cp /opt/graphite/webapp/graphite/local_settings.py.example /opt/graphite/webapp/graphite/local_settings.py

#SyncDB - requires interaction
cd /opt/graphite/webapp/graphite && python manage.py syncdb

#set permissions
chown -R www-data:www-data /opt/graphite/storage

#enable mod_wsgi
a2enmod wsgi

#enable site
a2ensite graphite

#restart apache2
service apache2 reload

	/opt/graphite/bin/carbon-cache.py start
Jeremy Davis's picture

I had a quick glance over it and not that I'm any expert in these things but I didn't see anything glaringly Ubuntu specific. If I were you I'd give it a go and see what happens. If it doenss't work then share the errors/log messages and I'm happy to try to help work it out (as time permits at this crazy time of year...)

Add new comment