美文网首页
graphite 安装

graphite 安装

作者: 凯帝_f319 | 来源:发表于2017-10-27 18:51 被阅读0次

    graphite 组件介绍

    graphite 是一个 指标数据收集系统,一般作为监控系统中 「监控数据收集存储」使用,它有3个组件 Carbon Whisper 和 Graphite-web 这3个组件都是 python pip 安装的,它们三个结合起来就是 graphite 了

    Carbon 用于数据采集

    whisper 用于数据存储

    Graphite-web 用于数据展示(一般会用其他如grafana代替其作为数据展示)

    graphite 安装介绍

    安装graphite官网介绍有四种方式:

    这里介绍使用第二种方式安装(使用pip 安装)

    1、首先需要安装pip工具

        下载安装文件 :wget https://bootstrap.pypa.io/get-pip.py

         执行安装命令:python get-pip.py

    2、pip 安装ok,开始安装whisper

      执行安装命令:pip install --no-binary=:all: https://github.com/graphite-project/whisper/tarball/master

    3、安装 carbon

    pip install --no-binary=:all: https://github.com/graphite-project/carbon/tarball/master

    安装过程中如果出错,可能是相应的model 没有安装,一般会提示libffi 需要安装

    libffi 安装命令:sudo apt-get install libffi-dev

    再次执行 carbon安装命令,ok

    4、安装graphite-web

    pip install --no-binary=:all: https://github.com/graphite-project/graphite-web/tarball/master

    配置

    修改配置文件:把/opt/graphite/conf 下的.example结尾的文件 重命名或者拷贝命名(去掉.example)

    其中/opt/graphite/conf/whitelist.conf是白名单,可以添加类似这样的正则,就让 graphite 只收集 test 和 beauty的数据了

    其中/opt/graphite/conf/storage-schemas.conf是配置存储策略的文件,可以添加类似如下的规则

    设置graphite local_settings.py文件

    /opt/graphite/webapp/graphite/local_settings.py

    修改内容:

    DEBUG = True     #不设置 页面不能正常显示

    TIME_ZONE = 'Asia/Shanghai'  #设置时区

    添加mysql 数据库:

    使用mysql 作为元数据存储的话 需要Python 添加mysql 模块(pip install MySQL-python)

    启动服务

    启动 carbon服务

    cd  /opt/graphite/bin;

    ./carbon-relay.py start

    启动web服务

    /usr/bin/python /opt/graphite/bin/run-graphite-devel-server.py --port=8085 --libs=/opt/graphite/webapp /opt/graphite

    可以通过http://xxx:8085  访问到graphite 页面

       

    遇到过得问题:

    1、服务正常启动后 ,访问graphite 页面是白页,点击dashboard 跳转页面显示 Drop To Merge?

    解决办法:如上文所写 local_settings.py 文件中设置 DEBUG = True 即可解决问题

    2、carbon-cache.py 不能正常启动,

    这个问题找了很久, 最终定位是Python 的 six 模板的问题,pip自动安装了 1.1.0的版本,版本冲突,with_metaclass函数不能执行通过,找到之前安装成功的版本之后。

    解决办法:先卸载six: pip uninstall six, 安装制定版本的six:pip install six==1.10.0

    相关文章

      网友评论

          本文标题:graphite 安装

          本文链接:https://www.haomeiwen.com/subject/vczelxtx.html