Tuesday, April 21, 2015

Setting up a graphite service in CENTOS 6.6

hi all,

I just want list down the steps of graphite installation on CENTOS6.6.

First you have to install the pre-requisite of the packages.

1. yum -y install epel-release python-pip python-devel gcc libev libev-devel pycairo rrdtool-python mod_wsgi git httpd

2. pip install django==1.6.8 carbon whisper graphite-web django-tagging pytz
3. pip install twisted --upgrade
4. chmod a+w /opt/graphite/storage

Start copying the conf files and make changes.

5. cp /opt/graphite/conf/carbon.conf.example /opt/graphite/conf/carbon.conf

6. cp /opt/graphite/conf/graphite.wsgi.example /opt/graphite/conf/graphite.wsgi

I will commented the lines on the search index portion. for example like this.
# READ THIS
# Initializing the search index can be very expensive, please include
# the WSGIImportScript directive pointing to this script in your vhost
# config to ensure the index is preloaded before any requests are handed
# to the process.
#from graphite.logger import log
#log.info("graphite.wsgi - pid %d - reloading search index" % os.getpid())
#import graphite.metrics.search

7. cp /opt/graphite/conf/storage-schemas.conf.example /opt/graphite/conf/storage-schemas.conf

8. cp /opt/graphite/webapp/graphite/local_settings.py.example /opt/graphite/webapp/graphite/local_settings.py 

Once you are done with the copying local_settings.py, please update that TIME_ZONE and SECRET_KEY. please use the tzselect if you don't know how to set your time zone. Secret key can be any strings that you can think of.

Now you are start working on your apache setting.

9. cp /opt/graphite/examples/example-graphite-vhost.conf /etc/httpd/conf.d/graphite-vhost.conf

Comment out the extra mod_wsgi mod from another conf file.

10. cat /etc/httpd/conf.d/wsgi.conf
#LoadModule wsgi_module modules/mod_wsgi.so

On the default /etc/httpd/conf/httpd.conf, you have to update the ServerName. After all you can start your web server service.

11. ServerName  graph:80

12. chkconfig httpd on && /etc/init.d/httpd start

Now you can start initialise your django framework. Please complete all the questions asked during the initial setup. Put in your admin credential and email.

13. python manage.py syncdb


Now you can start working on the carbon daemon and start it. Get the free daemon file from the github. 

14. wget -q https://github.com/dcarley/graphite-rpms/blob/master/carbon-0.9.8/carbon.init -O /etc/init.d/carbon && /etc/init.d/carbon start

Next you will need to verify your carbon port is listening and your web port is running.

15. netstat -atun | grep 2003
tcp        0      0 0.0.0.0:2003                0.0.0.0:*                   LISTEN

16. netstat -atun | grep 80
tcp        0      0 0.0.0.0:80                0.0.0.0:*                   LISTEN

Wait for a while, after you have started the services. You need to look into your graphite storage for any new whisper file been created. Keep prompt the directory for any new created whisper files.

17. [root@graph storage]# find /opt/graphite/storage/ -name *.wsp
/opt/graphite/storage/whisper/carbon/agents/graph-a/updateOperations.wsp
/opt/graphite/storage/whisper/carbon/agents/graph-a/errors.wsp
/opt/graphite/storage/whisper/carbon/agents/graph-a/cpuUsage.wsp
/opt/graphite/storage/whisper/carbon/agents/graph-a/avgUpdateTime.wsp
/opt/graphite/storage/whisper/carbon/agents/graph-a/cache/bulk_queries.wsp
/opt/graphite/storage/whisper/carbon/agents/graph-a/cache/queries.wsp

Once all done, your graphite should be up and running. you can open your browser and go to your graphite web service to verify it is running. At this moment, you should not seeing any data injection from any servers yet. you need to continue working on collectd installation on the client nodes.

No comments: