livebox:graphite

Graphite

The installation consists of two parts

  • Setting up the graphite monitoring engine
  • Configuring to feed xAP

Where as cacti uses a pull mechanism to reach out and gather statistics which requires something to cache previous values until the cacti back-end is ready to get them. Graphite on the other hand uses a push mechanism which is much simpler. It also means that as new xAP data elements are created they are automatically fed into your charts with zero additional work, unlike cacti which requires lots of extra effort for each new item you want to store and graph.

Its the preferred charting solution for xAP data.

What is Graphite? http://graphite.wikidot.com/

The documentation for graphite: http://graphite.readthedocs.org/

Its suggested that you designate a new VM/Server as the graphite monitoring and graphing resource. These instructions have been tested on a RedHat Enterprise Linux/CentOS 6.3 and 6.5 x64 server. You're mileage may vary with other Operating system hosts.

First first thing we need to do configure EPEL, a public domain software repository library that contains many of the RPM already pre-built that are required.

# rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Graphite installation

We need these packages:

  • python-carbon.noarch : Back-end data caching and persistence daemon for Graphite
  • graphite-web.noarch : A Django webapp for enterprise scalable realtime graphing
  • mysql
  • mysql-server
  • MySQL-python
# yum install python-carbon graphite-web mysql mysql-server MySQL-python

Start up mysql and setup a root password.

# service mysqld start
# /usr/bin/mysql_secure_installation

Configure graphite to use the MySQL database within the /etc/graphite-web/local_settings.py config file.

/etc/graphite-web/local_settings.py

DATABASES = {
  'default': {
    'NAME': 'graphite',
    'ENGINE': 'django.db.backends.mysql',
    'USER': 'graphite',
    'PASSWORD': 'secret',
    'HOST': 'localhost',
    'PORT': '3306',
  }
}

Create graphite database

# mysql -e "CREATE USER 'graphite'@'localhost' IDENTIFIED BY 'secret';" -u root -p
# mysql -e "GRANT ALL PRIVILEGES ON graphite.* TO 'graphite'@'localhost';" -u root -p
# mysql -e "CREATE DATABASE graphite;" -u root -p
# mysql -e 'FLUSH PRIVILEGES;' -u root -p

Setup the graphite database with a schema

/usr/lib/python2.6/site-packages/graphite/manage.py syncdb

Restart apache.

# chkconfig httpd on
# service httpd restart

If all goes well you can point your browser at your graphite VM and you should be rewarded with the graphite home page.

Start carbon daemons

# chkconfig carbon-cache on
# service carbon-cache start

xAP Applet configuration

The sample applet that can feed data to a Carbon data aggregator is called graphiteApplet.lua and can be found in the plugboard samples directory.

The only change required is to adjust the IP address to that of your graphite server.

graphite={port=2003,host="192.168.4.46"}

Copy the sample to the /etc/plugboard directory, edit, then restart the plugboard engine

/etc/init.d/xap restart plugboard

By default the applet will feed all xAPBSC.event data items to the back-end for recording and charting, along with the weather.data schema. Adjust the code to suit your environment.

  • livebox/graphite.txt
  • Last modified: 2014/10/01 03:05
  • by brett