环境:
zabbix server:redhat8.3
zabbix agent:redhat7.x 、redhat8.3
1. 配置yum、dnf源
cat /etc/redhat-release
8.3
cd /etc/yum.repos.d/
删除旧的.repo
wget -O /etc/yum.repos.d/redhat.repo http://mirrors.aliyun.com/repo/Centos-8.repo
dnf clean all;
dnf makecache;
dnf repolist;
7.x
cd /etc/yum.repos.d/
删除旧的.repo
wget http://mirrors.aliyun.com/repo/Centos-7.repo
sed -i 's/$releasever/7/g' /etc/yum.repos.d/Centos-7.repo
yum clean all;
yum makecache;
yum repolist;
2. install zabbix server
https://www.zabbix.com/download?zabbix=5.0&os_distribution=red_hat_enterprise_linux&os_version=8&db=mysql
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm
dnf clean all;
dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-agent;
cat /etc/services |grep zabbix
Configure Zabbix frontend
Connect to your newly installed Zabbix frontend: http://server_ip_or_name/zabbix
https://www.zabbix.com/documentation/5.0/manual/quickstart/login
遇到的问题
mysql service没启动,ui上报错接不上
3. install mysql
dnf -y install mysql mysql-server mysql-devel
chown mysql:mysql -R /var/lib/mysql
mysqld --initialize
systemctl start mysqld
systemctl status mysqld
mysql -uroot -pxxxx (password)
创建zabbix db、user,权限
mysql> create database zabbix character set utf8;
Query OK, 1 row affected, 1 warning (0.01 sec)
mysql> create user 'zabbix'@'server_ip' identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL ON *.* TO 'zabbix'@'server_ip';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
\q
vi /etc/zabbix/zabbix_server.conf
DBPassword=zabbix
vi /etc/php-fpm.d/zabbix.conf
php_value[date.timezone] = Asia/Shanghai
启动 zabbix
systemctl restart zabbix-server zabbix-agent httpd php-fpm
systemctl status zabbix-server.service
遇到错误:
SELinux is preventing /usr/sbin/zabbix_server_mysql from using the dac_override capability
>>getenforce
Enforcing
解决:关闭selinux
setenforce 0
vi /etc/selinux/config
SELINUX=disabled
connect mysql error no such file: mysql 没启动
4. install zabbix agent
参考 zabbix.com/documentation/5.0/manual/installation/install
下载安装tar
wget https://cdn.zabbix.com/zabbix/sources/stable/5.0/zabbix-5.0.1.tar.gz
tar -zxvf zabbix-5.0.1.tar.gz
create user:
groupadd --system zabbix;
useradd --system -g zabbix -d /usr/lib/zabbix -s /sbin/nologin -c "Zabbix Monitoring System" zabbix;
mkdir -m u=rwx,g=rwx,o= -p /usr/lib/zabbix;
chown zabbix:zabbix /usr/lib/zabbix;
安装
cd zabbix-5.0.1/
./configure --enable-agent
遇到错误:
configure: error: Unable to use libpcre (libpcre check failed)
解决方法:安装依赖包
redhat8:
yum -y install pcre*
redhat7:
yum -y install net-snmp-devel libxml2-devel libcurl-deve libevent libevent-devel
yum -y install mysql-dev gcc net-snmp-devel curl-devel perl-DBI php-gd php-mysql php-bcmath php-mbstring php-xm
再次执行 ./configure --enable-agent
看到提示信息说明成功
***********************************************************
* Now run 'make install' *
* *
* Thank you for using Zabbix! *
* <http://www.zabbix.com> *
***********************************************************
make install
vi /usr/local/etc/zabbix_agentd.conf
Server=xx.xx.xx.xx (zabbix server ip)
launch zabbix agent
shell> zabbix_agentd
加入service
cp /root/zabbix-5.0.1/misc/init.d/tru64/zabbix_agentd /etc/init.d/
chmod +x /etc/init.d/zabbix_agentd
service zabbix_agentd restart
-- 遇到 received empty response from zabbix agent
agent的server=XXXX ip没配对
本文档记录了配置Zabbix server和agent的详细过程,包括在Redhat 7.x和8.3上配置yum、dnf源,安装Zabbix server和MySQL,遇到的MySQL服务未启动问题,以及安装Zabbix agent时的libpcre依赖问题。在安装过程中,还涉及了SELinux设置、数据库连接和Zabbix frontend的配置。
729

被折叠的 条评论
为什么被折叠?



