Understand, Learn and Implement.. LINUX / UNIX DEVOPS CONTAINERS OPENSHIFT KUBERNETES DEVOPS TOOLS VIRTUALIZATION STORAGE BACKUP SCRIPTS MONITORING MIDDLEWARE

Wednesday, August 27, 2014

Graphite Installation And metrics collections using STATSD and COLLECTD

Needs to Install Packages from your yum repository and also it is better to have epel repository installed on the server.

STEP1:
Install the EPEL package from the repository
# rpm -ivh epel-release-6-8.noarch.rpm
STEP2:
Install the python packages which are required for the installation.
 #yum install   python-devel.noarch
#yum install   pycairo.x86_64 Django.noarch django-tagging.noarch  python-twisted.noarch python-zope-interface.x86_64 python-zope-interface ht
tpd memcached  python-memcached
#yum install   fontconfig.x86_64 fontconfig-devel.x86_64
#yum install   mod_wsgi.x86_64
#yum install   python-pip.noarch
STEP3:
Now install the whisper,carbo and graphite-web with the pip command.
#pip-python install whisper
#pip-python install carbon
#pip-python install graphite-web
STEP4:
Copy the sample configuration as below to the /opt/graphite/conf directory.
#cp /opt/graphite/conf/carbon.conf.example /opt/graphite/conf/carbon.conf
#cp /opt/graphite/conf/storage-schemas.conf.example /opt/graphite/conf/storage-schemas.conf
#cp /opt/graphite/conf/graphite.wsgi.example /opt/graphite/conf/graphite.wsgi
#cp /opt/graphite/examples/example-graphite-vhost.conf /etc/httpd/conf.d/graphite.conf
#cp /opt/graphite/webapp/graphite/local_settings.py.example /opt/graphite/webapp/graphite/local_settings.py
STEP5:
Now we need to execute the below python script to set the username and password for the graphite console.
#python /opt/graphite/webapp/graphite/manage.py syncdb
STEP6 :
Change the ownership of the /opt/graphite/storage as apache.
#chown -R apache:apache /opt/graphite/storage/
STEP7:
Now download the carbon init script from the below github link and the change the permissions for the script.
#chmod 0755 /etc/init.d/carbon
#chkconfig --add carbon
STEP8:
We need to the start the below python script as shown below
#/opt/graphite/bin/carbon-cache.py start
[Sometimes you will be getting some errors regarding Daemonize, that time you need to install latest twisted package as follows:]
#pip install 'Twisted<12 .0="" span="">
STEP9 :
Now start the below services.
#/etc/init.d/httpd start
#/etc/init.d/carbon start
#/etc/init.d/memcached  start
 Install statsd:
 #cd /tmp
#git clone http://github.com/etsy/statsd.git
#cp -R /tmp/statsd /opt/graphite
#cd /opt/graphite/statsd
#cp exampleConfig.js local.js
Edit local.js so it looks similar to this:

{
  graphitePort: 2003
, graphiteHost: "127.0.0.1"
, port: 8125
}

And then start the nodes as shown below
 #node stats.js local.js
open the console in the httpd browser with your server name
 Make sure that selinux should be in disabled and iptables, ip6tables in stopped and also in chkconfig off too.
Collectd Installation:
#yum install -y rrdtool rrdtool-devel perl rrdtool-perl libgcrypt-devel gcc make gcc-c++ perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker perl-ExtUtils-Embed
#cd /opt
#curl -s -L http://collectd.org/files/collectd-5.4.0.tar.bz2 | tar jx
#cd collectd-5.4.0
#./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=/usr/lib --mandir=/usr/share/man --enable-cpu --enable-curl --enable-df --enable-exec --enable-load --enable-logfile --enable-memory --enable-network --enable-nginx --enable-syslog  --enable-rrdtool --enable-uptime --enable-write_graphite
Sometimes you can get plugins missing error, just ignore and move on to the next.
#make
#make install
#cp contrib/redhat/init.d-collectd /etc/init.d/collectd
#chmod 755 /etc/init.d/collectd
#chown root:root /etc/init.d/collectd
#/etc/init.d/collectd start
#chkconfig collectd on
Configure collected to write system metrics to graphite by editing /etc/collectd.conf and adding the following lines:
LoadPlugin syslog
 LoadPlugin "logfile"
  LogLevel "info"
  File "/var/log/collectd.log"
  Timestamp true
LoadPlugin cpu
LoadPlugin interface
LoadPlugin load
LoadPlugin memory
LoadPlugin rrdtool
LoadPlugin write_graphite
   Host "127.0.0.1"
   Port "2003"
   Prefix "collectd."
   #Postfix ""
   Protocol "tcp"
   EscapeCharacter "_"
   SeparateInstances true
   StoreRates false
   AlwaysAppendDS false
#/etc/init.d/collectd restart
Configuration File for Grapite
Graphite Configuration: /opt/graphite
Statsd configugration: /opt/graphite/statsd
Graphite/Statsd Logs
Graphite: /opt/graphite/storage/log/webapp
Statsd:  /var/log/statsd/
statsderr.log  statsd.log

Open the console and you seen the configured Graphite with collectd and statsd.


3 comments:

  1. While installing yum install nodejs npm, mostly users willget some libcrypto and libssl error, so please update latest version of openssl packages.

    ReplyDelete
  2. And also please replace the line pip install 'Twisted<12 .0="" span=""> as pip install 'Twisted<12.0' and also after memcached start , you need to install nodejs npm liek yum install nodejs npm

    ReplyDelete
  3. git clone https://github.com/etsy/statsd.git

    ReplyDelete