私人订制网站建设,视频直播sdk快速接入,网站域名密码,美容网站开发一、目标
对zabbix-6.4.4版本进行调研。了解并测试zabbix-6.4.4部署以及监控配置。
二、过程
前言#xff1a;最新版本的zabbix-6.4.4的要求有所增加#xff0c;配置要求如下#xff1a; MySQL版本#xff1a;8.0.X
PHP版本#xff1a;7.4.X
libXML#xff1a;2.6.1…
一、目标
对zabbix-6.4.4版本进行调研。了解并测试zabbix-6.4.4部署以及监控配置。
二、过程
前言最新版本的zabbix-6.4.4的要求有所增加配置要求如下 MySQL版本8.0.X
PHP版本7.4.X
libXML2.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 urwx,grwx,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 -ppasswordmysql create database zabbix character set utf8mb4 collate utf8mb4_bin;
mysql create user zabbixlocalhost identified by password;
mysql grant all privileges on zabbix.* to zabbixlocalhost;
mysql SET GLOBAL log_bin_trust_function_creators 1;
mysql quit;## 2)将数据导入数据库并将 utf8mb4 字符集设置为默认值。对于Zabbix代理数据库只应导入schema.sql
cd database/mysql
mysql -uzabbix -ppassword zabbix schema.sql
# stop here if you are creating database for Zabbix proxy
mysql -uzabbix -ppassword zabbix images.sql
mysql -uzabbix -ppassword --default-character-setutf8mb4 zabbix data.sqlcd /opt/software/zabbix-6.4.4/database/mysql## log_bin_trust_function_creators可以在成功导入架构后禁用
mysql -uroot -ppasswordmysql SET GLOBAL log_bin_trust_function_creators 0;
mysql quit;
6、编译安装
## 构建Zabbix服务器Zabbix代理或Zabbix代理需要带有GNU扩展的C99。可以通过设置 CFLAGS“-stdgnu99”来显式指定此版本
export CFLAGS-stdgnu99
### 要指定与 /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
#指定数据库名称、用户和密码
DBPassword1233218、前提是安装了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
LogFileSize0
Server192.168.3.246
ServerActive192.168.3.246
Hostname192.168.3.245
#Include/etc/zabbix/zabbix_agentd.d/
Include/usr/local/etc/zabbix_agentd.conf.d/
UnsafeUserParameters1---------------------- 以下为zabbix3.0的配置设置-------------------------
vim /etc/zabbix/zabbix_agentd.confPidFile/var/run/zabbix/zabbix_agentd.pid
LogFile/var/log/zabbix/zabbix_agentd.log
LogFileSize0
Server192.168.3.246
ServerActive192.168.3.246
Hostname192.168.3.246
Include/etc/zabbix/zabbix_agentd.d/
UnsafeUserParameters1注意查看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