Skip to content

Graphite Windows

Calvin Xiao edited this page Jan 13, 2014 · 3 revisions

##Install Graphite 0.9.12 on Windows

Reference

1.1 手工下载安装

1.2 pip 安装

  • pip install zope.interface
  • pip install Django==1.5 (暂时不要装最新版)
  • pip install django-tagging
  • pip install pytz
  • pip install whisper
  • pip install carbon --install-option="--prefix=c:\python27\graphite" --install-option="--install-lib=c:\python27\graphite\lib"
  • pip install graphite-web --install-option="--prefix=c:\python27\graphite" --install-option="--install-lib=c:\python27\graphite\webapp"

1.3 后处理

1.配置文件
C:\Python27\graphite\conf 下的storage-schemas.conf.example 和 carbon.conf.example去掉example,
C:\Python27\graphite\webapp\graphite下的local_settings.py.example 去掉example.

2.修改carbon代码,以支持windows
参考了 https://github.com/stephanstapel/carbon ,在springside上做了个更简单的fork https://github.com/springside/carbon/ 修改后的版本,损失了自动记录carbon占用CPU的能力。 可以参考提交记录自行修改,也可以下载下来(版本是0.9.13-SNAPSHOT,不会同步更新),将C:\Python27\graphite\lib\carbon 和 C:\Python27\graphite\examples的内容直接覆盖掉。

3.修改graphite-web 代码,以支持windows
在0.9.12版本上的修改如下:

  • 修改webapp\graphite\thirparty\pytz_init.py 在92行给tz_path赋值 tz_path = 'C:\Python27\Lib\site-packages\pytz\zoneinfo'
  • 修改webapp\graphite\storage.py 在153行metric_path = relative_path.replace('/','.')后面加一行metric_path = metric_path.replace('\','.')

在最新版,修改的是finders.py的fs_to_metric()函数

4.初始化用户
c:\Python27\graphite\webapp\graphite>python manage.py syncdb 输入登录用户名,如root/rootroot,保存在内置的sqllite数据库里。

1.4 启动

  • 启动Carbon: C:\Python27\graphite\Scripts\carbon-cache.py start
  • 启动Web: django-admin.py runserver --pythonpath C:\Python27\graphite\webapp --settings graphite.settings 0.0.0.0:8080
  • 启动example-client:C:\Python27\graphite\examples\example-client.py ,真正定时取得CPU数据。

1.5 查看