CentOS7安装zabbix grafana插件

grafana

直接yum安装

1
2
3
[root@zabbixsrv ~]# yum install https://grafanarel.s3.amazonaws.com/builds/grafana-3.1.0-1468321182.x86_64.rpm
[root@zabbixsrv ~]# yum install initscripts fontconfig

本地配置yum安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
1.修改yum源配置文件
[root@zabbixsrv ~]# cat /etc/yum.repos.d/grafana.repo
[grafana]
name=grafana
baseurl=https://packagecloud.io/grafana/stable/el/6/$basearch
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://grafanarel.s3.amazonaws.com/RPM-GPG-KEY-grafana
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
2.yum安装
yum install –y 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
1.启动grafana-server
[root@zabbixsrv ~]# systemctl start grafana-server
2.查看grafana-server status
[root@zabbixsrv ~]# systemctl status grafana-server
● grafana-server.service - Starts and stops a single grafana instance on this system
Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2017-04-05 17:32:43 CST; 1min 28s ago
Docs: http://docs.grafana.org
Main PID: 49334 (grafana-server)
CGroup: /system.slice/grafana-server.service
└─49334 /usr/sbin/grafana-server --config=/etc/grafana/grafana.ini --pidfile= cfg:default.paths.logs=/var/log/grafana cfg:default....
Apr 05 17:32:45 zabbixsrv grafana-server[49334]: t=2017-04-05T17:32:45+0800 lvl=info msg="Executing migration" logger=migrator id="cre...ble v2"
Apr 05 17:32:45 zabbixsrv grafana-server[49334]: t=2017-04-05T17:32:45+0800 lvl=info msg="Executing migration" logger=migrator id="cre...ble v2"
Apr 05 17:32:45 zabbixsrv grafana-server[49334]: t=2017-04-05T17:32:45+0800 lvl=info msg="Executing migration" logger=migrator id="dro...ble v2"
Apr 05 17:32:45 zabbixsrv grafana-server[49334]: t=2017-04-05T17:32:45+0800 lvl=info msg="Executing migration" logger=migrator id="dro...ble v3"
Apr 05 17:32:45 zabbixsrv grafana-server[49334]: t=2017-04-05T17:32:45+0800 lvl=info msg="Executing migration" logger=migrator id="cre...ble v3"
Apr 05 17:32:45 zabbixsrv grafana-server[49334]: t=2017-04-05T17:32:45+0800 lvl=info msg="Created default admin user: [admin]"
Apr 05 17:32:45 zabbixsrv grafana-server[49334]: t=2017-04-05T17:32:45+0800 lvl=info msg="Starting plugin search" logger=plugins
Apr 05 17:32:45 zabbixsrv grafana-server[49334]: t=2017-04-05T17:32:45+0800 lvl=warn msg="Plugin dir does not exist" logger=plugins di...plugins
Apr 05 17:32:45 zabbixsrv grafana-server[49334]: t=2017-04-05T17:32:45+0800 lvl=info msg="Plugin dir created" logger=plugins dir=/var/...plugins
Apr 05 17:32:45 zabbixsrv grafana-server[49334]: t=2017-04-05T17:32:45+0800 lvl=info msg="Server Listening" logger=server address=0.0....subUrl=
Hint: Some lines were ellipsized, use -l to show in full.
[root@zabbixsrv ~]#
3.设置开机自动启动
[root@zabbixsrv ~]# systemctl enable grafana-server.service

获取grafana-zabbix插件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
1.查看远程插件
[root@zabbixsrv ~]# grafana-cli plugins list-remote
id: abhisant-druid-datasource version: 0.0.4
id: alexanderzobnin-zabbix-app version: 3.3.0
id: belugacdn-app version: 1.2.0
[root@zabbixsrv ~]#
2.安装grafana zabbix插件
[root@zabbixsrv ~]# grafana-cli plugins install alexanderzobnin-zabbix-app
installing alexanderzobnin-zabbix-app @ 3.3.0
from url: https://grafana.net/api/plugins/alexanderzobnin-zabbix-app/versions/3.3.0/download
into: /var/lib/grafana/plugins
✔ Installed alexanderzobnin-zabbix-app successfully
Restart grafana after installing plugins . <service grafana-server restart>
[root@zabbixsrv ~]#
3.启动
[root@zabbixsrv ~]# systemctl restart grafana-server

web页面配置

1.查看3000端口是否启动

1
2
3
4
5
6
7
8
9
10
11
12
[root@zabbixsrv ~]# netstat -tlnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 44058/mysqld
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 31538/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 33796/smtpd
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 32287/zabbix_agentd
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 21071/zabbix_server
tcp6 0 0 :::3000 :::* LISTEN 55833/grafana-serve
tcp6 0 0 :::10050 :::* LISTEN 32287/zabbix_agentd
tcp6 0 0 :::10051 :::* LISTEN 21071/zabbix_server
[root@zabbixsrv ~]#

2.登陆web页面+3000端口,默认是你zabbix的URL地址外加3000端口.用户密码默认是admin,admin.可以手动修改
3.在Plugins中选择Apps就可以看到我们刚安装的zabbix插件了.如图:
grafana
4.web页面展示.关于grafana更多的使用,在下文中我们做介绍。
grafana

OpsNotes wechat
欢迎您扫一扫上面的微信公众号,订阅我的博客!
坚持原创技术分享,您的支持将鼓励我继续创作!