Grafana 是 Graphite 和 InfluxDB 仪表盘和图形编辑器。
Grafana 是开源的,功能齐全的度量仪表盘和图形编辑器,支持 Graphite,InfluxDB 和 OpenTSDB。
Grafana 主要特性:灵活丰富的图形化选项;可以混合多种风格;支持白天和夜间模式;多个数据源;Graphite 和 InfluxDB 查询编辑器等等。

认识Grafana

Graphite 指标编辑器

  • Graphite 指标表达解析器
  • 功能齐全的查询功能
  • 快速添加和编辑函数和参数
  • 模板化查询
  • See it in action

图形化

  • 快速渲染,甚至是较大的时间跨度
  • 点击和拖拽缩放
  • 多个 Y 轴
  • 条形,折线,点
  • 智能 Y 轴格式化
  • 系列切换和颜色选择
  • Legend values 和格式化选项
  • 网格阈值,轴标签
  • Annotations

仪表盘

  • 创建,编辑,保存和搜索仪表盘
  • 修改列宽和行高
  • 拖拽面板重新编排
  • 使用 InfluxDB 或者 Elasticsearch 作为仪表盘存储
  • 导入和导出仪表盘(JSON 文件)
  • 从 Graphite 导入仪表盘
  • 模板
  • Scripted dashboards
  • Dashboard playlists
  • 时间范围控制

InfluxDB

  • 使用 InfluxDB 作为指标数据源,注释源和仪表盘存储
  • 查询编辑器

OpenTSDB

  • 作为指标数据源
  • 查询编辑器

部署Grafana数据展示平台 之在线安装

官网:http://grafana.org/
环境:
   Centos 6.6
   Zabbix Version 3.0.4
   grafana Version 3.1.1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[root@Zabbix ~]# wget https://grafanarel.s3.amazonaws.com/builds/grafana-3.1.1-1470047149.x86_64.rpm
[root@Zabbix ~]# yum -y install grafana-3.1.1-1470047149.x86_64.rpm
[root@Zabbix ~]# mkdir -p /var/log/grafana
[root@Zabbix ~]# cd /usr/share/grafana/conf/
[root@Zabbix conf]# grep -v '^#' defaults.ini | grep -v ^$
···
[users]
allow_sign_up = false #关闭这个在登录界面就没有Sign Up了
allow_org_create = false
auto_assign_org = false
auto_assign_org_role = Viewer
verify_email_enabled = false
login_hint = email or username
default_theme = dark
···
[root@Zabbix conf]#

安装Grafana插件
官方文档:http://docs.grafana.org/plugins/installation/

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
#列出可用的插件
[root@Zabbix ~]# grafana-cli plugins list-remote
id: abhisant-druid-datasource version: 0.0.2
id: alexanderzobnin-zabbix-app version: 3.0.0
id: bosun-app version: 0.0.25
id: bosun-datasource version: 0.0.5
id: crate-datasource version: 0.0.1
id: fastweb-openfalcon-datasource version: 1.0.0
id: fetzerch-sunandmoon-datasource version: 0.1.1
id: grafana-clock-panel version: 0.0.8
id: grafana-example-app version: 1.0.1
id: grafana-influxdb-08-datasource version: 1.0.2
id: grafana-kairosdb-datasource version: 1.0.1
id: grafana-piechart-panel version: 1.1.1
id: grafana-simple-json-datasource version: 1.1.2
id: grafana-worldmap-panel version: 0.0.14
id: kentik-app version: 1.0.4
id: mtanda-heatmap-epoch-panel version: 0.1.1
id: mtanda-histogram-panel version: 0.1.5
id: ns1-app version: 0.0.5
id: opennms-datasource version: 2.0.1
id: percona-percona-app version: 1.0.0
id: praj-ams-datasource version: 1.0.1
id: raintank-snap-app version: 0.0.3
id: raintank-worldping-app version: 1.0.10
id: sileht-gnocchi-datasource version: 1.0.6
id: sraoss-sunburst-panel version: 1.0
id: stagemonitor-elasticsearch-app version: 0.26.0
id: udoprog-heroic-datasource version: 0.1.0
id: voxter-app version: 0.0.1
Restart grafana after installing plugins . <service grafana-server restart>
[root@Zabbix ~]#

alexanderzobnin-zabbix-app 插件用于Grafana通过Zabbix API获取数据并展示数据

1
[root@Zabbix ~]# grafana-cli plugins install alexanderzobnin-zabbix-app

Grafana_install_plugins

安装Grafana其他插件
常用插件:grafana-clock-panelgrafana-simple-json-datasourcegrafana-piechart-panel

1
2
3
[root@Zabbix ~]# grafana-cli plugins install grafana-clock-panel
[root@Zabbix ~]# grafana-cli plugins install grafana-simple-json-datasource
[root@Zabbix ~]# grafana-cli plugins install grafana-piechart-panel

1
2
3
4
#这三个可以不安装,这三个插件是用于检测DNS/PING等网络情况的,需要付费
[root@Zabbix ~]# grafana-cli plugins install raintank-worldping-app
[root@Zabbix ~]# grafana-cli plugins install fastweb-openfalcon-datasource
[root@Zabbix ~]# grafana-cli plugins install percona-percona-app
1
2
#列出已安装的插件
[root@Zabbix ~]# grafana-cli plugins ls

Grafana_plugins_list

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[root@Zabbix ~]# ll /var/lib/grafana/plugins
total 28
drwxr-xr-x 7 root root 4096 Aug 30 10:14 alexanderzobnin-zabbix-app
drwxr-xr-x 6 root root 4096 Aug 30 15:03 fastweb-openfalcon-datasource
drwxr-xr-x 4 root root 4096 Aug 30 10:15 grafana-clock-panel
drwxr-xr-x 4 root root 4096 Aug 30 14:40 grafana-piechart-panel
drwxr-xr-x 5 root root 4096 Aug 30 10:15 grafana-simple-json-datasource
drwxr-xr-x 4 root root 4096 Aug 30 15:31 percona-percona-app
drwxr-xr-x 4 root root 4096 Aug 30 10:15 raintank-worldping-app
[root@Zabbix ~]#
[root@Zabbix ~]# /etc/init.d/grafana-server start
Starting Grafana Server: .... OK
[root@Zabbix ~]# chkconfig --add grafana-server
[root@Zabbix ~]# chkconfig grafana-server on

访问:http://ip:3000/
Grafana_login
Grafana

安装zabbix插件
Grafana
Grafana
Grafana

1
2
Zabbix的API地址为“http://192.168.31.130/zabbix/api_jsonrpc.php”,其中IP的安装zabbix-server的服务器IP
Zabbix的API账号密码就是Zabbix的Web端登录账号和密码

Grafana_datasource
Grafana_datasource
Grafana_datasource

新建一个仪表
Grafana_table
Grafana_table
Grafana_table
Grafana_table
Grafana_table
Grafana_table
OK,Grafana在线安装完成

看看效果图
Grafana_view
Grafana_view
Grafana_view
Grafana_view
Grafana_view

用户管理(使用管理员登录)
Grafana_user
创建Grafana用户并授权
Grafana_create_user
Grafana_create_user
Grafana_create_user
Grafana_create_user
Grafana_create_user

部署Grafana数据展示平台 之离线安装

官网:http://grafana.org/
环境:
   Centos 7.2
   Grafana Version 4.2.0

Grafana支持多平台安装,目前已知平台有Linux、Windows、Mac、Docker。Linux支持系统有Ubuntu &Debian、Standalone Linux Binaries、Redhat &Centos等等
Grafana下载地址:https://grafana.com/grafana/download

下载Grafana for Centos

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#安装Grafana
[root@localhost ~]# yum -y install grafana-4.2.0-1.x86_64.rpm
[root@localhost ~]# cd /usr/share/grafana/conf/
[root@localhost ~]# grep -v ^# /usr/share/grafana/conf/defaults.ini | grep -v ^$
...
#allow_sign_up、allow_org_create、auto_assign_org值为false在登录界面就没有Sign Up了
[users]
allow_sign_up = false
allow_org_create = false
auto_assign_org = false
auto_assign_org_role = Viewer
verify_email_enabled = false
login_hint = email or username
default_theme = dark
...
[root@localhost ~]# systemctl enable grafana-server
[root@localhost ~]# service grafana-server start
[root@localhost ~]# mkdir -p /var/log/grafana

访问http://ip:3000
Grafana_login

安装Grafana插件
grafana插件:https://grafana.com/plugins ,这里可以获取Grafana最新插件

安装Grafana for Zabbix插件
alexanderzobnin-zabbix-app 插件用于Grafana通过Zabbix API获取数据并展示数据

1
2
3
4
[root@localhost ~]# unzip alexanderzobnin-grafana-zabbix-v3.3.0-0-geca8096.zip
[root@localhost ~]# cp -rfp alexanderzobnin-grafana-zabbix-eca8096/ /var/lib/g
rafana/plugins/
[root@localhost ~]# service grafana-server restart

Grafana_install_plugin
Grafana_install_plugin
Grafana_install_plugin

安装Grafana其他插件
常用插件:grafana-clock-panelgrafana-simple-json-datasourcegrafana-piechart-panel

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
[root@localhost ~]# unzip grafana-clock-panel-c5b3c7f.zip
[root@localhost ~]# cp -rfp grafana-clock-panel-c5b3c7f /var/lib/grafana/plugins/
[root@localhost ~]# unzip grafana-piechart-panel-ce2ede8.zip
[root@localhost ~]# cp grafana-piechart-panel-ce2ede8 /var/lib/grafana/plugins/ -rfp
[root@localhost ~]# unzip grafana-simple-json-datasource-49eeb6d.zip
[root@localhost ~]# cp -rfp grafana-simple-json-datasource-49eeb6d /var/lib/grafana/plugins/
[root@localhost ~]# unzip Vonage-Grafana_Status_panel-1.0.4-0-g8bf28f2.zip
[root@localhost ~]# cp -rfp Vonage-Grafana_Status_panel-8bf28f2/ /var/lib/grafana/plugins/
[root@localhost ~]# ll /var/lib/grafana/plugins/
total 8
drwxr-xr-x 6 root root 4096 Feb 10 23:30 alexanderzobnin-grafana-zabbix-eca8096
drwxr-xr-x 4 root root 4096 Mar 18 07:29 grafana-clock-panel-c5b3c7f
drwxr-xr-x 4 root root 112 Sep 29 2016 grafana-piechart-panel-ce2ede8
drwxr-xr-x 5 root root 156 Mar 24 00:54 grafana-simple-json-datasource-49eeb6d
drwxr-xr-x 4 root root 136 Apr 27 18:02 Vonage-Grafana_Status_panel-8bf28f2
[root@localhost ~]#
[root@localhost ~]# grafana-cli plugins ls
installed plugins:
vonage-status-panel @ 1.0.4
alexanderzobnin-zabbix-app @ 3.3.0
grafana-clock-panel @ 0.0.9
grafana-piechart-panel @ 1.1.4
grafana-simple-json-datasource @ 1.3.1
Restart grafana after installing plugins . <service grafana-server restart>
[root@localhost ~]#
#安装了新的Grafana插件需要重启Grafana
[root@localhost ~]# service grafana-server restart

Grafana_install_plugin
OK,Grafana离线安装完成

附件:
grafana_install_packages.zip


本文出自”Jack Wang Blog”:http://www.yfshare.vip/2017/04/29/部署Grafana数据展示系统/