Grafana监控可视化环境搭建

依赖库Go 1.6
NodeJS v4+
sqlite3
GO 环境搭建

vi /etc/profile
export GOPATH="/root/go"
export GOROOT="/usr/local/go"
export PATH=$GOROOT/bin:$PATH
export PATH=$GOPATH/bin:$PATH


NodeJS 环境搭建
从https://nodejs.org/en/下载node源码包

cd /usr/local
tar -zxvf node-v4.5.0-linux-x64.tar
chmod -R 755 node
vi /etc/profileexport NODE=/usr/local/node
export PATH=${NODE}/bin:$PATH


编译安装前准备
创建$GOPATH/src/github.com/grafana/grafana目录,然后git最新的代码到此目录.

mkdir $GOPATH/src/github.com/grafana/grafana

编译后端源码步骤

cd $GOPATH/src/github.com/grafana/grafana
go run build.go setup
go run build.go build

编译前端源码步骤

cd $GOPATH/src/github.com/grafana/grafana
npm install --registry=http://registry.npm.taobao.org
npm install -g grunt-cli --registry=http://registry.npm.taobao.org
grunt


运行

./bin/grafana-server

打开浏览器 (默认http://localhost:3000 匿名方式登录<部分功能存在权限限制>)
打开登陆页面 (默认http://localhost:3000/login 用户名/密码 = admin/admin 功能没有权限限制).
配置
启动项配置
在/etc/grafana/目录:

grafana.ini
dev.ini (if found)
custom.ini

基本权限配置
在/usr/share/grafana/conf
defaults.ini 2.sample.ini
程序发布各平台安装包
发布安装包依赖FPM工具.
####安装GEM

sudo apt-get install ruby
sudo apt-get install ruby-dev

####安装FPM
gem install fpm
编译发布
发布后的安装包(.tar .deb .rpm文件)都存在在$GOPATH/src/github.com/grafana/grafana/dist目录下面, 部分临时文件都存在在/tmp目录下面

go run build.go build package

对于开源项目Grafana,我已经对其完成汉化工作,如下:
https://github.com/plusplusxu/grafana 

原文地址:https://www.cnblogs.com/qiumingcheng/p/6323373.html