grafana graphite statsd搭建安装部署 实时监控_亲测成功

grafana graphite statsd搭建安装部署 实时监控_亲测成功

docker部署grafana graphite stastd实时监控告警配置_亲测成功

下载软件

# 下载carbon: https://pypi.python.org/pypi/carbon
wget --no-check-certificate https://pypi.python.org/packages/66/ad/7c5fe8471676d45fd80a05c1b7282fb9273b3a3067d2087df8168718349f/carbon-0.9.15.tar.gz#md5=66c9fd95e13a83bcd4eed258ab04a76a

#下载whisper: https://pypi.python.org/pypi/whisper
wget --no-check-certificate https://pypi.python.org/packages/b2/ad/93dad36f94a11e465b260aaf19dfd77bff62c62bfab438c67265b010a137/whisper-0.9.15.tar.gz#md5=8747dfc8c53182db95e5af5c766c5350

#下载graphite-web: https://pypi.python.org/pypi/graphite-web
wget --no-check-certificate https://pypi.python.org/packages/b6/f3/7e4bae02f1a21cc29e9e9205bbc01aa29cdc6c696a996d41c1143e8935e3/graphite-web-0.9.15.tar.gz#md5=f4e80ba810fa83f57a62a2b8dd4e3545

#下载statsd: https://github.com/etsy/statsd
wget --no-check-certificate https://codeload.github.com/etsy/statsd/zip/master
mv master statsd.zip

#下载grafana: http://grafana.org/download/
wget https://grafanarel.s3.amazonaws.com/builds/grafana-4.0.1-1480694114.linux-x64.tar.gz

安装基本依赖

yum install -y epel-release

yum install -y gcc Django14 cairo python-pip python-django-tagging pycairo python-gunicorn python-devel supervisor nodejs pytz bitmap-fonts-compat

pip install twisted==15.4.0

安装组件

tar -zxvf carbon-0.9.15.tar.gz
cd carbon-0.9.15/
python setup.py install

cd ..
tar -zxvf whisper-0.9.15.tar.gz
cd whisper-0.9.15/
python setup.py install

cd ..
tar -zxvf graphite-web-0.9.15.tar.gz
cd graphite-web-0.9.15/
python setup.py install

创建配置文件

cd /opt/graphite/conf/
cp carbon.conf.example carbon.conf
cp storage-aggregation.conf.example storage-aggregation.conf
cp storage-schemas.conf.example storage-schemas.conf

初始化数据库

cd /opt/graphite/webapp/
chmod 755 graphite/*.py
chmod 755 graphite/*.pyc
graphite/manage.py syncdb
在此期间可以选择是否创建用户名、密码、邮箱)

启动carbon

cd /opt/graphite/bin/
nohup ./carbon-cache.py start &

启动graphite-web

cd /opt/graphite/webapp
nohup /usr/bin/gunicorn_django -b0.0.0.0:8000 -w2 /opt/graphite/webapp/graphite/settings.py &

测试

#浏览器输入地址访问    
http://192.168.1.8:8000/    

#发送一条数据后,查看页面
echo "liang.test.metrics 10112 `date +%s`" | nc localhost 2003
yum -y install nc

修改存储模式

cd /opt/graphite/conf
vim storage-schemas.conf

retentions = 10s:6h,60s:1d,10m:7d
#最开始carbon以每10秒一次的速度记录应用和业务指标项。这种10秒一次的数据会保存6小时。6小时后,这些数据将被聚合为1分钟数据并保存1天。最后,1天之后,这些数据将被聚合为10分钟数据并再保存7天。

安装并集成StatsD

cd /opt/
unzip statsd.zip
mv statsd-master statsd
cd /opt/statsd/
cp exampleConfig.js config.js
vim config.js

{
    
    
  graphitePort: 2003
, graphiteHost: "127.0.0.1"
, port: 8125
, flushInterval: 10000
, backends: [ "./backends/graphite" ]
, graphite: {
    
    
     legacyNamespace: false
  }
}

#启动
nohup node /opt/statsd/stats.js /opt/statsd/config.js &


#测试
echo "liang.test.access.ip:1|c" | nc -u -w1 127.0.0.1 8125

安装并集成grafana

tar -zxvf grafana-4.0.1-1480694114.linux-x64.tar.gz
cd grafana-4.0.1-1480694114/
cp conf/sample.ini conf/custom.ini

#启动
nohup ./bin/grafana-server &


Grafana 使用
http://192.168.1.8:3000/

猜你喜欢

转载自blog.csdn.net/yinjl123456/article/details/128136821