Zabbix对接Grafana

1、安装grafana:

[root@zabbix ~]# rpm -ivh grafana-6.7.3-1.x86_64.rpm 
warning: grafana-6.7.3-1.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 24098cb6: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:grafana-6.7.3-1                  ################################# [100%]
### 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

2、根据提示完成配置并启动服务:

[root@zabbix ~]# systemctl daemon-reload
[root@zabbix ~]# systemctl enable grafana-server
Created symlink from /etc/systemd/system/multi-user.target.wants/grafana-server.service to /usr/lib/systemd/system/grafana-server.service.
[root@zabbix ~]# systemctl start grafana-server

服务运行在3000端口:

[root@zabbix vmuser]# netstat -ntpl|grep 3000
tcp6       0      0 :::3000                 :::*                    LISTEN      18358/grafana-serve

3、访问http://ip:3000

默认账号密码为admin/admin

4、添加数据源Mysql

保存并测试,如果报错:

tail -f /var/log/grafana/grafana.log

查看报错信息,按报错修改即可。

5、下载zabbix插件,并安装

下载地址:https://grafana.com/grafana/plugins/alexanderzobnin-zabbix-app/installation

下载zip:https://codeload.github.com/alexanderzobnin/grafana-zabbix/legacy.zip/793129b2d602b36b09dc64dab7ec6f5a6f7beb42

解压到grafana插件目录,重启grafana并从web界面启用插件:

[root@zabbix ~]# unzip alexanderzobnin-grafana-zabbix-v3.11.0-1-g52f24ec.zip -d /var/lib/grafana/plugins/

[root@zabbix ~]# systemctl restart grafana-server

6、再次添加数据源,数据源类型选择zabbix

HTTP url字段添加zabbix API地址,通常为:http://ip/zabbix/api_jsonrpc.php。

Zabbix API details字段填写zabbix web界面的用户名密码。启用Trends,选择Zabbix version。

Direct DB Connection,选择enable,Data Source选择第四步添加的数据源。

7、save and test,编辑仪表板即可。