发布于 2015-12-17 01:27:49 | 332 次阅读 | 评论: 0 | 来源: PHPERZ

这里有新鲜出炉的精品教程,程序狗速度看过来!

Graphite 网站实时信息采集和统计

Graphite 是一个用于采集网站实时信息并进行统计的开源项目,可用于采集多种网站服务运行状态信息。Graphite服务平均每分钟有4800次更新操作。实践已经证实要监测网站发发生什么是非常有用的,它的简单文本协议和绘图功能可以方便地即插即 用的方式用于任何需要监控的系统上。


介绍

官方文档:http://graphite.readthedocs.org/en/latest/overview.html

Graphite功能有且只有两个
1:存储时间序列的数据,2:按需根据数据绘制图形,注意收集数据需要自己动手。

安装

环境

Ubuntu12.04:

Linux 3.5.0-23-generic #35~precise1-Ubuntu SMP Fri Jan 25 17:13:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

安装依赖包

sudo apt-get install apache2 libapache2-mod-wsgi python-pip python-cairo
sudo pip install --upgrade django twisted django-tagging pytz

注:最好一个一个安装,确保每个都安装OK

安装Graphite

sudo pip install whisper
sudo pip install carbon
sudo pip install graphite-web

初始化配置

#初始化Graphite配置
cd /opt/graphite/conf/
cp carbon.conf.example carbon.conf
cp storage-schemas.conf.example storage-schemas.conf
cp graphite.wsgi.example graphite.wsgi

#初始化apache配置
cd /opt/graphite/examples/
cp example-graphite-vhost.conf /etc/apache2/sites-available/default

#修改配置
vim /etc/apache2/sites-available/default
20 #WSGISocketPrefix run/wsgi
21 WSGISocketPrefix /var/run/apache2/wsgi

#重新加载配置
sudo /etc/init.d/apache2 reload

#初始化Graphite数据库
cd /opt/graphite/webapp/graphite/
sudo python manage.py syncdb
#期间输入用户名、邮件、密码

chown -R www-data:www-data /opt/graphite/storage/
cp local_settings.py.example local_settings.py
sudo /etc/init.d/apache2 restart

启动Graphite

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

直接在浏览器打开 http://XXX.XXX.XXX.XXX/ 就可以访问Graphite的页面了,初始时数据和图形是空的。

测试Graphite

cd /opt/graphite/examples/
python example-client.py

再打开Graphite页面,进入Metrics就可以看到相应的图表了。

FAQ

清理Metrics

cd /opt/graphite/storage/whisper/
rm -f whichYouWantToClean.wsp

注:如果对接statsd,由于statsd会不停的刷metric,需要先将statsd里面的metric清理掉。



最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务