转自:http://blog.csdn.net/wangli61289/article/details/45077795
Graphite是一个Django的项目,所以必须有基础的Python环境,并推荐使用pip作为Python模块的管理工具,我这里安装的Python版本是Python2.7.6。
按照Graphite官网(http://graphite.wikidot.com/installation)安装graphite依赖,特别强调Django的安装版本是Django1.5.x(1.6以上版本会有一些模块变更,导致不兼容)
1.安装graphite依赖
- yum install -y pycairo,mod_python,python-ldap,python-memcached,python-sqlite2,bitmap,bitmap-fonts,python-devel,mod_wsgi
- pip install Django==1.5.1
- pip install django-tagging
- pip install twisted
还有一个需要注意的地方就是默认安装的Twisted在这里不兼容,会导致报出:ImportError: cannot import name daemonize 这样的错误,而要解决这个问题,需要做的就是修正一下版本:
pip uninstall Twisted
pip install "Twisted<12.0"
可以使用pip freeze查看安装列表
2.安装Graphite的三个主要组件
2.1.安装whisper
- tar -zxvf whisper-0.9.12.tar.gz
- cd whisper-0.9.12
- python setup.py install
Whisper 脚本现在应该在应有的位置上:
- [root@VMS04798 graphite]# ls -l /usr/bin/whisper*
- -rwxr-xr-x 1 root root 1658 Apr 13 14:48 /usr/bin/whisper-create.py
- -rwxr-xr-x 1 root root 2902 Apr 13 14:48 /usr/bin/whisper-dump.py
- -rwxr-xr-x 1 root root 1780 Apr 13 14:48 /usr/bin/whisper-fetch.py
- -rwxr-xr-x 1 root root 1071 Apr 13 14:48 /usr/bin/whisper-info.py
- -rwxr-xr-x 1 root root 675 Apr 13 14:48 /usr/bin/whisper-merge.py
- -rwxr-xr-x 1 root root 5984 Apr 13 14:48 /usr/bin/whisper-resize.py
- -rwxr-xr-x 1 root root 919 Apr 13 14:48 /usr/bin/whisper-set-aggregation-method.py
- -rwxr-xr-x 1 root root 970 Apr 13 14:48 /usr/bin/whisper-update.py
2.2.安装carbon
- tar -zxvf carbon-0.9.12.tar.gz
- cd carbon-0.9.12
- python setup.py install
/opt/graphite 现在应该有carbon的lib 包和配置文件:
- [root@VMS04798 graphite]# ls -l /opt/graphite
- total 48
- drwxr-xr-x 2 apache apache 4096 Apr 13 14:48 bin
- drwxrwxrwx 2 apache apache 4096 Apr 15 18:34 conf
- drwxr-xr-x 2 apache apache 4096 Apr 13 15:40 examples
- drwxr-xr-x 4 apache apache 4096 Apr 13 14:47 lib
- drwxr-xr-x 6 apache apache 4096 Apr 15 16:19 storage
2.3.安装graphite-web
- tar -zxvf graphite-web-0.9.12.tar.gz
- cd graphite-web-0.9.12
- python check-dependencies.py
- python setup.py install
修改配置:
- cp graphite.wsgi.example graphite.wsgi
- cd /opt/graphite/webapp/graphite
- cp local_settings.py.example local_settings.py
编辑local_settings.py,务必重新设置SECRET_KEY,根据需要调整TIME_ZONE(TIME_ZONE='Asia/Shanghai')和其它参数。
3.启动一个Carbon进程
Carbon安装自带了默认的端口和很多其他的配置文件,拷贝已经存在的示例文件。
- cd /opt/graphite/conf
- cp carbon.conf.example carbon.conf
- cp storage-schemas.conf.example storage-schemas.conf
- cp storage-aggregation.conf.example storage-aggregation.conf
编辑carbon.conf,并添加以下内容:
- $ vim /opt/graphite/conf/carbon.conf
- [cache]
- LINE_RECEIVER_INTERFACE = 0.0.0.0
- LINE_RECEIVER_PORT = 2003
- PICKLE_RECEIVER_INTERFACE = 0.0.0.0
- PICKLE_RECEIVER_PORT = 2004
- CACHE_QUERY_INTERFACE = 0.0.0.0
- CACHE_QUERY_PORT = 7002
编辑storage-schemas,并添加以下内容:
- vim storage-schemas.conf
- [system_1min]
- pattern = ^system\..*
- priority = 100
- retentions = 60s:31d,5m:90d
编辑storage-aggregation.conf,并添加以下内容:
- vim storage-aggregation.conf
- [system_1min]
- pattern = ^system\..*
- xFilesFactor = 0.5
- aggregationMethod = sum
如果我们的Whisper文件xFilesFactor值是0.5,这意味着仅仅只有至少50%数据点被呈现的时候,它才将聚集数据点。如果超过50%数据点是null,Whisper将创建一个null聚合。在我们的示例中(60s=1m)5m/1m=5也即至少有3个点才开始聚合,因为3/5=0.6才满足xFilesFactor=0.5的聚合条件。你可以给xFilesFactor设置0-1之间的任何值。0表明了即使只有一个数据点非空,聚合就应该被完成。1 表明了只有所有的数据非空,集合才能完成。
4.制造一些测试数据
- cd /opt/graphite/bin
- ./carbon-cache.py start
- cd /opt/graphite/examples
- python example-client.py
最后,你可以检索关于 Whisper 文件的元数据信息,使用 whisper-info 脚本:
- [root@VMS04798 examples]# whisper-info.py /opt/graphite/storage/whisper/system/loadavg_1min.wsp
- maxRetention: 604800
- xFilesFactor: 0.5
- aggregationMethod: sum
- fileSize: 120988
- Archive 0
- retention: 604800
- secondsPerPoint: 60
- points: 10080
- size: 120960
- offset: 28
whisper-dump脚本是一个更完整的脚本,其可以输出所有存储保留时期的原始数据以及关于 Whisper 文件的元数据信息:
- [root@VMS04798 examples]#whisper-dump.py /opt/graphite/storage/whisper/system/loadavg_1min.wsp
- Meta data:
- aggregation method: sum
- max retention: 86400
- xFilesFactor: 0.5
- Archive 0 info:
- offset: 28
- seconds per point: 60
- points: 1440
- retention: 86400
- size: 17280
- Archive 0 data:
- 0: 1400609220, 1
- 1: 0, 0
- 2: 0, 0
- 3: 0, 0
- 4: 0, 0
- 5: 0, 0
- ...
- 1437: 0, 0
- 1438: 0, 0
- 1439: 0, 0
如果Metrics与storage-aggregation.conf中的pattern没有匹配上,默认的aggregation方法是average,xFilesFactor=0.5
5.安装nginx与uwsgi
graphite-web是基于django开发的
5.1 nginx安装
- tar -zxvf nginx-1.2.8.tar.gz
- cd nginx-1.2.8
- ./configure --prefix=/usr/local/nginx
- make
- make install
5.2 uwsgi安装
- pip install uwsgi
配置uwsgi:
- /opt/graphite/webapp
- vim graphite.ini
uWSGI的配置如下:
- [uwsgi]
- post-buffering = 32768
- buffer-size = 32768
- chdir=/opt/graphite/conf/
- module=graphite.wsgi
- master=true
- pidfile=/tmp/graphite.pid
- vacuum=true
- max-requests=10000
- daemonize=/var/log/graphite/access_graphite.log
- processes=15
- socket=127.0.0.1:49156
- stats=127.0.0.1:1716
- listen=1024
配置Nginx:
- cd /usr/local/nginx/conf/sites-enabled
- vim graphite.conf
以下是Nginx虚拟主机的配置
- server {
- listen 8080;
- server_name 127.0.0.1
- charset utf-8;
- access_log /var/log/nginx/graphite.access.log;
- error_log /var/log/nginx/graphite.error.log;
- location / {
- include uwsgi_params;
- uwsgi_pass 127.0.0.1:49156;
- }
- }
7.启动graphite
至此所有全部搞定,先开carbon,再开uwsgi,最后nginx。
- /opt/graphite/bin/carbon-cache.py start
- /opt/graphite/webapp
- uwsgi graphite.ini
- /usr/local/nginx/sbin/nginx
打开浏览器,输入http://ip:8080就能看到效果了。
参考文档:
http://segmentfault.com/a/1190000002533877
http://segmentfault.com/a/1190000002573509
相关推荐
graphite安装依赖组件
graphite_exporter-0.12.0.linux-amd64.tar.gz
离线安装包,亲测可用
docker-graphite, 在 Docker 图像中,Graphite + 碳 Graphite + 碳运行 Graphite 和碳缓存的all-in-one映像。 版本: 0.9.12.这里映像包含 Graphite 和碳缓存的默认默认配置。 启动这里容器将默认绑定下列主机端口:...
graphite-project.github.io, Graphite 项目的未来网站 Graphite安装bundle install 或者'gem 安装 scss_lint github页面"'npm install正在运行/开发运行Grunt任务并启动osm服务器grunt serve建筑grunt
docker-graphite-statsd, 用于 Graphite & Statsd的Docker 图像 用于 Graphite & Statsd的 Docker 映像立即运行 Graphite & StatsdGraphite & Statsd可能对安装程序很复杂。 这个映像将在几分钟内运行&
InfluxDB(influxdb2-2.1.1-linux-amd64.tar.gz)适用于Linux x86_64系统。 InfluxDB 是一个开源的时间序列数据库,能应付极高的写和查询并发数,主要用于存储大规模的时间戳数据(每条记录自动附加时间戳),如 ...
赠送jar包:metrics-graphite-3.1.5.jar; 赠送原API文档:metrics-graphite-3.1.5-javadoc.jar; 赠送源代码:metrics-graphite-3.1.5-sources.jar; 赠送Maven依赖信息文件:metrics-graphite-3.1.5.pom; 包含...
在Kubernetes集群上运行的石墨基础设施以及来自节点的运输指标
Monitoring with Graphite 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书
graphite-api, Graphite的ruby API工具包 描述使用收费 GraphiteAPI,可以提供两种方式与 Graphite 守护进程交互,第一种方法是使用收费的GraphiteAPI::Client 守护进程,第二个方法实现 Graphite 纯文本协议,这两...
graphite-api-experiment, 实验 Graphite api服务器玩具项目不用于生产 石墨Golang中新一代 Graphite API服务器的实验版本,利用of并发构造的效率。目标是:速度,易于部署&优雅代码。此外,重写允许从根本上重新...
Monitoring with Graphite 英文azw3 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
Graphite是计算机图形学,3D建模,数值几何的研究平台。可以用它处理obj文件,对齐进行渲染,修改等操作。
赠送jar包:metrics-graphite-3.1.5.jar; 赠送原API文档:metrics-graphite-3.1.5-javadoc.jar; 赠送源代码:metrics-graphite-3.1.5-sources.jar; 赠送Maven依赖信息文件:metrics-graphite-3.1.5.pom; 包含...
20 亿指标,知乎 Graphite 极致优化
压缩包中包含了在linux上安装graphite软件需要的一些依赖包。
在网上找了很久,没有一篇很完整很清晰地介绍Statsd+Graphite搭建监控平台,正好边摸索边尝试边写下来,方便大家。 (Notice: 一开始我是在macOs Sierra下安装, 后来在Ubuntu上也安装)
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
安装和配置Graphite。 本菜谱中的大部分工作反映了和所做的工作。 要求 平台类 亚马逊Linux 2013.03 CentOS的6 红帽6 Ubuntu 11.10(Oneiric) Ubuntu 12.04(精确) 食谱 apache2 必要的 对数旋转 Python ...