zabbix5.0.25+mysql8+grafana9.0.2

Pay attention to the requirements

1. 对外放端口进行限制,防火墙和selinux请自行关闭或者开放相应的端口
2. 配置开机自启

Manually deploy zabbix server project steps

1. Deploy mysql8.0

1. Download the official website source of mysql8.0
rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm
sed -i 's/enabled=1/enabled=0/' /etc/yum.repos.d/mysql-community.repo
sed -ri 's/file:\/\/\/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-mysql/https:\/\/repo.mysql.com\/RPM-GPG-KEY-mysql-2022/g' /etc/yum.repos.d/l-community.repo
yum clean all
2. Install mysql8.0
yum -y --enablerepo=mysql80-community install mysql-community-server 
3. Configure mysql file
mkdir -p /data/SOFTWARE_DIR/mysql/
echo '[client]
 default-character-set=utf8
 [mysqld]
 port = 8992
 character-set-server =utf8
 collation-server=utf8_bin
 datadir=/data/SOFTWARE_DIR/mysql/
 socket=/var/lib/mysql/mysql.sock
 symbolic-links=0
 skip-name-resolve
 general_log=1
 log_output=FILE
 general-log-file=/data/SOFTWARE_DIR/mysql/general.log
 [mysqld_safe]
 log-error=/data/SOFTWARE_DIR/mysql/mysqld.log
 pid-file=/var/run/mysqld/mysqld.pid' > /etc/my.cnf
4. Create the required directories and corresponding databases
chown mysql:mysql /data/SOFTWARE_DIR/mysql/
mysql_install_db --user=mysql --datadir=/data/SOFTWARE_DIR/mysql/
systemctl start mysqld
grep 'temporary password' /var/log/mysqld.log
mysql_secure_installation
  创建初始数据库
  mysql -uroot -pRXwkmwHmHQUkjkn9O#
  mysql> create database zabbix character set utf8 collate utf8_bin;
  mysql> flush privileges; #重新加载权限表
  mysql> create user zabbix@localhost identified by 'fdznvbtixdhi#$hfjikh';
  mysql> grant all privileges on zabbix.* to zabbix@localhost;
  mysql> alter  user 'zabbix'@'localhost' identified with mysql_native_password by 'fdznvbtixdhi#$hfjikh';
  mysql> flush privileges;
  mysql> SHOW VARIABLES LIKE 'validate_password%';   查看密码规则的具体的设置项  
  1. The role of mysql_secure_installation:
    1. Set the root user password
    2. Delete anonymous users
    3. Whether to prohibit root users from remote login
    4. Delete the test database
    5. Refresh the authorization table to make the initialization take effect
  2. Reinitialize the database, command line input: mysqld --initialize-insecure

2. Deploy zabbix server5.0.25

1. Download the source of zabbix5.0.25
 rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
 yum clean all
2. Install zabbix5.0.25
 yum install -y zabbix-server-mysql-5.0.25* zabbix-agent-5.0.25* centos-release-scl*2-3*
编辑配置文件 /etc/yum.repos.d/zabbix.repo and enable zabbix-frontend repository.
 [zabbix-frontend]
 ...
 enabled=1
 ...
 Install Zabbix frontend packages.
 yum install zabbix-web-mysql-scl-5.0.25* zabbix-nginx-conf-scl-5.0.25* -y
3. Configure zabbix5.0.25
导入初始架构和数据,系统将提示您输入新创建的密码。
 zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
为Zabbix server配置数据库
cp /etc/zabbix/zabbix_server.conf{
    
    ,.bak}
vim /etc/zabbix/zabbix_server.conf
DBName=zabbix库名
DBUser=zabbix用户
DBPassword=密码
CacheSize=1G
CacheUpdateFrequency=300
StartDBSyncers=20
HistoryCacheSize=516M
TrendCacheSize=254M
ValueCacheSize=1G
StartPollers=500
StartPollersUnreachable=50
StartTrappers=300
StartDiscoverers=100
StartTimers=10
StartAlerters=3
启动服务
systemctl restart zabbix-server
为Zabbix前端配置PHP
编辑配置文件 /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf, uncomment and set 'listen' and 'server_name' directives.
 listen 80;
 server_name example.com;
编辑配置文件 /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
listen.acl_users = apache,nginx
php_value[date.timezone] = Europe/Riga
4. Start the Zabbix server and agent processes, and set them to start automatically at boot:
systemctl restart zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm

3. Deploy grafana 9.0.2

1. Download grafana source
wget https://dl.grafana.com/oss/release/grafana-9.0.2-1.x86_64.rpm
2. Install grafana
yum -y install grafana-9.0.2-1.x86_64.rpm
3. Configure grafana, start the process, and set auto-start at boot
cp /etc/grafana/grafana.ini{
    
    ,.bak}
vim /etc/grafana/grafana.ini
[paths]
data = /data/grafana
logs = /data/grafana/log/
[plugins]
allow_loading_unsigned_plugins = alexanderzobnin-zabbix-datasource
启动进程,设置开机自启
systemctl start grafana
systemctl enable grafana

4. Page configuration

1. Configure zabbix page

Log in to the external IP of the server, configure the corresponding database user information,
Insert image description here
Insert image description here
enter the login interface, account Admin password zabbix, note the capital A
Insert image description here

2. Configure grafana page

Log in to the server's external network IP, configure the connection between garafana and zabbixserver and the connection to the data source
. Enter the login interface, account admin password admin
Insert image description here
to add plug-ins
Insert image description here

Open the plug-in,
Insert image description here
configure the mysql data source,
Insert image description here
configure the zabbix data source
Insert image description here
Insert image description here

Solutions to problems encountered

1.Insert image description here

The reason for this problem is that the verification has not passed. Just reconfigure it.
The reference link is
https://blog.csdn.net/weixin_45836543/article/details/124906071

Reference links:

  1. Tutorial to install mysql8
  • https://cloud.tencent.com/developer/article/1711747#:~:text=Centos7%20%E5%AE%89%E8%A3%85%20Mysql8%E6%95%99%E7%A8%8B%201%20%E3%80%81%E8%AE%BE%E7%BD%AEmysql%E6%BA%90....%202%20%E3%80%81%E5%AE%89%E8%A3%85MySQL%20Community,root%E5%AF%86%E7%A0%81%205%20%E3%80%81%E9%87%8D%E7%BD%AEroot%E5%AF%86%E7%A0%81....%206%20%E3%80%81mysql%20%E6%9C%8D%E5%8A%A1%E5%8A%A0%E5%85%A5%E5%BC%80%E6%9C%BA%E5%90%AF%E5%8A%A8%E9%A1%B9%EF%BC%8C%E5%B9%B6%E5%90%AF%E5%8A%A8mysql%E8%BF%9B%E7%A8%8B%207%20%E3%80%81%E5%BC%80%E6%94%BE3306%E7%AB%AF%E5%8F%A3.
    
  1. Detailed explanation of grafana configuration file:
  • https://blog.csdn.net/nonem101/article/details/108239619
  1. Detailed explanation of zabbixserver configuration file
  • https://blog.csdn.net/qq_42606357/article/details/118864055
  • https://blog.csdn.net/qq_42878576/article/details/119565073
  1. MySQL related reference links
  • https://ywnz.com/linux/mysqldsafe/
  • https://blog.csdn.net/qq_43437874/article/details/115242198
  1. Automatic discovery of zabbix server
  • https://blog.csdn.net/weixin_45858439/article/details/122969565

Guess you like

Origin blog.csdn.net/weixin_42602433/article/details/126231618