zabbix部署原创
# 1.编写docker-compose.yaml文件
version: '3'
services:
# DB
mysql:
image: mysql:8.0
container_name: mysql
volumes:
- ${DEPLOY_PATH}/data:/var/lib/mysql
- ${DEPLOY_PATH}/mysql/conf:/etc/mysql/conf.d
- ${DEPLOY_PATH}/mysql/logs:/var/log/mysql
- /etc/localtime:/etc/localtime:ro
restart: always
privileged: true
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_DATABASE=zabbix
- MYSQL_USER=zabbix
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- TZ=Asia/Shanghai
- LANG=en_US.UTF-8
ports:
- "3306:3306"
# Gateway
zabbix-gateway:
image: zabbix/zabbix-java-gateway:6.0-centos-latest
container_name: zabbix-gateway
volumes:
- /etc/localtime:/etc/localtime:ro
restart: always
privileged: true
ports:
- "10052:10052"
# Server
zabbix-server:
image: zabbix/zabbix-server-mysql:6.0-centos-latest
container_name: zabbix-server
volumes:
- /etc/localtime:/etc/localtime:ro
- ${DEPLOY_PATH}/snmptraps:/var/lib/zabbix/snmptraps
- ${DEPLOY_PATH}/mibs:/var/lib/zabbix/mibs
- ${DEPLOY_PATH}/alertscripts:/usr/lib/zabbix/alertscripts
- ${DEPLOY_PATH}/externalscripts:/usr/lib/zabbix/externalscripts
restart: always
privileged: true
environment:
- ZBX_LISTENPORT=10051
- DB_SERVER_HOST=mysql
- DB_SERVER_PORT=3306
- MYSQL_DATABASE=zabbix
- MYSQL_USER=root
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_ROOT_PASSWORD=zabbix
- ZBX_CACHESIZE=256M
- ZBX_HISTORYCACHESIZE=256M
- ZBX_HISTORYINDEXCACHESIZE=16M
- ZBX_TRENDCACHESIZE=128M
- ZBX_VALUECACHESIZE=128M
- ZBX_STARTPINGERS=64
- ZBX_IPMIPOLLERS=1
- ZBX_ENABLE_SNMP_TRAPS=true
- ZBX_STARTTRAPPERS=1
- ZBX_JAVAGATEWAY_ENABLE=true
- ZBX_JAVAGATEWAY=zabbix-gateway
- ZBX_STARTJAVAPOLLERS=1
ports:
- "10051:10051"
links:
- mysql
- zabbix-gateway
# WEB
zabbix-web:
image: zabbix/zabbix-web-nginx-mysql:6.0-centos-latest
container_name: zabbix-web
volumes:
- ${DEPLOY_PATH}/font/simfang.ttf:/usr/share/zabbix/assets/fonts/DejaVuSans.ttf
- /etc/localtime:/etc/localtime
restart: always
privileged: true
environment:
- ZBX_SERVER_NAME=Zabbix 6.0
- ZBX_SERVER_HOST=zabbix-server
- ZBX_SERVER_PORT=10051
- DB_SERVER_HOST=mysql
- DB_SERVER_PORT=3306
- MYSQL_DATABASE=zabbix
- MYSQL_USER=root
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- PHP_TZ=Asia/Shanghai
ports:
- "8081:8080"
links:
- mysql
- zabbix-server
zabbix-agent:
image: zabbix/zabbix-agent
container_name: zabbix-agent
volumes:
- /etc/localtime:/etc/localtime:ro
- ${DEPLOY_PATH}/zabbix_agentd.d:/etc/zabbix/zabbix_agentd.d:ro
- ${DEPLOY_PATH}/var/lib/zabbix/modules:/var/lib/zabbix/modules:ro
- ${DEPLOY_PATH}/var/lib/zabbix/enc:/var/lib/zabbix/enc:ro
- ${DEPLOY_PATH}/var/lib/zabbix/ssh_keys:/var/lib/zabbix/ssh_keys:ro
tmpfs: /tmp
restart: always
privileged: true
ports:
- "10050:10050"
pid: "host"
stop_grace_period: 5s
environment:
- ZBX_SERVER_HOST=${Server}
- ZBX_SERVER_PORT=10051
- ZBX_HOSTNAME=${Server}
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
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
# 2.编写.env文件
DEPLOY_PATH='' //部署路径
MYSQL_ROOT_PASSWORD='' //数据库密码
MYSQL_PASSWORD='' //数据库管理员密码
Server='' //服务器IP
1
2
3
4
2
3
4
# 3.修改配置文件Sever
, SeverActive
, Hostname
为服务器IP
vi /etc/zabbix_agentd.conf
1
提示
vi进入编辑后可以使用/Sever(/关键字)回车进行全文查找,按n查找下一个
上次更新: 2024/08/29 14:06:33
- 01
- element-plus多文件手动上传 原创11-03
- 02
- TrueLicense 创建及安装证书 原创10-25
- 03
- 手动修改迅捷配置 原创09-03
- 04
- 安装 acme.sh 原创08-29
- 05
- git使用 原创07-15