天国 发表于 2023-2-25 15:32:15

Ubuntu安装Zabbix6.0

环境

[*]系统:Ubuntu 20.04
[*]虚拟平台:Vmware Workstation 16 PRO
[*]软件版本:Zabbix 6.0 LTS
[*]数据库:PostgreSQL
[*]Web服务:Apache
新建虚拟机(物理机跳过)

Ubuntu安装优化
安装Zabbix仓库

wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-4%2Bubuntu20.04_all.deb
sudo dpkg -i zabbix-release_6.0-4+ubuntu20.04_all.deb
sudo apt update安装Zabbix server,Web前端,agent

sudo apt install zabbix-server-pgsql zabbix-frontend-php php7.4-pgsql zabbix-apache-conf zabbix-sql-scripts zabbix-agent创建初始数据库

安装PostgreSQL数据库
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install postgresql确保数据库服务启动并正常运行。
在数据库主机运行以下代码
sudo -u postgres createuser --pwprompt zabbix
sudo -u postgres createdb -O zabbix zabbix导入初始架构和数据。
zcat /usr/share/zabbix-sql-scripts/postgresql/server.sql.gz | sudo -u zabbix psql zabbix为Zabbix server配置数据库

将password改为你设置的数据库密码。
sudo vim /etc/zabbix/zabbix_server.conf

DBPassword=password启动Zabbix server和agent进程

启动Zabbix server和agent进程,并为它们设置开机自启。
sudo systemctl restart zabbix-server zabbix-agent apache2
sudo systemctl enable zabbix-server zabbix-agent apache2打开Zabbix前端页面配置

虚拟机运行的可以通过ifconfig查看IP地址,并通过http://host/zabbix访问。
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>mtu 1500
      inet 192.168.31.193netmask 255.255.255.0broadcast 192.168.31.255
      inet6 fe80::1ce1:20af:7447:faf5prefixlen 64scopeid 0x20<link>
      ether 00:0c:29:cd:ef:83txqueuelen 1000(Ethernet)
      RX packets 55216bytes 76688088 (76.6 MB)
      RX errors 0dropped 0overruns 0frame 0
      TX packets 25210bytes 2166096 (2.1 MB)
      TX errors 0dropped 0 overruns 0carrier 0collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>mtu 65536
      inet 127.0.0.1netmask 255.0.0.0
      inet6 ::1prefixlen 128scopeid 0x10<host>
      looptxqueuelen 1000(Local Loopback)
      RX packets 10820bytes 14683581 (14.6 MB)
      RX errors 0dropped 0overruns 0frame 0
      TX packets 10820bytes 14683581 (14.6 MB)
      TX errors 0dropped 0 overruns 0carrier 0collisions 0选择好语言,点下一步。
检测没问题,点下一步。

输入数据库密码,点下一步。
设置Zabbix主机名称,点下一步。

点下一步,完成安装。

默认账号:Admin
默认密码:zabbix
登录

输入访问地址,账号密码,就可以正常使用Zabbix了。

使用Mariadb数据库

安装mariadb数据库(要求版本10.5以上)
Download MariaDB Server - MariaDB.org
根据文档命令进行安装
mariadb:create test file /usr/local/mysql/data/ubuntu20.lower-test

错误提示:
Jul 14 10:14:00 ubuntu20 mariadbd: 2022-07-14 10:14:00 0 /usr/sbin/mariadbd (mysqld 10.5.16-MariaDB-1:10.5.16+maria~focal-log) starting as process 2813 ...
Jul 14 10:14:00 ubuntu20 mariadbd: 2022-07-14 10:14:00 0 Can't create test file /usr/local/mysql/data/ubuntu20.lower-test
Jul 14 10:14:00 ubuntu20 mariadbd: 2022-07-14 10:14:00 0 mariadbd: File './mysql-bin.index' not found (Errcode: 30 "Read-only file system")解决办法:
MariaDB cannot start after update: Can't create test file /home/mysql/beta.lower-test
mariadb fails to start on raw drive filesystem
乱码

zabbix6 中文乱码处理_dbfedbf的博客-CSDN博客
错误

zabbix-server 停止服务

查看日志cat /var/log/zabbix/zabbix_server.log
11531:20220714:110546.762 __zbx_mem_malloc(): out of memory (requested 256 bytes)
11531:20220714:110546.762 __zbx_mem_malloc(): please increase CacheSize configuration parameter
11531:20220714:110546.762 === memory statistics for configuration cache ===
11531:20220714:110546.762 free chunks of size   24 bytes:       68
11531:20220714:110546.762 free chunks of size   32 bytes:      4
11531:20220714:110546.762 free chunks of size   40 bytes:      1
11531:20220714:110546.762 min chunk size:         24 bytes
11531:20220714:110546.762 max chunk size:         40 bytes
11531:20220714:110546.762 memory of total size 29254736 bytes fragmented into 268708 chunks
11531:20220714:110546.762 of those,       1800 bytes are in       73 free chunks
11531:20220714:110546.762 of those,   29252936 bytes are in   268635 used chunks
11531:20220714:110546.762 of those,    4299312 bytes are used by allocation overhead日志显示需要增加CacheSize的容量。
修改配置文件,增加缓存大小。
vim /etc/zabbix/zabbix_server.conf
# 根据机器配置修改容量
CacheSize=8G```
来源:https://www.cnblogs.com/solita1y/p/17153976.html
免责声明:由于采集信息均来自互联网,如果侵犯了您的权益,请联系我们【E-Mail:cb@itdo.tech】 我们会及时删除侵权内容,谢谢合作!
页: [1]
查看完整版本: Ubuntu安装Zabbix6.0