简介:
是一款开源的监控绘图工具。
Graphite 可以实时收集、存储、显示时间序列类型的数据(time series data)。它主要有三个部分构成:
-
—— 基于 的进程,用来接收数据;
-
—— 专门存储时间序列类型数据的小型数据库;
-
—— 基于 Django 的网页应用程序。
下面主要说明一下graphite的安装:
一、使用pip 安装graphite:
1.安装Graphite所依赖的一些软件:
1)安装系统依赖
yum install cairo-devel.x86_64 fontconfig.x86_64 python-devel libffi-devel.x86_64 mysql-devel.x86_64
2)安装pip:
3)安装graphite依赖的一些python包:
pip install -r requirements.txt
14 15 |
|
2.利用源码安装graphite(源码安装是最新的版本):
graphite默认的安装路径是/opt/graphite:
1)Graphite-web: git clone https://github.com/graphite-project/graphite-web.git
2)Carbon: git clone https://github.com/graphite-project/carbon.git
3)Whisper: git clone https://github.com/graphite-project/whisper.git
4)Ceres: git clone https://github.com/graphite-project/ceres.git
3.安装graphite web:
1)安装配置 nginx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
2)配置uwsgi.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
4.初始化一些目录,数据目录放在/data1/graphite:
1 2 |
|
5.配置文件配置见附件。
二、使用virtualenv安装graphite:
virtualenv是一个python工具. 它可以创建一个独立的python环境. 这样做的好处是你的python程序运行在这个环境里, 不受其它的 python library的版本问题影响. 比如说centos6默认的python版本是2.6,但是现在python2.6在python核心团队已经不再提供支持,想使用python2.7而不影响其他使用python2.6,就用到了virtualenv。对于后期环境的迁移也很方便。
1.首先在centos6.x系统上安装python2.7.x
1)源码安装Python 2.7.x
1 2 3 4 5 6 7 8 |
|
2.创建virtualenv python2.7环境
1)首先使用easy_install安装virtualenv:
1 |
|
2)创建python2.7环境到/opt/graphite(由于graphite默认安装在/opt/graphite,方面后期迁移)
1 |
|
3.安装graphite:
1)进入到virtualenv环境中:
1 2 |
|
2)剩下的安装graphite可按照上述使用pip安装graphite进行操作。
4.启动graphite:
在virtualenv安装的graphite启动时不必每次都进入到虚拟环境中(cd /opt/graphite && source ./bin/activate)
只需要使用虚拟环境中的python即可,然后它会找到这个python的所有依赖。
1 2 3 |
|
5.环境迁移
以后需要重新创建同样配置的graphite,只需要在新机器上安装上基础环境和virtualenv即可。
然后把原来的创建的虚拟环境/opt/graphite copy过来,修改配置文件即可上线使用。
三、使用monit进行监控:
monit是一个用于监视进程、文件、目录和设备等,可以修复停止运作或运作异常的程序,适合处理那些由于多种原因导致的软件错误,用于自动重新启动服务并发送报警。
例如:
1 2 3 4 |
|