graphite 監控---安裝

1.graphite簡介:
python

Graphite 是一個數據繪圖工具,安裝完成以後須要餵它數據,就能夠根據你的須要將數據生成制定的格式(繪圖、json、xml等),還能夠和Nagios結合完成報警功能。具體的數據採集工具是由第三方工具完成。ios


2.graphite 安裝:c++

2.1 經過yum安裝所須要的開發包: web


yum install -y gcc zlib-devel curl curl-devel openssl rpm-build gcc-c++ rpm-build python python-ldap python-memcached python-sqlite2 pycairo python-twisted Django django-tagging bitmap bitmap-fonts python-devel glibc-devel gcc-c++ openssl-devel python-zope-interface httpd memcached mod_wsgi
2.2 下載graphite、carbon並進行安裝:


cd
mkdir rpmbuild
mkdir rpmbuild/SOURCES
cd ~/rpmbuild/SOURCES
wget http://launchpad.net/graphite/0.9/0.9.9/+download/whisper-0.9.9.tar.gz
wget http://launchpad.net/graphite/0.9/0.9.9/+download/carbon-0.9.9.tar.gz
wget http://launchpad.net/graphite/0.9/0.9.9/+download/graphite-web-0.9.9.tar.gz
cp carbon-0.9.9.tar.gz carbon-0.9.9.tar.gz.orig
cp graphite-web-0.9.9.tar.gz graphite-web-0.9.9.tar.gz.orig
cp whisper-0.9.9.tar.gz whisper-0.9.9.tar.gz.orig
cd ~/rpmbuild/SOURCES/
tar -zxvf whisper-0.9.9.tar.gz
cd whisper-0.9.9
python setup.py bdist_rpm
rpm -ivh dist/whisper-0.9.9-1.src.rpm
cd ..
cp whisper-0.9.9.tar.gz.orig whisper-0.9.9.tar.gz
cd ../SPECS/
rpmbuild -ba whisper.spec
sudo yum --nogpgcheck localinstall -y ../RPMS/noarch/whisper-0.9.9-1.noarch.rpm
cd ~/rpmbuild/SOURCES/
tar -zxvf graphite-web-0.9.9.tar.gz
cd graphite-web-0.9.9
python setup.py bdist_rpm
rpm -ivh dist/graphite-web-0.9.9-1.src.rpm
cd ../
cp graphite-web-0.9.9.tar.gz.orig graphite-web-0.9.9.tar.gz
cd ../SPECS/
rpmbuild -ba graphite-web.spec
sudo yum --nogpgcheck localinstall -y ../RPMS/noarch/graphite-web-0.9.9-1.noarch.rpm
cd ~/rpmbuild/SOURCES/
tar -zxvf carbon-0.9.9.tar.gz
cd carbon-0.9.9
python setup.py bdist_rpm
rpm -ivh dist/carbon-0.9.9-1.src.rpm
cd ..
cp carbon-0.9.9.tar.gz.orig carbon-0.9.9.tar.gz
cd ../SPECS/
rpmbuild -ba carbon.spec
sudo yum --nogpgcheck localinstall -y ../RPMS/noarch/carbon-0.9.9-1.noarch.rpm

2.3 配置graphite: sql

cd /opt/graphite/conf/
sudo cp graphite.wsgi.example graphite.wsgi
sudo cp storage-schemas.conf.example storage-schemas.conf
sudo cp carbon.conf.example carbon.conf
cd ../webapp/graphite
sudo cp local_settings.py.example local_settings.py
sudo vim local_settings.py
IME_ZONE = 'Asia/Shanghai'
MEMCACHE_HOSTS = ['127.0.0.1:11211']  #memcached 服務器
sudo python /opt/graphite/webapp/graphite/manage.py syncdb  #初始化數據庫


3.配置Apache並設置權限數據庫

3.1 配置Apache 並設置權限: apache

chown -R apache:apache /opt/graphite/storage/
vim /etc/httpd/conf.d/wsgi.conf  #配置虛擬主機
LoadModule wsgi_module modules/mod_wsgi.so
WSGISocketPrefix /var/run/wsgi
NameVirtualHost *:80
<VirtualHost *:80>
        ServerName localhost
        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/
        <Location "/content/">
                SetHandler None
        </Location>
        # 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/"
        <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>
                                                          

4. 啓動服務django

service memcached start
/opt/graphite/bin/carbon-cache.py start
service httpd start


5.測試效果:json

173707844.png

相關文章
相關標籤/搜索