zabbix:docker-compose

2 篇文章 0 订阅
2 篇文章 0 订阅
version: "3"
services:
  mysql-server:
    image: mysql:8.0
    container_name: mysql-server
    command: --character-set-server=utf8
    #--character-set-server=utf8 设置中文解决乱码   
    restart: always 
    environment:
      - MYSQL_DATABASE=zabbix
      - MYSQL_USER=zabbix
      - MYSQL_PASSWORD=zabbix_pwd
      - MYSQL_ROOT_PASSWORD=root_pwd
    ports:
      - 3306:3306
    volumes:
      - /zabbix-mysql:/var/lib/mysql
      - /etc/localtime:/etc/localtime
      - /etc/timezone:/etc/timezone
  zabbix-java-gateway:
    image: zabbixmultiarch/zabbix-java-gateway-alpine
    container_name: zabbix-java-gateway
  zabbix-server-mysql:
    image: zabbix/zabbix-server-mysql:alpine-latest
    container_name: zabbix-server-mysql
    ulimits:
       nproc: 65535
       nofile:
        soft: 20000
        hard: 40000
    #指定容器的 ulimits 限制值最大进程数为 65535,指定文件句柄数为 20000(软限制,应用可以随时修改,不能超过硬限制) 和 40000(系统硬限制,只能 root 用户提高)。   
    privileged: true
    #允许容器中运行一些特权命令
    cap_add: 
     - ALL
    #容器的内核能力(capacity)分配
    restart: always
    environment:
      - DB_SERVER_HOST=mysql-server
      - MYSQL_USER=zabbix
      - MYSQL_PASSWORD=zabbix_pwd
      - MYSQL_DATABASE=zabbix
      - MYSQL_ROOT_PASSWORD=root_pwd
      - ZBX_JAVAGATEWAY=zabbix-java-gateway
    ports:
      - 10051:10051
    links:
      - mysql-server:mysql:8.0
    depends_on:
      - mysql-server
    volumes:
      - /etc/localtime:/etc/localtime
      - /etc/timezone:/etc/timezone
      - zabbix-server-conf:/etc/zabbix
      - zabbix-server-alertscripts:/usr/lib/zabbix/alertscripts
  zabbix-web:
    image: zabbix/zabbix-web-nginx-mysql:alpine-latest
    environment:
      - DB_SERVER_HOST=mysql-server
      - PHP_TZ=Asia/Shanghai
      - MYSQL_USER=zabbix
      - MYSQL_PASSWORD=zabbix_pwd
      - MYSQL_DATABASE=zabbix
      - MYSQL_ROOT_PASSWORD=root_pwd
      - ZBX_SERVER_HOST=zabbix-server-mysql
    restart: always
    ports:
      - 8080:8080
    volumes:
      - /etc/localtime:/etc/localtime
      - /etc/timezone:/etc/timezone
    links:
      - mysql-server:mysql:8.0
      - zabbix-server-mysql:zabbix-server
    depends_on:
      - mysql-server
      - zabbix-server-mysql
  zabbix-agent:
    image: zabbix/zabbix-agent2
    privileged: true
    restart: always
    cap_add: 
    - ALL
    volumes:
     - /etc/timezone:/etc/timezone
    environment:
      - ZBX_SERVER_HOST=zabbix-server-mysql
    ports:
      - '10050:10050'
volumes:
  zabbix-server-conf:
  zabbix-server-alertscripts:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值