centos7安装docker版zabbix server+pg

Posted gsls200808

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7安装docker版zabbix server+pg相关的知识,希望对你有一定的参考价值。

之前写过一篇传统方式安装zabbix5,感觉还是太繁琐,这里直接用docker,10分钟就能安装完成

参考官网安装说明:https://www.zabbix.com/documentation/current/en/manual/installation/containers

参考示例2

1.安装docker

安装命令

yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum list docker-ce --showduplicates | sort -r
yum install -y docker-ce-18.09.0 docker-ce-cli-18.09.0
systemctl start docker.service
systemctl enable docker.service

验证安装

docker version

2.安装docker-compose

安装命令

curl -L https://get.daocloud.io/docker/compose/releases/download/1.29.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

验证安装

docker-compose version

4.创建文件夹

命令如下

mkdir snmp nginx

5.创建docker-compose文件并启动

编辑docker-compose.yml,内容如下

version: '2'
services:
    postgres-server:
     container_name: postgres-server
     image: postgres:latest
     ports:
         - 5432:5432
     environment:
         - POSTGRES_USER=zabbix
         - POSTGRES_PASSWORD=zabbix_pwd
         - POSTGRES_DB=zabbix
         - TZ=Asia/Shanghai
     restart: unless-stopped

    zabbix-snmptraps:
     container_name: zabbix-snmptraps
     image: zabbix/zabbix-snmptraps:alpine-5.4-latest
     ports:
         - 162:1162/udp
     volumes:
         - $PWD/snmp/snmptraps:/var/lib/zabbix/snmptraps:rw
         - $PWD/snmp/mibs:/usr/share/snmp/mibs:ro
     environment:  
         - TZ=Asia/Shanghai
     restart: unless-stopped

    zabbix-server-pgsql:
     container_name: zabbix-server-pgsql
     image: zabbix/zabbix-server-pgsql:alpine-5.4-latest
     ports:
         - 10051:10051
     volumes_from:
         - zabbix-snmptraps:rw
     environment:
         - DB_SERVER_HOST=postgres-server     
         - POSTGRES_USER=zabbix
         - POSTGRES_PASSWORD=zabbix_pwd
         - POSTGRES_DB=zabbix
         - ZBX_ENABLE_SNMP_TRAPS=true
         - TZ=Asia/Shanghai
     restart: unless-stopped

    zabbix-web-nginx-pgsql:
     container_name: zabbix-web-nginx-pgsql
     image: zabbix/zabbix-web-nginx-pgsql:alpine-5.4-latest
     ports:
         - 443:8443
         - 80:8080
     volumes:
         - $PWD/nginx/ssl:/etc/ssl/nginx:ro
     environment:
         - ZBX_SERVER_HOST=zabbix-server-pgsql
         - DB_SERVER_HOST=postgres-server
         - POSTGRES_USER=zabbix
         - POSTGRES_PASSWORD=zabbix_pwd
         - POSTGRES_DB=zabbix     
         - TZ=Asia/Shanghai
     restart: unless-stopped

运行

docker-compose up -d

访问

http://ip

默认账号密码

Admin zabbix

语言时区设置
左侧--User Setting--language改成chinese  时区改成utc+8Asia/Shanghai然后点击Update

 

以上是关于centos7安装docker版zabbix server+pg的主要内容,如果未能解决你的问题,请参考以下文章

Centos7安装Zabbix3.0

centos7安装docker社区版

Centos7.5 lnmp+zabbix一键安装脚本

CentOS7.2 LNMP安装部署zabbix3.2

Linux(Centos7)安装Docker 社区(ce)版(图文并茂详细版!!!)

centos7安装Docker详细步骤(无坑版教程)