centos-9stream安装zabbix-all
1.zabbix是一个基于web界面的提供分布式系统监控以及网络监控功能的企业级开源解决方案。zabbix能监控各种网络参数,保证服务器系统的安全运行,并且能够提供灵活的通知报警机制让系统管理员能快速的发现问题,定位问题,解决问题.
2.zabbix除了支持主动模式之外还支持被动模式。所谓的主动还是被动针对的是agent,agent向zabbix的server发送数据,就表示是主动模式,agent被动的等待server来提取数据,就是被动模式。
3.zabbix支持分布式的架构,可以采用zabbix proxy的方式来实现监控平台的轻松扩容,可以简单的实现多数据中心多云平台监控。你想要扩容,搭建zabbix proxy即可。
4.zabbix支持多种报警,短信(SMS),邮件,语音,微软的team,企业微信,钉钉....
5.zabbix有非常漂亮的web界面(相对的),但是又不仅仅只是显示监控的数据,还可以通过web对监控内容进行调整和配置,还支持多用户访问,以及外部身份认证与的集成。
6.zabbix是免费的。是开源的,是对公众可以任意使用的。虽然zabbix是开源的免费的,但是如果运维人员的水平不够可能也没办法发挥zabbix的全部功能,一般对于开源监控平台来说,如果想玩到高级的程度,必须要具备开发的知识。这个知识针对中小型的公司,需要运维人员对监控平台进行维护和问题发现以及问题处理,对开发人员要求动态实时的定制需要监控的内容。所以说商机就来了,有很多公司提供zabbix的技术支持,zabbix社区就是这些众多提供商业支持的最大的一家公司。
1.zabbix allinone安装
登录zabbix官网,选择好你想安装的相应版本
a.安装zabbix 安装yum源
#如果您安装了 EPEL包,请将其禁用。编辑文件 /etc/yum.repos.d/epel.repo 并添加以下语句。
[epel]
...
excludepkgs=zabbix*
#如果你没有安装继续安装 zabbix 存储库。
[root@gby ~]# rpm -Uvh https://repo.zabbix.com/zabbix/6.4/rhel/9/x86_64/zabbix-release-6.4-1.el9.noarch.rpm
Retrieving https://repo.zabbix.com/zabbix/6.4/rhel/9/x86_64/zabbix-release-6.4-1.el9.noarch.rpm
warning: /var/tmp/rpm-tmp.ak25Hy: Header V4 RSA/SHA512 Signature, key ID 08efa7dd: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:zabbix-release-6.4-1.el9 ################################# [100%]
[root@gby ~]# yum clean all
21 files removed
b.安装Zabbix server,Web前端,agent
[root@gby ~]# dnf -y install zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent
c.创建初始化数据库
#确保您已启动并运行数据库服务器。潜藏意思急速mysql你得自己装
https://www.zabbix.com/documentation/current/en/manual/installation/requirements
#要求数据库版本10.5.00-10.11.X
[root@gby ~]# wget https://dlm.mariadb.com/2869873/MariaDB/mariadb-10.11.2/yum/rhel/mariadb-10.11.2-rhel-9-x86_64-rpms.tar
[root@gby ~]# tar xvf mariadb-10.11.2-rhel-9-x86_64-rpms.tar
[root@gby ~]# yum -y install mariadb-server
[root@gby ~]# systemctl enable mariadb --now
[root@gby ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] n
... skipping.
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] Y
New password: #Admin123!@#
Re-enter new password: #Admin123!@#
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] n
... skipping.
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
#在您的数据库主机上运行以下命令。
[root@gby ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 10.5.16-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database zabbix character set utf8mb4 collate utf8mb4_bin;
Query OK, 1 row affected (0.003 sec)
MariaDB [(none)]> create user zabbix@localhost identified by 'Admin123!@#';
Query OK, 0 rows affected (0.017 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost;
Query OK, 0 rows affected (0.011 sec)
MariaDB [(none)]> set global log_bin_trust_function_creators = 1;
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> quit;
Bye
#在 Zabbix 服务器主机上导入初始模式和数据。系统将提示您输入新创建的密码。
[root@gby ~]# zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
Enter password: #Admin123!@#
#导入数据库架构后禁用 log_bin_trust_function_creators 选项。
[root@gby ~]# mysql -uroot -p
Enter password: #Admin123!@#
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 10.5.16-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> set global log_bin_trust_function_creators = 0;
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> quit;
Bye
d. 为 Zabbix 服务器配置数据库
#编辑文件/etc/zabbix/zabbix_server.conf
[root@gby ~]# sed -i 's/# DBPassword=/DBPassword=Admin123!@#/' /etc/zabbix/zabbix_server.conf
e. 为 Zabbix 前端配置 PHP
#编辑文件 /etc/nginx/conf.d/zabbix.conf 取消注释并设置“listen”和“server_name”指令。
[root@gby ~]# sed -i 's/# listen 8080;/ listen 8080;/' /etc/nginx/conf.d/zabbix.conf
[root@gby ~]# sed -i 's/# server_name example.com;/ server_name example.com;/' /etc/nginx/conf.d/zabbix.conf
f.启动zabbix server和agent
#启动 Zabbix 服务器和代理进程,并使其在系统启动时启动。
[root@gby ~]# systemctl restart zabbix-server zabbix-agent nginx php-fpm
[root@gby ~]# systemctl enable zabbix-server zabbix-agent nginx php-fpm
Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-server.service → /usr/lib/systemd/system/zabbix-server.service.
Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-agent.service → /usr/lib/systemd/system/zabbix-agent.service.
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service.
Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service → /usr/lib/systemd/system/php-fpm.service.
2.zabbix的web部署
http://192.168.1.17:8080/setup.php
账户Admin密码zabbix
如果没有中文包的话
由于没有中文包,所以我们需要安装一下中文包
[root@zabbix-allinone ~]# yum -y install langpacks-zh_CN
[root@zabbix-allinone ~]# yum -y install glibc-common
如果你已经安装过glibc-common,你重新安装即可
[root@zabbix-allinone ~]# yum -y reinstall glibc-common
结束之有话想说
既然看完了那就赶紧去试试吧骚年。
标签:...,9stream,centos,server,zabbix,MariaDB,root,gby From: https://blog.51cto.com/u_15606628/6605806