Myluzh Blog

CentOS9部署Zabbix6详细过程

发布时间: 2023-5-9 文章作者: myluzh 分类名称: Zabbix 朗读文章


0x01 前置条件
1.确定系统版本
Zabbix 6.0要求CentOS≧8,MySQL≧8.0或MariaDB≧10.5.0
Zabbix 6.2及之后版本增加要求PHP≧7.4

2.确定防火墙状态或者放通端口
systemctl status firewalld#查看防火墙状态
systemctl stop firewalld#关闭防火墙
systemctl disable firewalld#永久关闭

0x02 部署过程
1.配置zabbix官方源
# rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/9/x86_64/zabbix-release-6.0-4.el9.noarch.rpm
# dnf clean all

2.安装zabbix服务
# dnf -y install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent

3.部署MariaDB Server
# dnf install -y mariadb-server
# systemctl start mariadb
# systemctl enable mariadb

4.初始化数据库
# mysql_secure_installation

5.创建zabbix数据库
# mysql -uroot -p
password
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
mysql> set global log_bin_trust_function_creators = 1;
mysql> set global log_bin_trust_function_creators = 0;
mysql> \q;

6.导入zabbix库表
# zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix

7.配置zabbix配置文件
# vi /etc/zabbix/zabbix_server.conf
# DBPassword=zabbix

8.启动Zabbix服务
# systemctl restart zabbix-server zabbix-agent httpd php-fpm
# systemctl enable zabbix-server zabbix-agent httpd php-fpm

9.完成

Web登录Zabbix:http://host/zabbix
默认账号密码:Admin/zabbix

0x04 部署Grafana
1.配置grafana源
# vi /etc/yum.repos.d/grafana.repo
[grafana]
name=grafana
baseurl=https://packages.grafana.com/enterprise/rpm
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://packages.grafana.com/gpg.key
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt

2.安装grafana
# dnf install -y grafana
# systemctl daemon-reload
# systemctl start grafana-server
# systemctl enable grafana-server
访问 http://localhost:3000,默认用户名密码均为admin

3. Zabbix接入Grafana
访问Grafana主页,添加zabbix插件和clock插件,安装成功后重启Grafana服务,然后启用zabbix插件。
Grafana 默认插件的存放位置为:/var/lib/grafana/plugins
在Grafana页面添加数据源:
Name:zabbix
URL:http://10.100.1.101/zabbix/api_jsonrpc.php
Username:admin
Password:admin
导入zabbix监控模板,创建dashboard,添加监控项仪表板。

标签: centos zabbix centos9

发表评论