【原创】docker +宝塔+安装zabbix

 Zabbix: Zabbix可以监控各种网络服务、服务器和网络设备,而无需在目标设备上安装客户端。它的强大之处在于自带的Web界面,能够提供实时监控和各种报警功能。【原创】docker +宝塔+安装zabbix_第1张图片方法1:

步骤

  1. 创建Docker Compose文件: 首先,你需要创建一个docker-compose.yml文件来定义Zabbix所需的服务。

    version: '3'
    services:
      zabbix-server:
        image: zabbix/zabbix-server-mysql:latest
        environment:
          DB_SERVER_HOST: "mysql-server"
          MYSQL_DATABASE: "zabbix"
          MYSQL_USER: "zabbix"
          MYSQL_PASSWORD: "your_password"
        ports:
          - "10051:10051"
        depends_on:
          - mysql-server
    
      mysql-server:
        image: mysql:5.7
        environment:
          MYSQL_DATABASE: "zabbix"
          MYSQL_USER: "zabbix"
          MYSQL_PASSWORD: "your_password"
          MYSQL_ROOT_PASSWORD: "root_password"
        volumes:
          - zabbix-mysql:/var/lib/mysql
    
      zabbix-web-nginx-mysql:
        image: zabbix/zabbix-web-nginx-mysql:latest
        environment:
          DB_SERVER_HOST: "mysql-server"
          MYSQL_DATABASE: "zabbix"
          MYSQL_USER: "zabbix"
          MYSQL_PASSWORD: "your_password"
          ZBX_SERVER_HOST: "zabbix-server"
        ports:
          - "80:8080"
        depends_on:
          - mysql-server
          - zabbix-server
    
    volumes:
      zabbix-mysql:
    

    这个docker-compose.yml文件定义了三个服务:Zabbix服务器、MySQL数据库和Zabbix前端(使用Nginx)。

  2. 启动服务: 在包含此docker-compose.yml文件的目录中运行以下命令:

    docker-compose up -d

    这将会下载必要的Docker镜像,并启动Zabbix服务。

方法二:

用BT宝塔的数据库,新建一个zabbixdocker【原创】docker +宝塔+安装zabbix_第2张图片

 docker-compose.yml

version: '3'
services:
  zabbix-server:
    image: zabbix/zabbix-server-mysql:latest
    environment:
      DB_SERVER_HOST: "192.177.254.115"
      MYSQL_DATABASE: "zabbixdocker"
      MYSQL_USER: "zabbixdocker"
      MYSQL_PASSWORD: "123456"
    ports:
      - "10051:10051"

  zabbix-web-nginx-mysql:
    image: zabbix/zabbix-web-nginx-mysql:latest
    environment:
      DB_SERVER_HOST: "192.177.254.115"
      MYSQL_DATABASE: "zabbixdocker"
      MYSQL_USER: "zabbixdocker"
      MYSQL_PASSWORD: "123456"
      ZBX_SERVER_HOST: "zabbix-server"
    ports:
      - "8081:8080"
    depends_on:
      - zabbix-server

你可能感兴趣的:(docker,zabbix,容器,宝塔)