open-falcon+grafana出图

 

 

 

Open-falcon方文档:

http://book.open-falcon.org/zh/index.html

Granafa官方文档

grafana安装:https://grafana.net/plugins/fastweb-openfalcon-datasource

open-falcon插件:https://grafana.net/plugins/fastweb-openfalcon-datasource/installation

 

                                                                                                                                                                    

1.open-falcon的安装就不叙述了,官方文档很详细

访问dashboard 出图http://192.168.29.128:8081/

wKioL1dOXDuBDMVIAABFE23B82g811.png


 

 

2.grafana安装

wget https://grafanarel.s3.amazonaws.com/builds/grafana-3.0.4-1464167696.x86_64.rpm

rpm -ivh grafana-3.0.4-1464167696.x86_64.rpm

(grafana编译似乎不太好使,godep store需要下载golanglib库,有些下不下来,一直无法通过)

 

3.通过grafana-cli安装Open-falcon插件

grafana-cli plugins install fastweb-openfalcon-datasource

 

4.编辑grafana.ini配置文件,添加插件PATH

[plugin.openfalcon]

;path = /var/lib/grafana/plugins/fastweb-openfalcon-datasource

(path前面;一定要有,一开始没加,坑爹了很久)

 

5.启动grafana

[root@linux plugins]#/etc/init.d/grafana-server restart

OKopping GrafanaServer ...                               [  OK  ]

Starting Grafana Server: .... OK

 

6.浏览器访问http://ip:3000

 

 

 

7.添加数据源

wKioL1dOXKSydj8UAAAyJgIqSQA157.png

wKioL1dOXLCS4WW5AABT5k3uaxk860.png

wKiom1dOW8DQs9svAACYDZ2Xq_g857.png

 

这是Open-falcon query组件的api配置

    "api": {

        "query": "http://127.0.0.1:9966",

        "dashboard": "http://127.0.0.1:8081",

        "max": 500

 }


grafanadata-source  api地址就写

http://ip:9966/api/grafana

 

8.新建dashboard

wKiom1dOW92ziXWLAABI9gYu2t8142.png

9.建立一个模板

wKiom1dOXAHC63VGAAAjFmO6i3g110.png

 

wKioL1dOXRqjaM2gAAAlxSlI4C0091.png

wKioL1dOXULRm17IAADVu1onWfU328.png

添加完ctrl + S保存

 

10.添加一个graph

wKiom1dOXGWyssfCAAEG1r5cpuA883.png

wKiom1dOXICxo6wkAADVSg37j1g408.png

ctrl + S保存

 

 

 

总结:

因为总是不出图,花费了大量时间和精力在Open-falcon上面,以为Open-falconquery接口有问题

 

这是grafana-server的报错日志

2016/05/30 16:00:27 [I] Database: sqlite3
2016/05/30 16:00:27 [I] Migrator: Starting DB migration
2016/05/30 16:00:27 [I] Plugins: Scan starting
2016/05/30 16:00:27 [I] Plugins: Registering plugin Open-Falcon
2016/05/30 16:00:27 [plugins.go:127 walker()] [E] Plugins: Failed to load plugin json file: /var/lib/grafana/plugins/grafana-openfalcon-datasource/plugin.json,  err: Plugin with same id already exists
2016/05/30 16:00:27 [T] Checking for updates
2016/05/30 16:00:27 [I] Plugins: Adding route /public/plugins/fastweb-openfalcon-datasource -> /var/lib/grafana/plugins/grafana-openfalcon-datasource
2016/05/30 16:00:27 [I] Listen:  http://0.0.0.0:3000

 

原因是前面所说的path前面没有加;导致

[plugin.openfalcon]

;path = /var/lib/grafana/plugins/fastweb-openfalcon-datasource

 

感悟:有问题,看日志。