安装Zabbix
安装MariaDB
这里用MariaDB演示
https://mariadb.org/download/?t=repo-config&d=Red+Hat+Enterprise+Linux+9&v=10.11&r_m=neusoft
通过这个网址获得连接
选择对应的repo
根据系统版本和要安装的版本选择对应的repo
安装
新建一个repo文件,例如/etc/yum.repos.d/MariaDB.repo, 然后把网站上提供的内容复制进去,例如
1 | # MariaDB 10.11 RedHatEnterpriseLinux repository list - created 2024-02-29 09:14 UTC |
然后就是安装步骤
1 | sudo dnf install MariaDB-server |
至此,MariaD的安装就结束了
安装Zabbix Server
跟着这个网页的命令走,基本不会出什么问题
由于今天我们主要讲Rocky的安装,所以我们这么选
接下来的步骤由于官网写的很详细,我就直接抄下来了,各位可以看一下
Install Zabbix repository
Disable Zabbix packages provided by EPEL, if you have it installed. Edit file /etc/yum.repos.d/epel.repo and add the following statement.
1 | [epel] |
Proceed with installing zabbix repository.
1 | # rpm -Uvh https://repo.zabbix.com/zabbix/7.0/rocky/9/x86_64/zabbix-release-latest-7.0.el9.noarch.rpm |
Install Zabbix server, frontend, agent2
1 | # dnf install zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent2 |
Install Zabbix agent 2 plugins
You may want to install Zabbix agent 2 plugins.
1 | # dnf install zabbix-agent2-plugin-mongodb zabbix-agent2-plugin-mssql zabbix-agent2-plugin-postgresql |
Create initial database
Make sure you have database server up and running.
Run the following on your database host.
1 | # mysql -uroot -p |
On Zabbix server host import initial schema and data. You will be prompted to enter your newly created password.
1 | # zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix |
Disable log_bin_trust_function_creators option after importing database schema.
1 | # mysql -uroot -p |
Configure the database for Zabbix server
Edit file /etc/zabbix/zabbix_server.conf
1 | DBPassword=password |
Start Zabbix server and agent processes
Start Zabbix server and agent processes and make it start at system boot.
1 | # systemctl restart zabbix-server zabbix-agent2 nginx php-fpm |
Open Zabbix UI web page
在Nginx的配置中,zabbix默认使用80端口,但是由于政策限制,其实我们不能使用,所以这边改成8090
1 | vi /etc/nginx/conf.d/zabbix.conf |
然后就可以通过IP:8090 的形式访问到zabbix console了
安装Grafana
安装
直接进下面这个页面,可以看到这边可以选择版本以及操作系统
并且如果是Linux平台的,下面会给出不同平台的命令,直接复制粘贴执行一下就可以了
验证
运行命令
1 | ## 运行service |
之后浏览器访问IP:3000,就可以看到Grafana界面啦
默认账号密码为admin/admin,第一次登录会强制修改密码
其他
修改默认端口
1 | vi /etc/grafana/grafana.ini |
配置邮件服务
用于忘记密码等情况,可以不通知管理员自行修改密码