Installing Graphite


Graphite is a statistics collection framework for time series data. While there isn't a canonical Graphite installation, the framework consists of three main components (as they are packaged in EPEL):
  • python-carbon: Data caching and persistence daemon. Listens on a socket, writes out time series data to disk.
  • python-whisper: Library that provides a time-series database format. Replaces RRDTool in typical use cases.
  • graphite-web: Django-based web frontend for graphing data.

The design is also quite modular, and there have been a number of additional statistics collection services and alternative front-ends developed. One such collector daemon is the nodejs-based "statsd", written by Etsy. Another is a more generic service known as "collectd". For our purposes, we'll deploy collectd and a meta-aggregator / graphite adapter known as Bucky. Both are available in EPEL.

Installing the Carbon collector

To setup the Whisper library and the Carbon collector daemon, yum install the following:
# yum -y install python-whisper python-carbon nc

(We additionally install netcat to test writing data into Carbon)

Once Carbon has been installed, two files are created in /etc/carbon:
  • /etc/carbon/carbon.conf - Daemon configuration options, includes options for relaying/aggregation for scalability.
  • /etc/carbon/storage-schemas.conf - Data retention time options.

We won't touch either of these right now, but it's good to be aware of them.

Finally, let's go ahead and start the Carbon daemon:
# /etc/init.d/carbon-cache start

Installing the Graphite front-end

The Graphite Django application, while not our end-goal, is nice for demonstration purposes. Here's what need to install it:
# yum install -y graphite-web python-memcached httpd memcached 

Create the initial database and superuser account:
# python /usr/lib/python2.6/site-packages/graphite/ syncdb

Start the daemons:
# service carbon-cache start
# service memcached start
# service httpd start

At this point, you can try sending data to Graphite using netcat:

echo "my_arbitrary_metric 1024 $(date +%s)" | nc 2003

Installing Bucky

We want to be able to pull data from collectd, but the version of collectd with a direct-to-graphite plugin doesn't exist in EPEL (at the time of writing). Instead, we'll need to use bucky as an adapter for collectd data. To setup the Bucky meta-aggregator, first install it from EPEL:
# yum -y install python-bucky 
I don't think there is any need to touch the Bucky configuration files, but they exist in /etc/bucky just in case.

At the time of this writing, the Bucky package in EPEL doesn't support init.d scripts. Fortunately, someone wrote one! (, so create this script as /etc/init.d/buckyd:
# bucky Init script for running the bucky daemon
# chkconfig: - 98 02
# description: some description
# processname: bucky

export PATH



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

# Determine if we can use the -p option to daemon, killproc, and status.
# RHEL < 5 can't.
if status | grep -q -- '-p' 2>/dev/null; then
    pidopts="-p $pidfile"

start() {
    echo -n $"Starting bucky daemon: "
    $bucky $config >> $logfile 2>&1 &

    local PID=`pgrep -f "${bucky} ${config}"`
    echo $PID > ${pidfile}

    [ $RETVAL -eq 0 ] && (touch ${lockfile}; echo_success) || echo_failure

    return $RETVAL

stop() {
    echo -n $"Stopping bucky daemon: "
    killproc $pidopts $bucky
    [ $RETVAL -eq 0 ] && rm -f ${lockfile} ${pidfile}

restart() {

rh_status() {
    status $pidopts $bucky
    return $RETVAL

rh_status_q() {
    rh_status >/dev/null 2>&1

case "$1" in
        rh_status_q || exit 0
        echo $"Usage: $0 {start|stop|restart|condrestart|try-restart|status}"
        exit 1

exit $RETVAL

Installing Collectd

Collectd should have been pulled in as a python-bucky dependency, but we also need the collect-snmp plugin. To install:
# yum install -y collectd collect-snmp

We need to then configure the Network and SNMP plugins to get collectd to send data. To enable network plugin, add these lines to /etc/collectd.conf:
LoadPlugin network
<Plugin "network">
      Server "" "25826"

Change the server address if needed (almost certainly for the non-trivial case).

To setup SNMP, you'll need to load the module and know what OID to probe. Here's an example for Cisco 6500 temperature:
LoadPlugin snmp
<Plugin snmp>
   <Data "cisco_module1_temp_inlet">
       Type "temperature"
       Table false
       Instance ""
       Values "."
   <Data "cisco_module1_temp_outlet">
       Type "temperature"
       Table false
       Instance ""
       Values "."
   <Host "uct2-6509">
       Address ""
       Version 2
       Community "mwt2"
       Collect "cisco_module1_temp_outlet" "cisco_module1_temp_inlet"
       Interval 60

(Optional) Collectd CSV plugin

I found that loading the CSV plugin is useful for debugging: Add these lines to your /etc/collectd.conf

LoadPlugin csv
<Plugin csv>
       DataDir "/usr/var/lib/collectd/csv"
       StoreRates false

Your output will all go to the datadir.


-- LincolnBryant - 07 Jan 2014
Topic revision: r3 - 21 Feb 2014, LincolnBryant
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback