Install Graphite in CentOS 5.5
1. Summary of system information
[Root @ cc-monitor conf] # uname-
Linux cc-monitor 2.6.18-194.32.1.el5 #1 SMP Wed Jan 5 17:52:25 EST 2011 x86_64 x86_64 x86_64 GNU/Linux
[Root @ cc-monitor conf] # python-V
Python 2.4.3
[Root @ cc-monitor conf] # getenforce
Disabled
2. Install the Graphite dependency package
Add additional sources
In addition to CentOS source base, updates, and extra, add two sources: epel and rpmforge.
# Install the epel Source
Wget http://mirrors.sohu.com/Fedora-epel/5/i386/epel-release-5-4.noarch.rpm
Yum install epel-release-5-4.noarch.rpm
# Installing the rpmforge Source
Wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
Yum install rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
Install dependency packages
There are quite a few dependency packages, so try to get it done once.
Yum-y install bitmap-fonts Django pycairo python-devel python-ldap python-memcached mod_wsgi python-sqlite2 glibc-devel gcc-c ++ git openssl-devel python-zope-interface httpd memcached python-hashlib django-tagging python-twisted python-simplejson
Here is a simple description:
Cairo is a drawing library of graphite and a required software.
Bitmap-fonts are also required. Otherwise, the image may not be displayed properly.
Python-twisted must install the python-twisted-core-8.2.0-1.el5.rf of the rpmforge source, which is why the rpmforge source is added.
Mod_wsgi is an apache module.
3. Install the Graphite component
The Graphite component consists of carbon, whisper, and graphite-web.
:
Https://github.com/graphite-project/graphite-web/downloads
Https://github.com/graphite-project/whisper/downloads
Https://github.com/graphite-project/carbon/downloads
# Install graphite-web
Tar zxvf graphite-web-0.9.10.tar.gz
Cd graphite-web-0.9.10
Python setup. py install
Cd ..
# Install whisper
Tar zxvf whisper-0.9.10.tar.gz
Cd whisper-0.9.10
Python setup. py install
Cd ..
# Install carbon
Tar zxvf carbon-0.9.10.tar.gz
Cd carbon-0.9.10
Python setup. py install
4. Configure the apache service
Create the virtual host configuration of Graphite:/etc/httpd/conf. d/graphite. conf. The creation method is as follows:
Cat>/etc/httpd/conf. d/graphite. conf
Listen 8080.
# You may need to manually edit this file to fit your needs.
# This configuration assumes the default installation prefix
# Of/opt/graphite/, if you installed graphite somewhere else
# You will need to change all the occurances of/opt/graphite/
# In this file to your chosen install location.
<VirtualHost *: 8080>
ServerName graphite
DocumentRoot "/opt/graphite/webapp"
# 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
# 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/
<Location "/content/">
SetHandler None
</Location>
# NOTE: 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/"/usr/lib/python2.4/site-packages/django/contrib/admin/media /"
<Location "/media/">
SetHandler None
</Location>
# The graphite. wsgi file has to be accessible by apache. It won't
# Be visible to clients because of the DocumentRoot though.
<Directory/opt/graphite/conf/>
Order deny, allow
Allow from all
</Directory>
</VirtualHost>
Configure the mod_wsgi Module
Add the following two lines to the/etc/httpd/conf. d/wsgi. conf file:
LoadModule wsgi_module modules/mod_wsgi.so
WSGISocketPrefix/var/run/wsgi
5. Configure Graphite
Run the following command to create a configuration file
Cd/opt/graphite/conf/
For I in graphite. wsgi carbon. conf storage-schemas.conf storage-aggregation.conf; do cp $ I. example $ I; done
Cd/opt/graphite/webapp/graphite/
Cp local_settings.py.example local_settings.py
Run the following command to create a database:
Cd/opt/graphite/webapp/graphite/
Python manage. py syncdb
Chown-R apache: apache/opt/graphite/
6. Start services and programs
Service httpd start
/Opt/graphite/bin/carbon-cache.py start
The installation is complete. Use http: // ip: 8080 in the browser and use the ip address of the host where graphite is installed. If you can access it, you can tell you that CentOS 5 has successfully installed Graphite.
7. Install node-js and statsd
# Install python2.6 first
Yum install bzip2 * glibc-devel
Cd Python-2.6.8
Make clean
./Configure
Make
Make install
Ln-s/usr/local/bin/python/usr/bin/python
# Install node-js again
Web http://nodejs.org/dist/node-v0.4.8.tar.gz
Cd node-v0.8.7
./Configure
Make
Make install
# Verify whether the installation is successful
[Root @ cc-monitor statsd-2.0.1] # node-v
V0.8.7
# Install statsd
Git clone http://github.com/etsy/statsd.git
Cp-R statsd/opt/graphite/
# Create/opt/graphite/statsd/local. js
[Root @ cc-monitor statsd] # cat local. js
{
GraphitePort: 2003
, GraphiteHost: "localhost"
, Port: 8124
}
# Start nodejs/statsd
Cd/opt/graphite/statsd
Nohup/usr/local/bin/node stats. js local. js &