当前位置: 首页 > news >正文

Zabbix-6.4.4部署及监控配置

一、目标

对zabbix-6.4.4版本进行调研。了解并测试zabbix-6.4.4部署以及监控配置。

二、过程

前言:最新版本的zabbix-6.4.4的要求有所增加,配置要求如下:
MySQL版本:8.0.X

PHP版本:7.4.X

libXML:2.6.15以上

具体要求可访问官网:​​​​​​2 安装要求 (zabbix.com)

1、下载安装包
https://www.zabbix.com/cn/download_sources2、上传安装到相应服务器的文件中并解压
cd /opt/software
tar -zxvf zabbix-6.4.4.tar.gz3、创建zabbix用户
groupadd --system zabbix
useradd --system -g zabbix -d /usr/lib/zabbix -s /sbin/nologin -c "Zabbix Monitoring System" zabbix4、创建zabbix文件夹
mkdir -m u=rwx,g=rwx,o= -p /usr/lib/zabbix
chown zabbix:zabbix /usr/lib/zabbix
# mv /opt/software/zabbix-6.4.4 /usr/lib/zabbix5、创建Zabbix数据库
## 1)创建和配置数据库和用户。
mysql -uroot -p<password>mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
mysql> create user 'zabbix'@'localhost' identified by '<password>';
mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost';
mysql> SET GLOBAL log_bin_trust_function_creators = 1;
mysql> quit;## 2)将数据导入数据库,并将 utf8mb4 字符集设置为默认值。对于Zabbix代理数据库,只应导入schema.sql
cd database/mysql
mysql -uzabbix -p<password> zabbix < schema.sql
# stop here if you are creating database for Zabbix proxy
mysql -uzabbix -p<password> zabbix < images.sql
mysql -uzabbix -p<password> --default-character-set=utf8mb4 zabbix < data.sqlcd /opt/software/zabbix-6.4.4/database/mysql## log_bin_trust_function_creators可以在成功导入架构后禁用:
mysql -uroot -p<password>mysql> SET GLOBAL log_bin_trust_function_creators = 0;
mysql> quit;
6、编译安装
## 构建Zabbix服务器,Zabbix代理或Zabbix代理需要带有GNU扩展的C99。可以通过设置 CFLAGS=“-std=gnu99”来显式指定此版本:
export CFLAGS="-std=gnu99"
### 要指定与 /usr/local 不同的位置,
### 在之前配置源的步骤中使用 --prefix 键,例如 --prefix=/home/zabbix。
./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-openipmi
make install
# 仅安装 zabbix-agent
./configure --enable-agent
make install7、查看和编辑配置文件
vim /usr/local/etc/zabbix_server.conf
#指定数据库名称、用户和密码
DBPassword=1233218、前提是安装了PHP
mkdir /var/www/html/zabbix
sudo cp -r /opt/software/zabbix-6.4.4/ui/* /var/www/html/zabbix9、启动php、zabbix_server守护进程
sudo systemctl restart httpd
zabbix_server10、开机自启
1)复制源码启动文件: 
cp /opt/software/zabbix-6.4.4/misc/init.d/tru64/* /etc/init.d/
注意,该文件是源码文件,在解压目录下,不是make install 安装后的启动文件。
2)修改 /etc/init.d/zabbix_service和zabbix_aggentd,修改文件路径为make install路径。
DAEMON=/usr/local/sbin/zabbix_XXX
chmod 775 /etc/init.d/zabbix_*
3) 开机自启动
chkconfig --add zabbix_agentd
chkconfig --add zabbix_serverchkconfig --level 345 zabbix_server on
chkconfig --level 345 zabbix_agentd on
如无法添加成功:修改启动脚本使其支持 redhat 的 chkconfig,
分别在两个脚本的 #!/bin/sh 后加入如下两行注释,注意要行前要加“#” .
# chkconfig: 2345 10 9011、使用浏览器访问http://192.168.3.246/zabbix,并按提示进行安装12、登录
Zabbix 前端已准备就绪! 默认用户名是Admin,密码zabbix。
---------------------------------------------------------------------
13、配置zabbix_agentd.conf
注意:其中,我们的设置LogFile=/var/log/zabbix/zabbix_agentd_1.log,
仅为测试而设置,可按具体需求修改
---------------------- 以下为zabbix4.6.6的配置设置:-------------------------
vim /usr/local/etc/zabbix_agentd.confPidFile=/tmp/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd_1.log
LogFileSize=0
Server=192.168.3.246
ServerActive=192.168.3.246
Hostname=192.168.3.245
#Include=/etc/zabbix/zabbix_agentd.d/
Include=/usr/local/etc/zabbix_agentd.conf.d/
UnsafeUserParameters=1---------------------- 以下为zabbix3.0的配置设置:-------------------------
vim /etc/zabbix/zabbix_agentd.confPidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=192.168.3.246
ServerActive=192.168.3.246
Hostname=192.168.3.246
Include=/etc/zabbix/zabbix_agentd.d/
UnsafeUserParameters=1注意:查看agentd日志:cat /var/log/zabbix/zabbix_agentd.log
14、启动zabbix_agent
zabbix_agent -c /usr/local/etc/zabbix_agentd.conf

三、常见问题

# error 1:
Package libxml-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing libxml-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'libxml-2.0' found Package libxml-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containing libxml-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libxml-2.0' found
checking for xmlReadMemory in -lxml2... no
configure: error: Not found libxml2 library# solution1:
sudo yum install libxml2-devel# error 2:
configure: error: Invalid Net-SNMP directory - unable to find net-snmp-config
# solution2:
sudo yum install net-snmp-devel
# error 3:
checking for OPENIPMI support... no
configure: error: Invalid OPENIPMI directory - unable to find ipmiif.h
# solution3:
yum install OpenIPMI-devel# error 4: 
configure: error: Unable to use libevent (libevent check failed)
# solution4:
sudo yum install libevent-devel# error 5:
checking for curl-config... no
configure: error: Curl library not found
# solution 5:
sudo yum install libcurl libcurl-devel# error 6:
Minimum required PHP version is 7.4.0.
# solution 6:
sudo yum install epel-release
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
sudo yum-config-manager --enable remi-php74
sudo yum install php
php -v# error 7:
前端页面显示:PHP ldap Warning
# solusion7:
yum -y install php-ldap
sudo systemctl restart httpd

http://www.lryc.cn/news/96523.html

相关文章:

  • 解决 npm ERR! missing script: build 错误的方法
  • json-server创建静态服务器2
  • 开源视频监控管理平台国标GB28181视频EasyCVR电子地图功能展示优化
  • 端口复用与重映射
  • ros2 launch 集合 gazebo yolov8 rviz2
  • SD NAND【商业】
  • 实现任意进制(2—32)转换
  • Spring Boot 集成 Redis 三种模式实践汇总
  • MySQL DQL语法
  • 算法之线性表1.1.1(7)带头结点链表的反向输出
  • 设计模式三:抽象工厂模式(Abstract Factory Pattern)
  • Linux用户权限问题详解
  • flask中的session介绍
  • 记录联想拯救者R720重装系统
  • Spring Alibaba Sentinel实现集群限流demo
  • 102、SOA、分布式、微服务之间有什么关系和区别?
  • Ubuntu 20.04下的录屏与视频剪辑软件
  • 面试题 -- iOS数据存储
  • spring复习:(51)environment、systemProperties、systemEnvironment三个bean是在哪里被添加到容器的?
  • element ui 上传控件携带参数到后端
  • scrapy分布式+指纹去重原理
  • FileHub使用教程:Github Token获取步骤,使用快人一步
  • 嵌入式开发:单片机嵌入式Linux学习路径
  • Libvirt的virsh工具常用命令
  • 高斯消元解异或方程组写法
  • 前端 mock 数据的几种方式
  • 【GO】go语言入门实战 —— 猜数字游戏
  • opencv-25 图像几何变换04- 透视 cv2.warpPerspective()
  • 视频讲解Codeforces Round 887 (Div. 2)(A--C)
  • 【团队协作开发】将Gitee项目导入到本地IDEA中出现根目录不完整的问题解决(已解决)