1. 安装docker-compose
wget "https://github.com/docker/compose/releases/download/v2.17.2/docker-compose-linux-x86_64"
mv docker-compose-linux-x86_64 /usr/bin/docker-compose
chmod +x /usr/bin/docker-compose
docker-compose --version
2.安装zabbix
创建目录
mkdir /zabbix/{alertscripts,db,fonts} -p
cd /zabbix/
编辑docker-compose.yml
version: "3"
services:
mysql-server:
image: repository.bde.local/zabbix/mysql:5.7
ports:
- "3306:3306"
volumes:
- "/zabbix/db:/var/lib/mysql"
environment:
MYSQL_ROOT_PASSWORD: 123123
TZ: Asia/Shanghai
command: --character-set-server=utf8 --collation-server=utf8_bin
restart: always
zabbix-server:
image: repository.bde.local/zabbix/zabbix-server-mysql:centos-4.0.10
volumes:
- "/zabbix/alertscripts:/usr/lib/zabbix/alertscripts"
environment:
DB_SERVER_HOST: 127.0.0.1
DB_SERVER_PORT: 3306
MYSQL_DATABASE: zabbix
MYSQL_USER: root
MYSQL_PASSWORD: 123123
TZ: Asia/Shanghai
depends_on:
- mysql-server
restart: always
network_mode: "host"
zabbix-web:
image: repository.bde.local/zabbix/zabbix-web-nginx-mysql:centos-4.0.10
ports:
- "80:80"
volumes:
- "/zabbix/fonts/simkai.ttf:/usr/share/zabbix/assets/fonts/DejaVuSans.ttf"
environment:
DB_SERVER_HOST: mysql-server
DB_SERVER_PORT: 3306
MYSQL_DATABASE: zabbix
MYSQL_USER: root
MYSQL_PASSWORD: 123123
TZ: Asia/Shanghai
ZBX_SERVER_HOST: 10.10.10.153
depends_on:
- mysql-server
- zabbix-server
restart: always
3. 上传电脑上的字体
楷体常规
C:\Windows\Fonts\simkai.ttf
4. 启动zabbix服务
docker-compose up -d
访问zabbix
http://10.10.10.153
5. 安装zabbix-agent
下载对应版本的zabbixagent包,安装
http://repo.zabbix.com/zabbix/4.0/
5.1 修改配置文件
vim /etc/zabbix/zabbix_agentd.conf
Server=10.10.10.153
ServerActive=10.10.10.153
UnsafeUserParameters=1
5.2 启动zabbix-agent
systemctl enable zabbix-agent
systemctl restart zabbix-agent
systemctl status zabbix-agent