Zabbix5.0+Grafana可视化试用(八):在CentOS7上安装Grafana7.0.1并添加Zabbix数据源

Grafana 是一款采用 go 语言编写的开源应用,主要用于大规模指标数据的可视化展现,是网络架构和应用分析中最流行的时序数据展示工具,目前已经支持绝大部分常用的时序数据库。

开始安装Grafana,首先完成CentOS7的安装,关闭防火墙及SELINUX:

[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]#
[root@localhost ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]#
[root@localhost ~]# sed -i ‘s#SELINUX=enforcing#SELINUX=disabled#g’ /etc/selinux/config
[root@localhost ~]#
[root@localhost ~]# grep “SELINUX=disabled” /etc/selinux/config
SELINUX=disabled
[root@localhost ~]#
[root@localhost ~]#

完成后,开始安装Grafana(或者使用清华大学镜像https://mirrors.tuna.tsinghua.edu.cn/grafana/yum/rpm/),下载:

[root@localhost ~]# wget https://dl.grafana.com/oss/release/grafana-7.0.3-1.x86_64.rpm
–2020-06-07 03:03:22–  https://dl.grafana.com/oss/release/grafana-7.0.3-1.x86_64.rpm
Resolving dl.grafana.com (dl.grafana.com)… 151.101.42.217, 2a04:4e42:a::729
Connecting to dl.grafana.com (dl.grafana.com)|151.101.42.217|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 49068666 (47M) [application/x-redhat-package-manager]
Saving to: 鈥榞rafana-7.0.3-1.x86_64.rpm.1鈥

100%[=================================================>] 49,068,666   935KB/s   in 52s   

2020-06-07 03:04:15 (923 KB/s) – 鈥榞rafana-7.0.3-1.x86_64.rpm.1鈥saved [49068666/49068666]

[root@localhost ~]#

安装:

[root@localhost ~]# yum localinstall grafana-7.0.3-1.x86_64.rpm
Loaded plugins: fastestmirror, langpacks
Examining grafana-7.0.3-1.x86_64.rpm: grafana-7.0.3-1.x86_64
Marking grafana-7.0.3-1.x86_64.rpm to be installed
Resolving Dependencies
–> Running transaction check
—> Package grafana.x86_64 0:7.0.3-1 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
  Package                        Arch                          Version                           Repository                                      Size
============================================================================
Installing:
  grafana                        x86_64                        7.0.3-1                           /grafana-7.0.3-1.x86_64                        142 M

Transaction Summary
============================================================================
Install  1 Package

Total size: 142 M
Installed size: 142 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
   Installing : grafana-7.0.3-1.x86_64                                                                                                            1/1
### NOT starting on installation, please execute the following statements to configure grafana to start automatically using systemd
  sudo /bin/systemctl daemon-reload
  sudo /bin/systemctl enable grafana-server.service
### You can start grafana-server by executing
  sudo /bin/systemctl start grafana-server.service
POSTTRANS: Running script
   Verifying  : grafana-7.0.3-1.x86_64                                                                                                            1/1

Installed:
   grafana.x86_64 0:7.0.3-1                                                                                                                          

Complete!
[root@localhost ~]#

启动grafana并设置为开机启动:

[root@localhost ~]# systemctl start grafana-server.service
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# 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@localhost ~]#

使用http://192.168.10.220:3000 ,输入用户名密码,都为admin:

zabbix5.0_46

输入新密码:

zabbix5.0_47

zabbix5.0_48

完成安装后,开始添加ZABBIX数据源:

进入Grafana官网https://grafana.com/grafana/plugins/alexanderzobnin-zabbix-app页面,查看Installation安装方法

zabbix5.0_50

在Grafana服务器上使用命令grafana-cli plugins install alexanderzobnin-zabbix-app开始安装:


[root@localhost ~]# grafana-cli plugins install alexanderzobnin-zabbix-app
installing alexanderzobnin-zabbix-app @ 3.12.2
from: https://grafana.com/api/plugins/alexanderzobnin-zabbix-app/versions/3.12.2/download
into: /var/lib/grafana/plugins

鉁[0m Installed alexanderzobnin-zabbix-app successfully

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

[root@localhost ~]#

然后重启动Grafana服务:

[root@localhost ~]# systemctl restart grafana-server.service

完成后进入刚安装成功的Plugins菜单的Zabbix插件,点击【Enable】启动插件,如下图

zabbix5.0_51

进入Configuration->Add data source

zabbix5.0_53

点击【Selcet】

zabbix5.0_54

配置Data Sources中的Zabbix,输入ZABBIX URL:http://192.168.10.218/zabbix/api_jsonrpc.php,以及输入ZABBIX平台的用户名及密码

zabbix5.0_55

开启警告,完成后点击【Save&Test】测试并添加,如下图。

zabbix5.0_56

至此全部安装完成并设置,后期在面板中直接调用ZABBIX数据源即可。

zabbix5.0_57

One Comment

  1. 魔法小白说道:

    我也安装了,效果比ZABBIX好,单用起来还是不如zabbix原生系统好用。

Leave a Reply