一、编写docker-cmpose文件

  docker-compose.yml文件如下:

 1 version: "3.3"
 2 services:
 3   grafana:
 4     image: grafana/grafana:latest
 5     environment:
 6       GF_SECURITY_ADMIN_PASSWORD: aibili_grafana
 7     ports:
 8       - 3000:3000
 9     user: "472"
10     volumes:
11       - ./grafana_data:/var/lib/grafana
12       - ./log/grafana:/var/log/grafana
13   influxdb:
14     image: influxdb:latest
15     environment:
16       INFLUXDB_GRAPHITE_ENABLE: "true"
17     ports:
18       - 8086:8086
19       - 8083:8083
20       - 2003:2003
21     volumes:
22       - ./influxdb_data:/var/lib/influxdb
23   influxproxy:
24     image: juris/influxdb-timeshift-proxy
25     environment:
26       INFLUXDB : "influxdb:8086"
27     ports:
28       - 8089:8089

二、启动容器

docker-compose  up -d时grafana无法启动出现如下报错:

[root@localhost grafana]# docker-compose logs -f grafana
Attaching to grafana_grafana_1
grafana_1 | GF_PATHS_DATA='/var/lib/grafana' is not writable.
grafana_1 | You may have issues with file permissions, more information here: http://docs.grafana.org/installation/docker/#migration-from-a-previous-version-of-the-docker-container-to-5-1-or-later
grafana_1 | mkdir: cannot create directory '/var/lib/grafana/plugins': Permission denied
grafana_grafana_1 exited with code 1

原因:grafana_data目录权限不足。

解决办法:chown 472:472 grafana_data -R

三、登录

浏览器访问:http://192.168.1.20:3000
用户名:admin
密码:前边所设密码

四、安装zabbix插件

进入grafana容器
$ grafana-cli plugins install alexanderzobnin-zabbix-app
01-23 23:03