Press "Enter" to skip to content

Grafana+Zabbix安装配置

主机环境:
[root@test ~]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.4.1708 (Core)
Release: 7.4.1708
Codename: Core
[root@test ~]# uname -a
Linux test 3.10.0-693.2.2.el7.x86_64 #1 SMP Tue Sep 12 22:26:13 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@cdh5 ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.139.132 netmask 255.255.255.0 broadcast 192.168.139.255
ether 00:0c:29:ca:b7:70 txqueuelen 1000 (Ethernet)
RX packets 86005 bytes 108025200 (103.0 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 21403 bytes 10400974 (9.9 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1 (Local Loopback)
RX packets 32990 bytes 2080464 (1.9 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 32990 bytes 2080464 (1.9 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:7b:cd:e0 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

zabbix yum安装参考:https://www.tracymc.cn/archives/614
zabbix编译安装参考:https://www.tracymc.cn/archives/218

具体步骤:
1.安装Grafana
[root@cdh5 ~]# yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.4.3-1.x86_64.rpm
如果下载速度慢,可以先将rpm文件下载到本地后直接安装:
启动Grafana服务:
[root@cdh5 ~]# systemctl start grafana-server
如果启动成功,我们可以通过浏览器访问Grafana,地址:
http://192.168.139.132:3000,默认登录账号、密码为admin/admin,默认登录页面如下:


可通过如下步骤修改登录密码,如下:
2.安装grafana-zabbix插件,点击首页的"Install apps & plugins"如下:
找到grafana-zabbix,如下:

点击zabbix插件进去,再点击"Install Plugin"按钮可以看到安装简介,如下:
到主机安装插件,如下:
[root@cdh5 ~]# 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>
重启grafana server:
[root@cdh5 ~]# systemctl restart grafana-server
重启完之后到插件页将看到zabbix插件,如下:
点击zabbix插件并进入,点击“Enable”启用该插件,启用后如下图:
配置grafana的data source:
按如下步骤进入data source配置页面,如下:
点击"+Add data source"按钮进入配置页面,先配置mysql,Name随便填写,Type选择MySQL,MySQL Connection填写zabbix所用的mysql数据库的相关信息,如下:
再配置zabbix,Name随便填写,Type填写Zabbix,Url为http://192.168.139.132/zabbix/api_jsonrpc.php,Username/Password填写登录zabbix web页面的用户名和密码,SQL Data Source填写上面配置mysql填写的name,具体如下:

最后稍等一段时间,查看Zabbix Server Dashboard有无数据即可,如下图:

Be First to Comment

发表评论

电子邮件地址不会被公开。 必填项已用*标注