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/
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需要下载golang的lib库,有些下不下来,一直无法通过)
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.添加数据源
这是Open-falcon query组件的api配置
"api": {
"query": "http://127.0.0.1:9966",
"dashboard": "http://127.0.0.1:8081",
"max": 500
}
grafana中data-source api地址就写
http://ip:9966/api/grafana
8.新建dashboard
9.建立一个模板
添加完ctrl + S保存
10.添加一个graph
ctrl + S保存
总结:
因为总是不出图,花费了大量时间和精力在Open-falcon上面,以为Open-falcon的query接口有问题
这是grafana-server的报错日志
2016/05/30 16:00:27 [I] Database: sqlite32016/05/30 16:00:27 [I] Migrator: Starting DB migration2016/05/30 16:00:27 [I] Plugins: Scan starting2016/05/30 16:00:27 [I] Plugins: Registering plugin Open-Falcon2016/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 exists2016/05/30 16:00:27 [T] Checking for updates2016/05/30 16:00:27 [I] Plugins: Adding route /public/plugins/fastweb-openfalcon-datasource -> /var/lib/grafana/plugins/grafana-openfalcon-datasource2016/05/30 16:00:27 [I] Listen: http://0.0.0.0:3000
原因是前面所说的path前面没有加;导致
[plugin.openfalcon]
;path = /var/lib/grafana/plugins/fastweb-openfalcon-datasource
感悟:有问题,看日志。