1. 程式人生 > 實用技巧 >open-falcon+grafana出圖

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/

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

[[email protected] 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/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