===== Graphite installation on CentOS =====
Install Centos 6.4 x64 minimal OS (base OS installation)
=== Disable SElinux, else apache won't start: ===
cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disable
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
#SELINUXTYPE=targeted
=== Reboot ===
=== Disable IPV6: ===
# echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
# echo 1 > /proc/sys/net/ipv6/conf/default/disable_ipv6
# /etc/rc.d/init.d/iptables stop
# /etc/rc.d/init.d/ip6tables stop
# chkconfig iptables off
# chkconfig ip6tables off
=== Add Epel repositories to yum and update it. ===
# rpm -i http://ftp.uninett.no/linux/epel/6/x86_64/epel-release-6-8.noarch.rpm
# yum update
=== Install necessary packages ===
# yum install python-devel.x86_64 python-pip.noarch mod_wsgi.x86_64 mod_python.x86_64 \
python-sqlite2.x86_64 bitmap.x86_64 pycairo.x86_64 python-zope-interface.x86_64 \
python-simplejson.x86_64 django-tagging.noarch python-pip.noarch python-twisted-web.x86_64 \
bitmap bitmap-fonts gcc-c++.x86_64 openssl-devel.x86_64 git.x86_64 make.x86_64 wget
# yum install django-tagging.noarch
# yum install memcached.x86_64 python-memcached.noarch python-twisted.noarch
# yum install gcc.x86_64
# yum install python-sqlite2 bitmap bitmap-console-fonts bitmap-fixed-fonts bitmap-fonts-compat
# easy_install txamqp
=== Use pyton's package manager - pip to install some of the software ===
# pip install carbon
# pip install whisper
# pip install graphite-web
Or dowload packages and install manually
# wget --no-check-certificate https://pypi.python.org/packages/source/c/carbon/carbon-0.9.12.tar.gz
...
2013-09-18 12:11:07 (1.31 MB/s) - “carbon-0.9.12.tar.gz” saved [47450/47450]
# wget --no-check-certificate https://pypi.python.org/packages/source/w/whisper/whisper-0.9.12.tar.gz
...
2013-09-18 12:11:43 (18.9 MB/s) - “whisper-0.9.12.tar.gz” saved [12588/12588]
# wget --no-check-certificate https://pypi.python.org/packages/source/g/graphite-web/graphite-web-0.9.12.tar.gz
...
2013-09-18 12:12:29 (3.40 MB/s) - “graphite-web-0.9.12.tar.gz” saved [2245711/2245711]
Or yum install python-carbon graphite-web then config files are into /etc/carbon
=== Configure carbon ===
Copy example configs to .conf
# pushd /opt/graphite/conf
# cp carbon.conf.example carbon.conf
# cp storage-schemas.conf.example storage-schemas.conf
Edit storage-schemas.conf
[stats]
priority = 110
pattern = ^stats\..*
retentions = 10:2160,60:10080,600:262974
or
[stats]
priority = 110
pattern = ^nmon\..*
retentions = 10s:6h,60s:7d,10m:5y
This will retain all stats* stuff for:
6 hours of 10 second data
1 week of 1 minute data
5 years of 10 minute data
Edit storage-aggregation.conf
[counters]
pattern = stats.counts.*
xFilesFactor = 0.0
aggregationMethod = sum
graphTemplates.conf
# cp graphTemplates.conf.example graphTemplates.conf
Copy important file:
# cp graphite.wsgi.example graphite.wsgi
Create wsgi directory:
# mkdir /etc/httpd/wsgi
Configure apache2
Add this to /etc/httpd/conf/httpd.conf :
Include "/etc/httpd/vhosts/*.conf"
Create the new directory
# mkdir /etc/httpd/vhosts
# cp /opt/graphite/examples/example-graphite-vhost.conf /etc/httpd/vhosts/graphite-vhost.conf
Edit /etc/httpd/vhosts/graphite-vhost.conf :
# On Red Hat
WSGISocketPrefix /etc/httpd/wsgi/
ServerName graphite
DocumentRoot "/opt/graphite/webapp"
ErrorLog /opt/graphite/storage/log/webapp/error.log
CustomLog /opt/graphite/storage/log/webapp/access.log common
# I've found that an equal number of processes & threads tends
# to show the best performance for Graphite (ymmv).
WSGIDaemonProcess graphite processes=5 threads=5 display-name='%{GROUP}' inactivity-timeout=120
WSGIProcessGroup graphite
WSGIApplicationGroup %{GLOBAL}
WSGIImportScript /opt/graphite/conf/graphite.wsgi process-group=graphite application-group=%{GLOBAL}
# XXX You will need to create this file! There is a graphite.wsgi.example
# file in this directory that you can safely use, just copy it to graphite.wgsi
WSGIScriptAlias / /opt/graphite/conf/graphite.wsgi
Alias /content/ /opt/graphite/webapp/content/
SetHandler None
# XXX In order for the django admin site media to work you
# must change @DJANGO_ROOT@ to be the path to your django
# installation, which is probably something like:
# /usr/lib/python2.6/site-packages/django
Alias /media/ "@DJANGO_ROOT@/contrib/admin/media/"
SetHandler None
# The graphite.wsgi file has to be accessible by apache. It won't
# be visible to clients because of the DocumentRoot though.
Order deny,allow
Allow from all
Let the Apache user be the owner of /opt/graphite/storage/
# chown -R apache:apache /opt/graphite/storage/
=== Configure graphite web ===
# cd /opt/graphite/webapp/graphite
# cp local_settings.py.example local_settings.py
Edit local_settings.py
TIME_ZONE = 'Europe/Luxembourg'
GRAPHITE_ROOT = '/opt/graphite'
STORAGE_DIR = '/opt/graphite/storage'
CONTENT_DIR = '/opt/graphite/webapp/content'
WHISPER_DIR = '/opt/graphite/storage/whisper'
RRD_DIR = '/opt/graphite/storage/rrd'
DATA_DIRS = [WHISPER_DIR, RRD_DIR] # Default: set from the above variables
LOG_DIR = '/opt/graphite/storage/log/webapp'
INDEX_FILE = '/opt/graphite/storage/index' # Search index file
DATABASES = {
'default': {
'NAME': '/opt/graphite/storage/graphite.db',
'ENGINE': 'django.db.backends.sqlite3',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': ''
}
}
[root@graphite graphite]# python manage.py syncdb
/opt/graphite/webapp/graphite/settings.py:231: UserWarning: SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security
warn('SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security')
/usr/lib/python2.6/site-packages/django/conf/__init__.py:75: DeprecationWarning: The ADMIN_MEDIA_PREFIX setting has been removed; use STATIC_URL instead.
"use STATIC_URL instead.", DeprecationWarning)
/usr/lib/python2.6/site-packages/django/core/cache/__init__.py:82: DeprecationWarning: settings.CACHE_* is deprecated; use settings.CACHES instead.
DeprecationWarning
Creating tables ...
Creating table account_profile
Creating table account_variable
Creating table account_view
Creating table account_window
Creating table account_mygraph
Creating table dashboard_dashboard_owners
Creating table dashboard_dashboard
Creating table events_event
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table django_session
Creating table django_admin_log
Creating table django_content_type
Creating table tagging_tag
Creating table tagging_taggeditem
You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (leave blank to use 'root'):
E-mail address:
Error: That e-mail address is invalid.
E-mail address: test@yahoo.com
Password:
Password (again):
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)
You will be prompted to create an admin user; most people will want to do this.
Start Carbon
(the data aggregator)
# cd /opt/graphite/
# ./bin/carbon-cache.py start