open-falcon+grafana出圖
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
[[email protected] 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/3016:00:27[I]Database:sqlite3
2016/05/3016:00:27[I]Migrator:StartingDBmigration
2016/05/3016:00:27[I]Plugins:Scanstarting
2016/05/3016:00:27[I]Plugins:RegisteringpluginOpen-Falcon
2016/05/3016:00:27[plugins.go:127walker()][E]Plugins:Failedtoloadpluginjsonfile:/var/lib/grafana/plugins/grafana-openfalcon-datasource/plugin.json,err:Pluginwithsameidalreadyexists
2016/05/3016:00:27[T]Checkingforupdates
2016/05/3016:00:27[I]Plugins:Addingroute/public/plugins/fastweb-openfalcon-datasource->/var/lib/grafana/plugins/grafana-openfalcon-datasource
2016/05/3016:00:27[I]Listen: http://0.0.0.0:3000
原因是前面所說的path前面沒有加;導致
[plugin.openfalcon]
;path = /var/lib/grafana/plugins/fastweb-openfalcon-datasource
感悟:有問題,看日誌。
轉載於:https://blog.51cto.com/gongxiaoyi/1785108