Graphite在centeros 6下安装

本文详细介绍了在CentOS 6.4系统环境下安装Graphite的过程,并提供了安装步骤、配置方法以及如何通过Graphite Web界面进行数据监控的实践操作。包括依赖包的安装、Graphite的安装与配置、配置mod_wsgi模块、数据库创建和启动服务等关键步骤,同时提供了常见问题解答。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

这段时间,一直在学习Graphite,做一个阶段性总结。

在centos 6.4系统下安装Graphite。

1.在官网中下载安装文件:

链接:https://launchpad.net/graphite/+download/

下载文件:carbon-0.9.10-pre3.tar.gz

     graphite-web-0.9.10-pre4.tar.gz

     whisper-0.9.10-pre3.tar.gz

     check-dependencies.py

 

2.安装依赖包

yum install -y bitmap bitmap-fonts-compat Django django-tagging fontconfig cairo python-devel python-memcached python-twisted  pycairo mod_python python-ldap python-simplejson memcached python-zope-interface mod_wsgi python-sqlite2

后面一些软件的安装可能会用到git:

yum install -y git

 

3.安装Graphite

首先解压安装包: tar xf carbon-0.9.10-pre3.tar.gz

        tar xf graphite-web-0.9.10-pre4.tar.gz

        tar xf whisper-0.9.10-pre3.tar.gz

然后进入相应目录,执行setup.py:

        cd carbon-0.9.10-pre3

        python setup.py install

        cd ..

        cd graphite-web-0.9.10-pre4

        python setup.py install

        cd ..

        cd whisper-0.9.10-pre3

        python setup.py install

graphite默认安装在opt/graphite文件夹下。

 

4.配置Graphite

首先,确认本机上安装apache。

若未安装,执行 yum install httpd

创建graphite虚拟主机配置:

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>

配置mod_wsgi模块

在  /etc/httpd/conf.d/wsgi.conf文件中添加以下两行:

LoadModule wsgi_module  modules/mod_wsgi.so

WSGISocketPrefix /var/run/wsgi

配置Graphite:

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

运行以下命令创建数据库:

cd /opt/graphite/webapp/graphite/

python manage.py syncdb

chown -R apache:apache /opt/graphite/

 

5.启动

service httpd start

/opt/graphite/bin/carbon-cache.py start

在浏览器中使用http://ip:8080

 

6.实验

运行graphite-web安装包内的examples/example-client.py可以喂数据给graphite:

python example-client.py

对应在浏览器窗口中的显示为在system目录下,loadavg_15min、loadavg_5min、loadavg_1min这三条线就是example-client.py的数据产生的图形。

 

7.FAQ

我在安装过程中,出现了未安装django的问题:

Traceback (most recent call last): File "manage.py", line 2, in <module> from django.core.management import execute_manager ImportError: No module named django.core.management

提示没有django,手动yum install Django后提示

No package Django available.

遇到这种情况,请手动下载django安装包。

django-tagging可能也会遇到这样的问题,也用这种方法。

 

在这里分享一个链接,里面是常用的包:http://pan.baidu.com/s/1pJHlzBl

转载于:https://www.cnblogs.com/xinma/p/4152685.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值