​​​​ 数据分析平台grafana | 苏生不惑的博客

数据分析平台grafana

安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
//http://docs.grafana.org/installation/rpm/ https://blog.csdn.net/bbwangj/article/details/81109615
[root@VM_0_14_centos blog]# service grafana-server start
Starting grafana-server (via systemctl): systemctl start grafana-server
[ OK ]
[root@VM_0_14_centos blog]# systemctl start grafana-server
[root@VM_0_14_centos blog]# systemctl enable grafana-server.service
Created symlink from /etc/systemd/system/multi-user.target.wants/grafana-server.service to /usr/lib/systemd/system/grafana-server.service.

[root@VM_0_14_centos blog]# grafana-cli plugins install alexanderzobnin-zabbix-app
installing alexanderzobnin-zabbix-app @ 3.9.1
from url: https://grafana.com/api/plugins/alexanderzobnin-zabbix-app/versions/3.9.1/download
into: /var/lib/grafana/plugins

✔ Installed alexanderzobnin-zabbix-app successfully

Restart grafana after installing plugins . <service grafana-server restart>

[root@VM_0_14_centos blog]# grafana-cli plugins install grafana-piechart-panel
installing grafana-piechart-panel @ 1.3.4
from url: https://grafana.com/api/plugins/grafana-piechart-panel/versions/1.3.4/download
into: /var/lib/grafana/plugins

✔ Installed grafana-piechart-panel successfully

Restart grafana after installing plugins . <service grafana-server restart>
[root@VM_0_14_centos blog]# grafana-cli plugins ls
installed plugins:
alexanderzobnin-zabbix-app @ 3.9.1
grafana-piechart-panel @ 1.3.4

Restart grafana after installing plugins . <service grafana-server restart>
grafana-cli plugins update <plugin-id>
grafana-cli plugins remove <plugin-id>
grafana-cli plugins install grafana-simple-json-datasource
/etc/init.d/grafana-server restart
[root@VM_0_14_centos blog]# ll /usr/share/grafana/public/app/plugins/datasource/
total 60
drwxr-xr-x 5 root root 4096 Jan 10 14:16 cloudwatch
drwxr-xr-x 5 root root 4096 Jan 10 14:16 elasticsearch
drwxr-xr-x 4 root root 4096 Jan 10 14:16 grafana
drwxr-xr-x 3 root root 4096 Jan 10 14:16 grafana-live
drwxr-xr-x 6 root root 4096 Jan 10 14:16 graphite
drwxr-xr-x 5 root root 4096 Jan 10 14:16 influxdb
drwxr-xr-x 5 root root 4096 Jan 10 14:16 logging
drwxr-xr-x 2 root root 4096 Jan 10 14:16 mixed
drwxr-xr-x 5 root root 4096 Jan 10 14:16 mssql
drwxr-xr-x 5 root root 4096 Jan 10 14:16 mysql
drwxr-xr-x 5 root root 4096 Jan 10 14:16 opentsdb
drwxr-xr-x 5 root root 4096 Jan 10 14:16 postgres
drwxr-xr-x 8 root root 4096 Jan 10 14:16 prometheus
drwxr-xr-x 6 root root 4096 Jan 10 14:16 stackdriver
drwxr-xr-x 3 root root 4096 Jan 10 14:16 testdata
[root@VM_0_14_centos blog]# systemctl restart grafana-server
//https://blog.csdn.net/Hu_wen/article/details/78890159
export GOPATH=`pwd`
go get github.com/grafana/grafana
cd $GOPATH/src/github.com/grafana/grafana
go run build.go setup
go run build.go build
yum install bzip2
npm install -g yarn
yarn install --pure-lockfile
npm run build
./bin/grafana-server
grafana的模板资源主要是在源码的public下,修改相应的html文件以及js文件就可以汉化

# 二进制程序文件
/usr/sbin/grafana-server
# init.d脚本
/etc/init.d/grafana-server
# 安装默认环境变量文件
/etc/sysconfig/grafana-server
# 配置文件
/etc/grafana/grafana.ini
# systemd服务名称
grafana-server.service
# 日志文件
/var/log/grafana/grafana.log
# 默认sqlite3数据库
/var/lib/grafana/grafana.db

[root@VM_0_14_centos blog]# vi /etc/grafana/grafana.ini
http_port=3003
[root@VM_0_14_centos blog]# systemctl restart grafana-server
[root@VM_0_14_centos blog]# systemctl status grafana-server
● grafana-server.service - Grafana instance
Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2019-01-10 14:59:27 CST; 6s ago
Docs: http://docs.grafana.org
Main PID: 28408 (grafana-server)
Memory: 16.5M
CGroup: /system.slice/grafana-server.service
└─28408 /usr/sbin/grafana-server --config=/etc/grafana/grafana.ini --pidfile=/var/run/grafana/grafana-server.pid --packagin...


Jan 10 14:59:27 VM_0_14_centos grafana-server[28408]: t=2019-01-10T14:59:27+0800 lvl=info msg="Initializing PluginManager" logger=server Jan 10 14:59:27 VM_0_14_centos grafana-server[28408]: t=2019-01-10T14:59:27+0800 lvl=info msg="Starting plugin search" logger=plugins
Jan 10 14:59:27 VM_0_14_centos grafana-server[28408]: t=2019-01-10T14:59:27+0800 lvl=info msg="Registering plugin" logger=plugin...Zabbix

Jan 10 14:59:27 VM_0_14_centos grafana-server[28408]: t=2019-01-10T14:59:27+0800 lvl=info msg="Registering plugin" logger=plugin...ggers"

Jan 10 14:59:27 VM_0_14_centos grafana-server[28408]: t=2019-01-10T14:59:27+0800 lvl=info msg="Registering plugin" logger=plugin...Zabbix

Jan 10 14:59:27 VM_0_14_centos grafana-server[28408]: t=2019-01-10T14:59:27+0800 lvl=info msg="Registering plugin" logger=plugin...Chart"

Jan 10 14:59:27 VM_0_14_centos systemd[1]: Started Grafana instance.
Jan 10 14:59:27 VM_0_14_centos grafana-server[28408]: t=2019-01-10T14:59:27+0800 lvl=info msg="Initializing TracingService" logger=server

Jan 10 14:59:27 VM_0_14_centos grafana-server[28408]: t=2019-01-10T14:59:27+0800 lvl=info msg="Initializing Stream Manager"
Jan 10 14:59:27 VM_0_14_centos grafana-server[28408]: t=2019-01-10T14:59:27+0800 lvl=info msg="HTTP Server Listen" logger=http.s...ocket=

Hint: Some lines were ellipsized, use -l to show in full.

访问

http://118.24.158.116:3003 默认账号密码 admin admin

Grafana 文档(目录)