docker文件安装zabbix5
# docker-compose.yaml文件
version: '2'
services:
zabbix-server:
image: zabbix/zabbix-server-mysql:centos-5.0-latest
networks:
zabb:
ipv4_address: 172.19.0.2
ports:
- "10051:10051"
volumes:
- /etc/localtime:/etc/localtime
- /etc/timezone:/etc/timezone
- ./zbx_env/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts
#- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts
#- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules
#- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc
#- ./zbx_env/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys
#- ./zbx_env/var/lib/zabbix/mibs:/var/lib/zabbix/mibs
privileged: true
volumes_from:
- zabbix-snmptraps:rw
links:
- mysql-server:mysql-server
- zabbix-java-gateway:zabbix-java-gateway
ulimits:
nproc: 65535
nofile:
soft: 20000
hard: 40000
mem_limit: 1024m
env_file:
- .env_db_mysql
- .env_srv
zabbix-web-nginx-mysql:
image: zabbix/zabbix-web-nginx-mysql:centos-5.0-latest
networks:
zabb:
ipv4_address: 172.19.0.3
ports:
- 82:8080
- 9010:9000
#- "8443:443"
links:
- mysql-server:mysql-server
- zabbix-server:zabbix-server
mem_limit: 512m
volumes:
- /etc/localtime:/etc/localtime
- /etc/timezone:/etc/timezone
- /usr/share/zabbix:/usr/share/zabbix
#- ./zbx_env/etc/php-fpm.d:/etc/php-fpm.d
#- ./zbx_env/phpsock/:/tmp/proxy
#- ./zbx_env/etc/php-fpm.conf:/etc/php-fpm.conf
#- ./zbx_env/etc/php.ini:/etc/php.ini
#- ./zbx_env/etc/nginx/conf.d:/etc/nginx/conf.d
env_file:
- .env_db_mysql
- .env_web
zabbix-java-gateway:
image: zabbix/zabbix-java-gateway:centos-5.0-latest
networks:
zabb:
ipv4_address: 172.19.0.5
ports:
- "10052:10052"
env_file:
- .env_java
zabbix-snmptraps:
image: zabbix/zabbix-snmptraps:centos-5.0-latest
networks:
zabb:
ipv4_address: 172.19.0.6
ports:
- "162:162/udp"
privileged: true
#volumes:
#- ./zbx_env/var/lib/zabbix/snmptraps:/var/lib/zabbix/snmptraps:rw
mysql-server:
image: mysql:5.7
networks:
zabb:
ipv4_address: 172.19.0.7
ports:
- "3306:3306"
volumes:
- /data/zabbix_mysql/mysql:/var/lib/mysql
#- /data/zabbix_mysql/zabbix_mysqld.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf
environment:
MYSQL_ROOT_PASSWORD: "mysql_pwd"
command: [mysqld, --character-set-server=utf8, --collation-server=utf8_bin]
#volumes_from:
#- db_data_mysql
#volume_driver: local
#env_file:
#- .env_db_mysql
#db_data_mysql:
#image: busybox
#networks:
#zabb:
#ipv4_address: 172.19.0.8
#volumes:
#- ./zbx_env/var/lib/mysql:/var/lib/mysql:rw
networks:
zabb:
driver: bridge
ipam:
config:
- subnet: 172.19.0.0/24
gateway: 172.19.0.1
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# 字体乱码修改
将中文字体放到这个目录下
/opt/apps/zabbix/zbx_env/usr/share/zabbix/assets/fonts
修改php配置
/opt/apps/zabbix/zbx_env/usr/share/zabbix/include/defines.inc.php
define('ZBX_GRAPH_FONT_NAME', 'simhei');
define('ZBX_FONT_NAME', 'simhei');
重启web服务
# docker-compose 5.4安装文件
version: "3"
services:
mysql-server:
container_name: mysql-server
image: mysql:8.0
ports:
- "3306:3306"
volumes:
- /etc/localtime:/etc/localtime
- /data/mysql:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: root_pwd
MYSQL_DATABASE: zabbix
MYSQL_USER: zabbix
MYSQL_PASSWORD: zabbix_pwd
TZ: Asia/Shanghai
command:
--character-set-server=utf8
--collation-server=utf8_bin
restart: always
networks:
zabb:
ipv4_address: 172.21.0.2
zabbix-java-gateway:
container_name: zabbix-java-gateway
image: zabbix/zabbix-java-gateway:alpine-5.4-latest
networks:
zabb:
ipv4_address: 172.21.0.3
zabbix-server:
container_name: zabbix-server
image: zabbix/zabbix-server-mysql:alpine-5.4-latest
ports:
- "10051:10051"
volumes:
- ./zbx_env/usr/lib/zabbix/alertscripts:/usr/lib/zabbix/alertscripts
- ./zbx_env/usr/lib/zabbix/externalscripts:/usr/lib/zabbix/externalscripts
- ./zbx_env/var/lib/zabbix/export:/var/lib/zabbix/export
- ./zbx_env/var/lib/zabbix/modules:/var/lib/zabbix/modules
- ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc
- ./zbx_env/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys
- ./zbx_env/var/lib/zabbix/mibs:/var/lib/zabbix/mibs
- ./zbx_env/var/lib/zabbix/snmptraps:/var/lib/zabbix/snmptraps
- ./zbx_env/etc/zabbix/zabbix_server.conf:/etc/zabbix/zabbix_server.conf
environment:
DB_SERVER_HOST: mysql-server
DB_SERVER_PORT: 3306
MYSQL_DATABASE: zabbix
MYSQL_USER: zabbix
MYSQL_PASSWORD: zabbix_pwd
ZBX_JAVAGATEWAY: "zabbix-java-gateway"
TZ: Asia/Shanghai
depends_on:
- mysql-server
- zabbix-java-gateway
- zabbix-web-service
restart: always
networks:
zabb:
ipv4_address: 172.21.0.4
zabbix-web:
container_name: zabbix-web
image: zabbix/zabbix-web-nginx-mysql:alpine-5.4-latest
ports:
- "80:8080"
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
- ./zbx_env/usr/share/zabbix:/usr/share/zabbix
- ./zbx_env/etc/php-fpm.d:/etc/php7/php-fpm.d
- ./zbx_env/etc/php-fpm.conf:/etc/php7/php-fpm.conf
- ./zbx_env/etc/php.ini:/etc/php7/php.ini
environment:
DB_SERVER_HOST: mysql-server
DB_SERVER_PORT: 3306
MYSQL_DATABASE: zabbix
MYSQL_USER: zabbix
MYSQL_PASSWORD: zabbix_pwd
MYSQL_ROOT_PASSWORD: root_pwd
TZ: Asia/Shanghai
ZBX_SERVER_HOST: zabbix-server
depends_on:
- mysql-server
- zabbix-server
restart: always
networks:
zabb:
ipv4_address: 172.21.0.5
zabbix-web-service:
container_name: zabbix-web-service
image: zabbix/zabbix-web-service:alpine-5.4-latest
# profiles:
# - full
# - all
ports:
- "10053:10053"
# volumes:
# - ./zbx_env/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
cap_add:
- SYS_ADMIN
extra_hosts:
- "zabbix-server:172.21.0.4"
deploy:
resources:
limits:
cpus: '0.5'
memory: 512M
reservations:
cpus: '0.25'
memory: 256M
# env_file:
# - ./env_vars/.env_web_service
networks:
zabb:
ipv4_address: 172.21.0.6
zabbix-agent:
container_name: zabbix-agent
image: zabbix/zabbix-agent:alpine-5.4-latest
links:
- zabbix-server:zabbix-server
ports:
- "10050:10050"
privileged: true
networks:
zabb:
ipv4_address: 172.21.0.7
networks:
zabb:
driver: bridge
ipam:
config:
- subnet: 172.21.0.0/24
gateway: 172.21.0.1
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
上次更新: 2023/02/23, 18:13:16