open-falcon (六):插件grafana

2018-02-06 17:47:00
aolens
原创
954

插件地址:


https://grafana.com/plugins/fastweb-openfalcon-datasource


安装:
https://github.com/grafana/grafana
构建后端
export GOPATH=/home/falcon
cd $GOPATH/src/github.com/open-falcon/
git clone https://github.com/grafana/grafana
mkdir $GOPATH/src/github.com/grafana -p
ln -sv /home/falcon/src/github.com/open-falcon/grafana /home/falcon/src/github.com/grafana/
报错:执行go run build.go setup报错
pkg/cmd/grafana-server/server.go:4:2: cannot find package "context" in any of:
/home/falcon/src/github.com/grafana/grafana/vendor/context (vendor tree)
/usr/lib/golang/src/context (from $GOROOT)
/home/falcon/src/context (from $GOPATH)
cp -rf vendor/golang.org/x/net/context vendor/
go run build.go setup
go run build.go build
构建前端
yum install npm -y
npm install
npm install -g grunt-cli
grunt

安装插件

#第二种安装方式:
进入docker open-falcon容器中
https://grafana.com/grafana/download 下载版本4.2
wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.2.0-1.x86_64.rpm
yum localinstall grafana-4.2.0-1.x86_64.rpm 
(编译非常不好使)
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

检出插件:

grafana-cli plugins install fastweb-openfalcon-datasource
cp -rf /var/lib/grafana/plugins/fastweb-openfalcon-datasource /usr/share/grafana/public/app/plugins/datasource/


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

[plugin.openfalcon]
;path = /var/lib/grafana/plugins/fastweb-openfalcon-datasource
(path前面;一定要有)


启动grafana :
service grafana-server start
chkconfig grafana-server on

保存docker镜像,并添加重启
docker commit 2e614e724266 openfalcon/grafana
docker run -itd -p 9081:8081 -p 8433:8433 -p 3000:3000 openfalcon/grafana bash /run.sh hbs

访问:
浏览器访问http://ip:3000
默认账号密码admin/admin
不要先用注册账号登录,权限不足,进去给注册账号权限
选择data source 添加data source
config:
name:open-falcon
Type:Open-falcon #如果前边插件安装有问题,则不会显示之下的http settings段落
Http settings:
Url:http://127.0.0.1:8080/api/v1/grafana #2.0版本的地址,1.0使用query地址:http://ip:9966/api/grafana