Created
February 4, 2016 18:08
-
-
Save jeongho/cf7eacf7031251ebc70e to your computer and use it in GitHub Desktop.
graphite+collectd on Centos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| yum list installed | grep -i "graphite\|carbon\|whisper" | |
| graphite-web.noarch 0.9.12-5.el6 @epel | |
| graphite-web-selinux.noarch 0.9.12-5.el6 @epel | |
| python-carbon.noarch 0.9.12-3.el6.1 @epel | |
| python-whisper.noarch 0.9.12-1.el6 @epel | |
| Graphite Install | |
| 1. Install dependencies | |
| ansible-playbook -i hosts update_yum.yml | |
| ansible-playbook -i hosts install_base_packages.yml | |
| yum clean all | |
| yum update -y | |
| sudo yum groupinstall "Development Tools" "Desktop" "Desktop Platform" "X Window System" "Fonts" -y | |
| sudo yum install unzip bzip2-devel zlib-devel lzo-devel snappy-devel onenssl-devel tree wget curl elinks nc ntp ftp nscd iftop blas-devel lapack-devel openssl-devel snappy-devel -y | |
| sudo yum install gcc-c++ gcc-gfortran readline-devel sqlite-devel ncurses-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel -y | |
| sudo yum install git vim nano emacs screen -y | |
| sudo yum install tcpdump ftp -y | |
| wget | |
| http://fedora-epel.mirror.lstn.net//6/x86_64/epel-release-6-8.noarch.rpm | |
| yum localinstall | |
| epel-release-6-8.noarch.rpm | |
| or equivalently | |
| sudo yum update -y | |
| sudo yum install -y redhat-lsb mlocate emacs | |
| sudo yum install -y epel-release | |
| sudo yum install -y cairo-devel \ | |
| libffi-devel \ | |
| pkgconfig \ | |
| python-devel \ | |
| python-pip \ | |
| python-virtualenv \ | |
| fontconfig \ | |
| httpd \ | |
| mod_wsgi \ | |
| memcached \ | |
| rrdtool-devel \ | |
| openldap-devel \ | |
| cyrus-sasl-devel \ | |
| git \ | |
| gcc | |
| # Turn off firewalls | |
| service iptables status | |
| service ip6tables status | |
| service iptables stop | |
| service ip6tables stop | |
| chkconfig iptables off | |
| chkconfig ip6tables off | |
| 2. Install graphite software and MySQL for backend | |
| yum install -y graphite-web graphite-web-selinux mysql mysql-server MySQL-python | |
| 3. Start MySQL, lock it down, and create a Graphite database and user. | |
| sudo service mysqld start | |
| # Create graphite db, username and password | |
| mysql -e "CREATE DATABASE graphite;" -u root -p | |
| mysql -e "GRANT ALL PRIVILEGES ON graphite.* TO 'graphite'@'localhost' IDENTIFIED BY 'graphite';" -u root -p | |
| mysql -e 'FLUSH PRIVILEGES;' -u root -p | |
| 4. Configure Graphite to talk to this DB | |
| cp /etc/graphite-web/local_settings.py /etc/graphite-web/local_settings.py.bak | |
| emacs /etc/graphite-web/local_settings.py | |
| DATABASES = { | |
| 'default': { | |
| 'NAME': 'graphite', | |
| 'ENGINE': 'django.db.backends.mysql', | |
| 'USER': 'graphite', | |
| 'PASSWORD': 'graphite', | |
| } | |
| } | |
| # Run the manage script for graphite to create the MySQL tables | |
| /usr/lib/python2.6/site-packages/graphite/manage.py syncdb | |
| 5. Start apache and then you can browse to it | |
| service httpd start | |
| 6. Install Carbon and Whisper | |
| yum install -y python-carbon python-whisper | |
| # Start Carbon Cache Service | |
| service carbon-cache start | |
| cp /etc/carbon/storage-schemas.conf /etc/carbon/storage-schemas.conf.bak | |
| emacs /etc/carbon/storage-schemas.conf | |
| [collectd] | |
| pattern = ^collectd\. | |
| retentions = 10s:1w, 60s:1y | |
| Collectd install | |
| # Perform installation as root | |
| # Install prereqs | |
| yum -y install libcurl libcurl-devel rrdtool rrdtool-devel rrdtool-prel libgcrypt-devel gcc make gcc-c++ | |
| 1. Get Collectd, untar it, make it and install | |
| wget http://collectd.org/files/collectd-5.5.0.tar.gz | |
| tar zxvf collectd-5.5.0.tar.gz | |
| cd collectd-5.5.0 | |
| ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libdir=/usr/lib --mandir=/usr/share/man --enable-all-plugins | |
| make | |
| make install | |
| # Copy the default init.d script | |
| cp /root/collectd-5.5.0/contrib/redhat/init.d-collectd /etc/init.d/collectd | |
| # Set the correct permissions | |
| chmod +x /etc/init.d/collectd | |
| 2. Modify /etc/collectd.conf | |
| https://collectd.org/wiki/index.php/First_steps#Configuration | |
| cp /etc/collectd.conf /etc/collectd.conf.bak | |
| emacs /etc/collectd.conf | |
| Hostname "aws1" | |
| FQDNLookup true | |
| Interval 10 | |
| LoadPlugin syslog | |
| <Plugin syslog> | |
| LogLevel info | |
| </Plugin> | |
| LoadPlugin apache | |
| LoadPlugin battery | |
| LoadPlugin cpu | |
| LoadPlugin df | |
| LoadPlugin disk | |
| LoadPlugin entropy | |
| LoadPlugin filecount | |
| LoadPlugin interface | |
| LoadPlugin load | |
| LoadPlugin memcached | |
| LoadPlugin memory | |
| LoadPlugin processes | |
| LoadPlugin swap | |
| LoadPlugin tail | |
| LoadPlugin write_graphite | |
| <Plugin write_graphite> | |
| <Node "aws1"> | |
| Host "10.61.209.248" | |
| Port "2003" | |
| Protocol "tcp" | |
| # LogSendErrors true | |
| Prefix "collectd." | |
| # Postfix "collectd" | |
| # StoreRates true | |
| # AlwaysAppendDS false | |
| # EscapeCharacter "_" | |
| </Node> | |
| </Plugin> | |
| 3. Start the deamon | |
| service collectd start | |
| Reference | |
| graphite ref: | |
| ------------------------------ | |
| http://graphite.readthedocs.org/en/latest/install.html | |
| https://github.com/obfuscurity/synthesize | |
| install ref: | |
| ------------------------------ | |
| http://centoshowtos.org/monitoring/graphite/ | |
| http://www.ericshalov.com/2014/01/03/how-do-i-install-graphite-on-centos/ | |
| # Graphite Setup for CentOS | |
| https://gist.github.com/inokappa/2be2ad0af6527b6749df | |
| http://blog.mapado.com/graphite-virtualenv-apache-symfony/ | |
| # sqlite.to.mysql.migration.procedure ubuntu | |
| https://gist.github.com/toni-moreno/9779979 | |
| #Graphite_Install.sh | |
| https://gist.github.com/christophior/5509944 | |
| collectd ref: | |
| ------------------------------ | |
| #collectd with Plugin:Write Graphite | |
| https://collectd.org/wiki/index.php/Plugin:Write_Graphite | |
| first version: 5.1 | |
| https://collectd.org/wiki/index.php/First_steps | |
| #install collectd 5.4 on Centos 6.x and make it spit out cool metrics | |
| https://gist.github.com/tnolet/7361441 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment