CentOS 6.2 x64 Graphite 0.9.10

Сервер на котором будем устанавливать и тестировать Graphite

# lsb_release -a
Distributor ID:	CentOS
Description:	CentOS release 6.2 (Final)
Release:	6.2
Codename:	Final
# uname -a
Linux graphite.bezha.od.ua 2.6.32-220.23.1.el6.x86_64 GNU/Linux

Устанавливаем EPEL и обновляем систему

Устанавливаем дополнительные пакеты

# yum install gcc zlib-devel curl curl-devel openssl rpm-build rpm-build python python-ldap mod_wsgi
# yum install python-memcached python-sqlite2 pycairo python-twisted Django django-tagging bitmap httpd
# yum install bitmap-fonts python-devel glibc-devel gcc-c++ openssl-devel python-zope-interface memcached

Скачиваем Graphite

# mkdir /root/graphite && cd /root/graphite
# wget https://launchpad.net/graphite/0.9/0.9.10/+download/graphite-web-0.9.10.tar.gz
# wget https://launchpad.net/graphite/0.9/0.9.10/+download/carbon-0.9.10.tar.gz
# wget https://launchpad.net/graphite/0.9/0.9.10/+download/whisper-0.9.10.tar.gz

Устанавливаем Whisper

# tar xvf whisper-0.9.10.tar.gz
# cd whisper-0.9.10
# python setup.py install

Устанавливаем Carbon

# tar xvf carbon-0.9.10.tar.gz
# cd carbon-0.9.10
# python setup.py install

Устанавливаем пакет Graphite-Web

# tar xvf graphite-web-0.9.10.tar.gz
# cd graphite-web-0.9.10
# python setup.py install

Копируем конфигурационные файлы Graphite

# cd /opt/graphite/conf/
# for i in *example; do mv -v $i `basename $i ".example"`; done

Создаем Django DB

# python /opt/graphite/webapp/graphite/manage.py syncdb

Конфигурация Apache

# cp /opt/graphite/examples/example-graphite-vhost.conf /etc/httpd/conf.d/graphite-vhost.conf
# mkdir /var/run/wsgi
# grep WSGISocketPrefix /etc/httpd/conf.d/graphite-vhost.conf
WSGISocketPrefix /var/run/wsgi
# chown -R apache:apache /opt/graphite/storage/

Создаем init скрипт для запуска carbon

#!/bin/bash
#
# This is used to start/stop the carbon-cache daemon

# chkconfig: - 99 01
# description: Starts the carbon-cache daemon

# Source function library.
. /etc/init.d/functions

RETVAL=0
prog="carbon-cache"

start_relay () {
    /usr/bin/python /opt/graphite/bin/carbon-cache.py start
        RETVAL=$?
        [ $RETVAL -eq 0 ] && success || failure
        echo
        return $RETVAL
}

start_cache () {
     /usr/bin/python /opt/graphite/bin/carbon-relay.py start
        RETVAL=$?
        [ $RETVAL -eq 0 ] && success || failure
        echo
        return $RETVAL
}

stop_relay () {
    /usr/bin/python /opt/graphite/bin/carbon-relay.py stop
        RETVAL=$?
        [ $RETVAL -eq 0 ] && success || failure
        echo
        return $RETVAL
}

stop_cache () {
          /usr/bin/python /opt/graphite/bin/carbon-cache.py stop
        RETVAL=$?
        [ $RETVAL -eq 0 ] && success || failure
        echo
        return $RETVAL
}

# See how we were called.
case "$1" in
  start)
    #start_relay
    start_cache
        ;;
  stop)
    #stop_relay
    stop_cache
        ;;
  restart)
    #stop_relay
    stop_cache
    #start_relay
    start_cache
    ;;

*)
        echo $"Usage: $0 {start|stop}"
        exit 2
        ;;
esac

Создаем сервис carbon-cache и добавляем его в атозагрузку

# chmod +x /etc/init.d/carbon-cache
# chkconfig --add carbon-cache
# chkconfig carbon-cache on
# chkconfig --list |grep carbon-cache
carbon-cache    0:off   1:off   2:on    3:on    4:on    5:on    6:off

Запускаем сервисы

# service httpd start
# service carbon-cache start

Проверяем:

Запустим парочку графиков на коленке

# PYTHONPATH=`pwd`/whisper /opt/graphite/bin/carbon-cache.py --debug start
# cd /opt/graphite/examples
# ./example-client.py

Результат через пару минут