zabbix监控安装文档

Zabbix安装部署文档

https://blog.csdn.net/m0_56055257/article/details/131260948

以上文档可以直接复制内容部署,写的非常好用

在本教程中,展示如何在 CentOS 8 / RHEL 8 / Oracle Linux 8 / Alma Linux 8/ Rocky Linux 8 上安装最新的 Zabbix 6.4 版本。

1、基本配置

1.0关闭防火墙和SELINUX

systemctl stop firewalld

systemctl disable firewalld

setenforce 0

sed -i "s/enforcing/permissive/g" /etc/selinux/config

1.1更换源

#更换源根据自己实际情况

cd /etc/yum.repos.d

rm -rf *

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo

yum clean all

yum makecache

二、安装zabbix服务器前端和agent

2.1安装zabbix存储库

rpm -Uvh https://repo.zabbix.com/zabbix/6.4/rhel/8/x86_64/zabbix-release-6.4-1.el8.noarch.rpm

dnf clean all

2.2切换PHP的DNF模块版本

dnf module switch-to php:7.4

三、安装和配置数据库

3.1安装MariDB10.6

curl -LsS -O https://downloads.mariadb.com/MariaDB/mariadb_repo_setup

sudo bash mariadb_repo_setup --mariadb-server-version=10.6

dnf -y install mariadb-server && systemctl start mariadb && systemctl enable mariadb

#安装完成后启动并且设置为开机启动

3.2重置数据库的root密码

   初始化数据库

mariadb-secure-installation

Enter current password for root (enter for none): Press Enter

Switch to unix_socket authentication [Y/n] y

Change the root password? [Y/n] y

New password: <Enter root DB password> #设置新的密码

Re-enter new password: <Repeat root DB password>

Remove anonymous users? [Y/n]: Y #删除anonymous账户

Disallow root login remotely? [Y/n]: Y #是否需要远程登录

Remove test database and access to it? [Y/n]: Y #删除test库

Reload privilege tables now? [Y/n]: Y #重新加载表

3.3创建数据库

mysql -uroot -p

password

mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;

mysql> create user zabbix@localhost identified by 'password'; #要设置的zabbix密码

mysql> grant all privileges on zabbix.* to zabbix@localhost;

mysql> set global log_bin_trust_function_creators = 1;

mysql> quit;

3.4导入舒适架构和数据    #提供提示你输入新创建的密码就是上面设置的zabbix密码

zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix

3.5导入数据库模式后禁用log_bin_trust_function_creators选项

mysql -uroot -p

password #你的root用户密码

mysql> set global log_bin_trust_function_creators = 0;

mysql> quit;

四、zabbix-server配置数据库及前端配置PHP

4.1配置zabbix_server

vim /etc/zabbix/zabbix_server.conf

https://img-blog.csdnimg.cn/0528d24882db4c62824be1c47ef31dbb.png

4.2配置php

vim /etc/php.ini

post_max_size = 16M #由8M改为16M

max_execution_time = 300 #由30改为300

max_input_time = 300 #由60改为300

4.3配置Nginx

vim /etc/nginx/conf.d/zabbix.conf

# listen 8080;

# server_name example.com;

#取消注释并设置保存

4.4启动zabbix server和agent进程

systemctl restart zabbix-server zabbix-agent nginx php-fpm

systemctl enable zabbix-server zabbix-agent nginx php-fpm

报错:

1.问题

在安装zabbix5.0时使用的mysql80作为后端数据库配置好了数据之后开启zabbix-server服务的时候出现如下的错误:

https://img-blog.csdnimg.cn/be50889db3b4461c88d71457dae3c1f3.png

https://img-blog.csdnimg.cn/86a310859b2a4cba8bd2f79311b39886.png

就是如下报错:caching_sha2_password

connection to database 'zabbix' failed: [2059] Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib64/mysql/plugin/caching_sha2_password.

2.分析

无法加载身份验证插件,身份验证插件找不到,MySql 8.0.32 换了新的身份验证插件(caching_sha2_password);之前的身份验证插件为(mysql_native_password)。zabbix找不到换了之后的验证插件身份。

可以尝试将mysql用户使用的登录密码加密规则 还原成 mysql_native_password。

3.解决

mysql> use mysql;

mysql> select user,host,plugin,authentication_string from user;

https://img-blog.csdnimg.cn/25b7b288358b4d789ec17f3315b88510.png

mysql>alter user 'zabbix'@'localhost' identified with mysql_native_password by 'Lyg@123.com';

mysql> select user,host,plugin,authentication_string from user;

https://img-blog.csdnimg.cn/a815527d28e14f01a8ec69ce26f6aa23.png

重启zabbix:

https://img-blog.csdnimg.cn/741700b4a771452bbd5e12d1ed9e7478.png

其他报错:

8.0的mysql数据库再第一次登录进去需要输入密码:密码再/var/log/mysqld.log这个文件中。

登录后,第一次需要强制修改密码:命令如下:

MYSQL#> alter user 'root'@'localhost' IDENTIFIED BY '密码';

切记:密码有安全限制,需要有大小写和特殊字符和数字。否则修改失败。

  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值