Dockerfile 研究-[zabbix 安装]-mysql版本

zabbix 版本

6.0.30

7.0.0

项目地址

项目地址

标题链接
zabbix_6.0.x_dockerzabbix_6.0.x_docker
zabbix_7.0.x_dockerzabbix_7.0.x_docker

一键安装包

标题链接
zabbix_6.0.x_dockerzabbix_6.0.x_docker
zabbix_7.0.x_dockerzabbix_7.0.x_docker

效果图

[root@localhost zabbix_docker]# docker images  
REPOSITORY               TAG                 IMAGE ID       CREATED        SIZE  
zabbix-server-mysql      rocky-7.0-latest   5bbe1784ca86   4 days ago     889MB  
zabbix-web-service       rocky-7.0-latest   302c32090933   4 days ago     732MB  
zabbix-proxy-mysql       rocky-7.0-latest   2af003bb178b   4 days ago     673MB  
zabbix-java-gateway      rocky-7.0-latest   6825b642100d   4 days ago     720MB  
zabbix-snmptraps         rocky-7.0-latest   d444eab79de1   4 days ago     601MB  
zabbix-agent2            rocky-7.0-latest   ddb84f925c55   4 days ago     615MB  
mariadb                  10.5.19-focal      cfe0a83e48d5   8 days ago     392MB  
zabbix-web-nginx-mysql   rocky-7.0-latest   64081ecac82f   6 weeks ago    774MB  
rockylinux               8                  6a97c47aacfc   3 months ago   513MB  
[root@localhost zabbix_docker]# [root@localhost zabbix_docker]# docker ps -a  
CONTAINER ID   IMAGE                                      COMMAND                  CREATED          STATUS                    PORTS                                                                            NAMES  
977e75774418   zabbix-web-nginx-mysql:rocky-7.0-latest   "docker-entrypoint.sh"   15 minutes ago   Up 15 minutes (healthy)   0.0.0.0:80->8080/tcp, :::80->8080/tcp, 0.0.0.0:443->8443/tcp, :::443->8443/tcp   zabbix_docker-zabbix-web-nginx-mysql-1  
0770a23343e9   zabbix-server-mysql:rocky-7.0-latest      "/usr/bin/tini -- /u…"   15 minutes ago   Up 15 minutes             0.0.0.0:10051->10051/tcp, :::10051->10051/tcp                                    zabbix_docker-zabbix-server-1  
98aecf59d879   zabbix-agent2:rocky-7.0-latest            "/usr/bin/tini -- /u…"   15 minutes ago   Up 15 minutes             0.0.0.0:10050->10050/tcp, :::10050->10050/tcp, 31999/tcp                         zabbix_docker-zabbix-agent2-1  
ec9e9cd0ed74   zabbix-java-gateway:rocky-7.0-latest      "docker-entrypoint.s…"   15 minutes ago   Up 15 minutes                                                                                              zabbix_docker-zabbix-java-gateway-1  
d0d7d7977b99   zabbix-snmptraps:rocky-7.0-latest         "/usr/sbin/snmptrapd…"   15 minutes ago   Up 15 minutes             0.0.0.0:162->1162/udp, :::162->1162/udp                                          zabbix_docker-zabbix-snmptraps-1  
b72cdae7ba93   zabbix-web-service:rocky-7.0-latest       "docker-entrypoint.s…"   15 minutes ago   Up 15 minutes                                                                                              zabbix_docker-zabbix-web-service-1  
0b8819153360   mariadb:10.5.19-focal                      "docker-entrypoint.s…"   15 minutes ago   Up 15 minutes             0.0.0.0:3306->3306/tcp, :::3306->3306/tcp                                        zabbix_docker-mysql-server-1  
[root@localhost zabbix_docker]#   

集成全中文模板


[Rocky8|centos7|centos8]

执行如下命令进行git安装

yum -y install git

执行如下命令克隆docker安装中文版zabbix项目

ZBX_SOURCES=https://gitcode.net/1284524409/zabbix.git
ZBX_VERSION=zabbix_7.0.x_docker
ZBX_NAME=zabbix_docker-7.0-latest
ZBX_DIR=/opt
cd ${ZBX_DIR}
git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch ${ZBX_DIR}/${ZBX_NAME}
chmod 755 -R ${ZBX_DIR}/${ZBX_NAME}
cd ${ZBX_DIR}/${ZBX_NAME}

执行如下命令安装docker服务

sh update_config-entrypoint_mysql.sh init
# sh update_config-entrypoint_pgsql.sh init

执行如下命令下载docker镜像

sh update_config-entrypoint_mysql.sh down
# sh update_config-entrypoint_mysql.sh down_proxy
# sh update_config-entrypoint_pgsql.sh down
# sh update_config-entrypoint_pgsql.sh down_proxy

执行如下命令初始化配置文件

sh update_config-entrypoint_mysql.sh cp
# sh update_config-entrypoint_mysql.sh cp_proxy
# sh update_config-entrypoint_pgsql.sh cp
# sh update_config-entrypoint_pgsql.sh cp_proxy

执行如下命令启动docker容器

sh update_config-entrypoint_mysql.sh start
# sh update_config-entrypoint_mysql.sh start_proxy
# sh update_config-entrypoint_pgsql.sh start
# sh update_config-entrypoint_pgsql.sh start_proxy

[Ubuntu]

ubunt系统请参考如下命令手动执行

root@ubuntu:/opt/zabbix_docker-7.0-latest# cat /etc/os-release | grep "Ubuntu "
PRETTY_NAME="Ubuntu 23.10"
ubuntu@ubuntu:~$ sudo sed -i 's/https:\/\/mirrors.aliyun.com/http:\/\/mirrors.cloud.aliyuncs.com/g' /etc/apt/sources.list
ubuntu@ubuntu:~$ sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
ubuntu@ubuntu:~$ curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | apt-key add -
ubuntu@ubuntu:~$ sudo passwd root
New password: 
Retype new password: 
passwd: password updated successfully
ubuntu@ubuntu:~$ su
Password: 
root@ubuntu:/home/ubuntu# curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | apt-key add -
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK
root@ubuntu:/home/ubuntu# add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
root@ubuntu:/home/ubuntu# apt-get -y install docker-ce
root@ubuntu:/home/ubuntu# service docker start
root@ubuntu:/home/ubuntu# apt install git
root@ubuntu:/home/ubuntu# ZBX_SOURCES=https://gitcode.net/1284524409/zabbix.git
root@ubuntu:/home/ubuntu# ZBX_VERSION=zabbix_7.0.x_docker
root@ubuntu:/home/ubuntu# ZBX_NAME=zabbix_docker-7.0-latest
root@ubuntu:/home/ubuntu# ZBX_DIR=/opt
root@ubuntu:/home/ubuntu# cd ${ZBX_DIR}
root@ubuntu:/opt# git -c advice.detachedHead=false clone ${ZBX_SOURCES} --branch ${ZBX_VERSION} --depth 1 --single-branch ${ZBX_DIR}/${ZBX_NAME}
root@ubuntu:/opt# chmod 755 -R ${ZBX_DIR}/${ZBX_NAME}
root@ubuntu:/opt# cd ${ZBX_DIR}/${ZBX_NAME}
root@ubuntu:/opt/zabbix_docker-7.0-latest# ls -al /bin/sh
lrwxrwxrwx 1 root root 4 Jul 11  2023 /bin/sh -> dash
root@ubuntu:/opt/zabbix_docker-7.0-latest# sudo ln -fs /bin/bash /bin/sh
root@ubuntu:/opt/zabbix_docker-7.0-latest# ls -al /bin/sh
lrwxrwxrwx 1 root root 9 Jan 12 05:42 /bin/sh -> /bin/bash
root@ubuntu:/opt/zabbix_docker-7.0-latest# sh update_config-entrypoint_mysql.sh init
root@ubuntu:/opt/zabbix_docker-7.0-latest# sh update_config-entrypoint_mysql.sh down
root@ubuntu:/opt/zabbix_docker-7.0-latest# sh update_config-entrypoint_mysql.sh cp
root@ubuntu:/opt/zabbix_docker-7.0-latest# sh update_config-entrypoint_mysql.sh start

打开网页输入服务器IP地址访问zabbix
http://IP:8080 或 https://IP:8443
用户名: Admin
密码: zabbix

打开网页输入服务器IP地址访问grafana
https://IP:3000
用户名: admin
密码: admin

将grafana界面设置成中文

**启用zabbix插件

连接zabbix数据库插件

新建zabbix数据库连接
https://zabbix-web-nginx-mysql:8443/api_jsonrpc.php

输入正确的用户名密码
Admin/zabbix

zabbix-server服务器同时优化成了rsyslog日志服务器,rsyslog日志端口为514
日志存储路径为 /var/log/loki/

grafana优化集成了zabbix与Loki插件
请将任意.log后缀日志存入 /var/log/loki/即可连接到loki
URL为http://IP:3100

存储位置

映射的卷位于当前文件夹的zbx_env目录

zabbix-server配置文件位置
/opt/zabbix_docker-7.0-latest/env_vars/.env_srv

后期如果有新版本发布可以通过如下命令更新zabbix版本

sh update_config-entrypoint_mysql.sh stop
# sh update_config-entrypoint_pgsql.sh stop

ZBX_SOURCES=https://gitcode.net/1284524409/zabbix.git
ZBX_VERSION=zabbix_7.0.x_docker
ZBX_NAME=zabbix_docker-7.0-latest
ZBX_DIR=/opt
git init
git remote add origin ${ZBX_SOURCES}
cd ${ZBX_DIR}/${ZBX_NAME}
git remote -v
git fetch --all
git reset --hard origin/${ZBX_VERSION}
git pull  ${ZBX_SOURCES} ${ZBX_VERSION}
chmod 755 -R ${ZBX_DIR}/${ZBX_NAME}
cd ${ZBX_DIR}/${ZBX_NAME}

sh update_config-entrypoint_mysql.sh down
# sh update_config-entrypoint_pgsql.sh down

sh update_config-entrypoint_mysql.sh start
# sh update_config-entrypoint_pgsql.sh start

交流群

zabbix-答疑群zabbix-汉化群
微信打赏微信打赏

全文完结 |

  • 9
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 11
    评论
Zabbix是一款开源的网络监控和报警系统,可以用于监控服务器、网络设备、虚拟机等。下面是Linux系统上安装Zabbix的操作步骤: 1. 安装所需软件: - 在Debian/Ubuntu系统上,使用以下命令安装所需软件: ``` sudo apt-get update sudo apt-get install apache2 mysql-server mysql-client php php-mysql php-gd php-xml php-bcmath php-mbstring php-ldap php-xmlrpc ``` - 在CentOS/RHEL系统上,使用以下命令安装所需软件: ``` sudo yum install httpd mariadb-server mariadb php php-mysql php-gd php-xml php-bcmath php-mbstring php-ldap php-xmlrpc ``` 2. 配置数据库: - 启动并设置MariaDB/MySQL服务: ``` sudo systemctl start mariadb sudo systemctl enable mariadb ``` - 运行以下命令来设置MariaDB/MySQL的root密码和其他配置: ``` sudo mysql_secure_installation ``` - 创建一个新的数据库和用户: ``` sudo mysql -u root -p CREATE DATABASE zabbixdb character set utf8 collate utf8_bin; GRANT ALL PRIVILEGES ON zabbixdb.* TO 'zabbixuser'@'localhost' IDENTIFIED BY 'password'; FLUSH PRIVILEGES; EXIT; ``` 3. 下载和安装Zabbix Server: - 下载最新的Zabbix Server软件包: ``` wget https://repo.zabbix.com/zabbix/5.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.4-1+ubuntu20.04_all.deb ``` - 安装Zabbix Server软件包: ``` sudo dpkg -i zabbix-release_5.4-1+ubuntu20.04_all.deb sudo apt-get update sudo apt-get install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-agent ``` 4. 导入Zabbix数据库模板: - 运行以下命令导入Zabbix数据库模板: ``` sudo zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | sudo mysql -u zabbixuser -p zabbixdb ``` 5. 配置Zabbix Server: - 编辑Zabbix Server配置文件: ``` sudo nano /etc/zabbix/zabbix_server.conf ``` - 修改以下参数: ``` DBHost=localhost DBName=zabbixdb DBUser=zabbixuser DBPassword=password ``` - 保存并关闭文件。 6. 配置Zabbix Frontend: - 编辑Zabbix Frontend配置文件: ``` sudo nano /etc/zabbix/apache.conf ``` - 修改以下参数: ``` php_value date.timezone Asia/Shanghai ``` - 保存并关闭文件。 7. 启动Zabbix服务: - 启动Zabbix Server和Zabbix Agent服务: ``` sudo systemctl start zabbix-server sudo systemctl enable zabbix-server sudo systemctl start zabbix-agent sudo systemctl enable zabbix-agent ``` 8. 访问Zabbix Web界面: - 打开Web浏览器,访问以下URL: ``` http://服务器IP地址/zabbix ``` - 根据安装向导完成Zabbix的初始化配置。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

NoYoWiFi

感谢大佬赐赏

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值