分类: LINUX
2014-04-20 17:50:48
:# cat /etc/redhat-release
CentOS release 6.4 (Final)
除了CentOS源base、updates、extra之外,再添加两个源:epel和rpmforge。
wget
wget
依赖包相当多,争取一次搞定。
点击(此处)折叠或打开
这里还是做一下简单说明:cairo是graphite的绘图库,是必须的软件。
Graphite组件包括三个部分:carbon、whisper和graphite-web。
安装
pip install carbon
pip install whisper
pip install graphite-web
pip install daemonize
创建 Graphite 的虚拟主机配置:/etc/httpd/conf.d/graphite.conf,创建方法如下:
vi /etc/httpd/conf.d/graphite.conf
点击(此处)折叠或打开
运行以下命令创建数据库:
1
2
|
python /opt/graphite/webapp/graphite/manage.py syncdb
chown -R hd:hd /opt/graphite/storage/
|
hd是我自己定义的httpd服务运行的用户和组。
启动httpd服务:
1
|
service httpd start
|
启动carbon-cache程序:
1
|
/opt/graphite/bin/carbon-cache.py start
|
启动会报错,解决方案如下:
[root@d1 conf]# /opt/graphite/bin/carbon-cache.py start
/usr/lib64/python2.6/site-packages/zope/__init__.py:3: UserWarning: Module twisted was already imported from /usr/lib64/python2.6/site-packages/twisted/__init__.pyc, but /opt/graphite/lib is being added to sys.path
import pkg_resources
Traceback (most recent call last):
File "/opt/graphite/bin/carbon-cache.py", line 29, in
from carbon.util import run_twistd_plugin
File "/opt/graphite/lib/carbon/util.py", line 21, in
from twisted.scripts._twistd_unix import daemonize
ImportError: cannot import name daemonize
[root@d1 conf]# pip install daemonize
Downloading/unpacking daemonize
Downloading daemonize-2.2.3.tar.gz
Running setup.py egg_info for package daemonize
Installing collected packages: daemonize
Running setup.py install for daemonize
Successfully installed daemonize
Cleaning up...
[root@d1 conf]# vi /opt/graphite/lib/carbon/util.py
改from twisted.scripts._twistd_unix import daemonize
变成
import daemonize
[root@d1 conf]# /opt/graphite/bin/carbon-cache.py start
/usr/lib64/python2.6/site-packages/zope/__init__.py:3: UserWarning: Module twisted was already imported from /usr/lib64/python2.6/site-packages/twisted/__init__.pyc, but /opt/graphite/lib is being added to sys.path
import pkg_resources
Starting carbon-cache (instance a)
至此ok,# ps -ef |grep car
root 31273 1 0 17:41 ? 00:00:00 /usr/bin/python /opt/graphite/bin/carbon-cache.py start
root 31327 19915 0 17:49 pts/0 00:00:00 grep car
安装已经完成。在浏览器中使用,使用安装graphite的主机的ip代替。可以访问即可以肯定的告诉你CentOS 6.4安装Graphite成功了。
运行graphite-web安装包内的examples/example-client.py可以喂数据给graphite:
1
|
python example-client.py
|