最新要闻

广告

手机

iphone11大小尺寸是多少?苹果iPhone11和iPhone13的区别是什么?

iphone11大小尺寸是多少?苹果iPhone11和iPhone13的区别是什么?

警方通报辅警执法直播中被撞飞:犯罪嫌疑人已投案

警方通报辅警执法直播中被撞飞:犯罪嫌疑人已投案

家电

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.debsudo dpkg -i zabbix-release_6.0-4+ubuntu20.04_all.debsudo 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 updatesudo apt-get -y install postgresql

确保数据库服务启动并正常运行。在数据库主机运行以下代码

sudo -u postgres createuser --pwprompt zabbixsudo -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.confDBPassword=password

启动Zabbix server和agent进程

启动Zabbix server和agent进程,并为它们设置开机自启。

sudo systemctl restart zabbix-server zabbix-agent apache2sudo systemctl enable zabbix-server zabbix-agent apache2

打开Zabbix前端页面配置

虚拟机运行的可以通过ifconfig查看IP地址,并通过http://host/zabbix访问。

ens33: flags=4163  mtu 1500        inet 192.168.31.193  netmask 255.255.255.0  broadcast 192.168.31.255        inet6 fe80::1ce1:20af:7447:faf5  prefixlen 64  scopeid 0x20        ether 00:0c:29:cd:ef:83  txqueuelen 1000  (Ethernet)        RX packets 55216  bytes 76688088 (76.6 MB)        RX errors 0  dropped 0  overruns 0  frame 0        TX packets 25210  bytes 2166096 (2.1 MB)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0lo: flags=73  mtu 65536        inet 127.0.0.1  netmask 255.0.0.0        inet6 ::1  prefixlen 128  scopeid 0x10        loop  txqueuelen 1000  (Local Loopback)        RX packets 10820  bytes 14683581 (14.6 MB)        RX errors 0  dropped 0  overruns 0  frame 0        TX packets 10820  bytes 14683581 (14.6 MB)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 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[2813]: 2022-07-14 10:14:00 0 [Note] /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[2813]: 2022-07-14 10:14:00 0 [Warning] Can"t create test file /usr/local/mysql/data/ubuntu20.lower-testJul 14 10:14:00 ubuntu20 mariadbd[2813]: 2022-07-14 10:14:00 0 [ERROR] mariadbd: File "./mysql-bin.index" not found (Errcode: 30 "Read-only file system")

解决办法:

MariaDB cannot start after update: [Warning] 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 [file:dbconfig.c,line:89] __zbx_mem_malloc(): out of memory (requested 256 bytes) 11531:20220714:110546.762 [file:dbconfig.c,line:89] __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```

关键词: 数据库密码 账号密码 配置文件