zabbix-server5.0安装流程

zabbix-server5.0安装流程

作者:蓝眼泪

实验环境:centos7.9+apache+mariadb+php,win7旗舰版,vm15虚拟机
xshell7,xftp7.
在这里插入图片描述

具体操作过程如下

第一步,关闭防火墙和selinux

vim /etc/sysconfig/network-scripts/ifcfg-ens33

在这里插入图片描述

service network restart
ping www.baidu.com
 iptables -F
 systemctl disable firewalld
 systemctl stop firewalld
 systemctl status firewalld
 vim /etc/selinux/config

在这里插入图片描述

第二步,安装zabbix-server前端和mariadb数据库

yum -y install httpd mariadb mariadb-server  #安装mariadb数据库
yum install centos-release-scl
yum -y install rh-php72
yum -y install https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum install OpenIPMI OpenIPMI-libs OpenIPMI-modalias
yum install unixODBC fping -y
yum -y install rh-php72-php-mysqlnd
yum -y install rh-php72-php-bcmath rh-php72-php-fpm rh-php72-php-gd rh-php72-php-ldap rh-php72-php-mbstring
systemctl restart mariadb.service
systemctl enable mariadb.service
mysql -uroot
create database zabbix character set utf8 collate utf8_bin;
create user zabbix@localhost identified by ‘password’;
grant all privileges on zabbix.* to zabbix@localhost;
yum install zabbix-server-mysql
zcat /usr/share/doc/zabbix-server-mysql-5.0.9/create.sql.gz | mysql -u zabbix -p zabbix
vim /etc/zabbix/zabbix_server.conf

在这里插入图片描述

systemctl restart zabbix-server zabbix-agent httpd mariadb rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd mariadb rh-php72-php-fpm

第三步,安装zabbix-agent

rpm -ivh zabbix-agent-5.0.0-1.el7.x86_64.rpm 
yum install zabbix-agent
vim /etc/zabbix/zabbix_agentd.conf

在这里插入图片描述

 systemctl start zabbix-agent && systemctl enable zabbix-agent
 netstat -lntp | grep 10050
 netstat -lntp | grep 10051
 zabbix_get -s 192.168.60.125 -p 10050 -k system.uname
 yum install zabbix-get
 zabbix_get -s 192.168.60.125 -p 10050 -k system.uname
 zabbix_agentd -p | grep system.cpu.load
 zabbix_get -s 192.168.60.125 -p 10050 -k system.cpu.load[all,avg1]

启动服务,包括Apache,mariadb,zabbix-server,zabbix-agent,php软件。

 yum install httpd
 service httpd start
 systemctl restart zabbix-server zabbix-agent httpd mariadb rh-php72-php-fpm
 systemctl enable zabbix-server zabbix-agent httpd mariadb rh-php72-php-fpm
 systemctl restart mariadb
 systemctl enable mariadb
 sudo systemctl enable zabbix-server.service
 sudo systemctl start zabbix-server.service
 sudo ps -ef |grep zabbix_server
 yum install centos-release-scl
 vim  /etc/yum.repos.d/zabbix.repo

在这里插入图片描述

yum install zabbix-web-mysql-scl zabbix-apache-conf-scl
vim /etc/zabbix/zabbix_server.conf

在这里插入图片描述

vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf

在这里插入图片描述

 systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
 systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm

修改; php_value[date.timezone] = Europe/Riga
改成 php_value[date.timezone] = Asia/shanghai

第四步,用浏览器安装zabbix-server并登录

用谷歌浏览器访问http://ip//zabbix,界面如下:

在这里插入图片描述
登录账号是Admn,密码是zabbix。

在这里插入图片描述

第五步,问题排查

1.日志查看

cat /var/log/zabbix/zabbix_agentd.log
ps -ef | grep zabbix_server
sudo netstat -anpl | grep 10051
sudo vim /etc/zabbix/zabbix_agentd.conf
uname -a (Linux查看版本当前操作系统内核信息) 
cat /proc/version (Linux查看当前操作系统版本信息) 
cat /proc/cpuinfo (Linux查看cpu相关信息,包括型号、主频、内核信息等)

2.字体乱码解决方案

 cd /usr/share/zabbix/assets/fonts
 mv graphfont.ttf graphfont.ttf.bak
 rz -y
 mv simsun.ttc simsun.ttf  
vim /usr/share/zabbix/include/defines.inc.php

修改FONT参数为simsun ,常规宋体

 systemctl restart zabbix-server.service

3.数据库权限问题解决方法

/usr/bin/mysql_install_db
service mysql start && chkconfig mysql on
cat /root/.mysql_secret
mysqladmin -uroot -pbgm906fR5azAxcMK password 123456
mysql -u root -p123456
CREATE DATABASE zabbix CHARACTER SET UTF8 COLLATE UTF8_BIN;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY 'password';
FLUSH PRIVILEGES;

4.登录用户Admin密码忘记解决方法

1 生成一个MD5类型的新密码,新的密码是admin

[root@localhost ~]# echo -n  admin  | openssl md5
(stdin)=21232f297a57a5a743894a0e4a801fc3

2 更新users表中userid=1的用户密码

MariaDB [zabbix]> update users set  passwd='21232f297a57a5a743894a0e4a801fc3' where userid = '1';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

3 刷新重新加载权限表

MariaDB [zabbix]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.03 sec)

5 在grafana服务器上安装zabbix插件

cd /usr/sbin/grafana-cli plugins
grafana-cli plugins list-remote
grafana-cli plugins install alexanderzobnin-zabbix-app
systemctl restart grafana-server
已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页