一、Ubuntu22.04 LTS 部署zabbix7.0
环境准备
| IP | 主机名 | 配置 |
|---|---|---|
| 10.0.0.50 | zabbix-01 | 2c4G |
| 10.0.0.51 | zabbix-agent | 2c4G |
| 10.0.0.52 | db | 2c4G |
1. 添加zabbix仓库
[root@zabbix-01:~]# wget https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_latest_7.0+ubuntu22.04_all.deb [root@zabbix-01:~]# dpkg -i zabbix-release_latest_7.0+ubuntu22.04_all.deb [root@zabbix-01:~]# apt update
2. 安装 Zabbix 相关软件包
[root@zabbix-01:~]# apt install -y zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-sql-scripts zabbix-agent
3. 安装MySQL
[root@db:~]# apt install -y mysql-server-8.0 [root@db:~]# netstat -tnulp | grep 3306 tcp 0 0 127.0.0.1:33060 0.0.0.0:* LISTEN 1974/mysqld tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 1974/mysqld
4. 创建初始数据库
[root@db:~]# mysql Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 8 Server version: 8.0.40-0ubuntu0.22.04.1 (Ubuntu) Copyright (c) 2000, 2024, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or 'h'forhelp. Type 'c' to clear the current input statement. mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin; mysql> create user zabbix@'%' identified by 'zabbix'; mysql> grant all privileges on zabbix.* to zabbix@'%'; mysql> set global log_bin_trust_function_creators = 1; mysql> quit;
导入初始架构和数据,系统将提示您输入新创建的密码
[root@zabbix-01:~]# scp /usr/share/zabbix-sql-scripts/mysql/server.sql.gz 10.0.0.52:/root [root@db:~]# zcat server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix Enter password:# 输密码的时候不显示字符,此处我输入了 zabbix [root@db:~]# mysql mysql> set global log_bin_trust_function_creators = 0; mysql> quit;
5. 为Zabbix server配置数据库
[root@zabbix-01:~]# egrep '^DBHost|^DBName|^DBUser|^DBPassword' /etc/zabbix/zabbix_server.conf DBHost=10.0.0.52 DBName=zabbix DBUser=zabbix DBPassword=zabbix
6. 为Zabbix前端配置PHP
[root@zabbix-01:~]# cat /etc/zabbix/nginx.conf
server {
listen 8080;
server_name 10.0.0.50;
...
7. 启动Zabbix server和agent进程
[root@zabbix-01:~]# systemctl restart zabbix-server zabbix-agent nginx php8.1-fpm [root@zabbix-01:~]# systemctl enable zabbix-server zabbix-agent nginx php8.1-fpm
8. 设置中文web界面
10.0.0.50:8080

# 列出所有已安装的语言 [root@zabbix-01:~]# locale -a C C.utf8 POSIX en_US.utf8 [root@zabbix-01:~]# sed -n '/zh_CN.UTF-8 UTF-8/p' /etc/locale.gen # zh_CN.UTF-8 UTF-8 [root@zabbix-01:~]# sed -i 's/# zh_CN.UTF-8 UTF-8/zh_CN.UTF-8 UTF-8/' /etc/locale.gen [root@zabbix-01:~]# sed -n '/zh_CN.UTF-8 UTF-8/p' /etc/locale.gen zh_CN.UTF-8 UTF-8 [root@zabbix-01:~]# locale-gen [root@zabbix-01:~]# systemctl restart zabbix-server zabbix-agent nginx php8.1-fpm

9. web界面安装zabbix



下一步将时区改为 (UTC+08:00) Asia/Shanghai, 图片上遗忘了,也可以后期去设置里面改


10.访问web界面
10.0.0.50:8080 账号:Admin 密码:zabbix


二、监控主机
1. 在需要监控的主机上安装zabbix-agent
[root@zabbix-agent:~]# apt -y install zabbix-agent
2. 修改zabbix-agent的配置文件
[root@zabbix-agent:~]# vim /etc/zabbix/zabbix_agentd.conf ... 117 Server=10.0.0.50 ...
3. 重启zabbix-agent服务
[root@zabbix-agent:~]# systemctl restart zabbix-agent.service
4. web界面添加主机


最终的配置


5. web界面查看主机监控


链接:https://www.cnblogs.com/cxjyyds/p/18624841
全部0条评论
快来发表一下你的评论吧 !