首页 > 其他分享 >zabbix5

zabbix5

时间:2023-05-09 09:34:14浏览次数:37  
标签:log zabbix5 server zabbix yum proxy mysql

环境准备

主机 外网ip 内网ip
server 10.0.0.101
proxy 10.0.0.102 172.16.1.102
agent01 172.16.1.103
agent02 172.16.1.104
win 192.168.45.171

配置源

# 4台服务器都配置源
使用脚本换源
vi zabbix_aliyun.sh

#!/bin/bash
echo -e "请给出要安装的zabbix版本号,建议使用4.x的版本  \033[31musage:./zabbix_aliyun.sh 4.0|4.4|4.5|5.0 \033[0m"
echo "例如要安装4.4版本,在命令行写上 ./zabbix_aliyun.sh 4.4"
if [ -z $1 ];then
    exit
fi
VERSION=$1
if [ -f /etc/yum.repos.d/zabbix.repo ];then
    rm -rf /etc/repos.d/zabbix.repo
fi
rpm -qa | grep zabbix-release && rpm -e zabbix-release
rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/$VERSION/rhel/7/x86_64/zabbix-release-$VERSION-1.el7.noarch.rpm
sed -i "s@zabbix/.*/rhel@zabbix/$VERSION/rhel@g" /etc/yum.repos.d/zabbix.repo
sed -i '[email protected]@mirrors.aliyun.com/zabbix@g' /etc/yum.repos.d/zabbix.repo
[ $? -eq 0 ] && echo "阿里云的zabbix源替换成功" || exit 1
yum clean all
yum makecache fast

# 执行脚本
bash zabbix_aliyun.sh 5.0

server

# 安装server
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum clean all
yum install zabbix-server-mysql zabbix-agent -y
yum install centos-release-scl -y

# 编辑repo
vi /etc/yum.repos.d/zabbix.repo
[zabbix-frontend]
...
enabled=1
...

# 安装
yum install zabbix-web-mysql-scl zabbix-apache-conf-scl -y

# 安装数据库
cd /usr/local/src/
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm 
rpm -ivh mysql57-community-release-el7-8.noarch.rpm
yum -y install mysql-server

# 启动mysql
systemctl start mysqld

# 查看密码
grep 'temporary password' /var/log/mysqld.log

# 修改密码
mysql -uroot -p

mysql> set password for root@localhost = password('Abc123!@#');

# 创建库
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'Abc123!@#';
mysql> quit;

# 导入数据库
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p'Abc123!@#' zabbix

# 若遇到报错
vim create.sql.gz
//在第一行加上
USE zabbix;

# 配置server的conf文件
grep ^[a-Z] /etc/zabbix/zabbix_server.conf 
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
DBName=zabbix
DBUser=zabbix
DBPassword=Abc123!@#
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
StatsAllowedIP=127.0.0.1

# 配置PHP
vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
...
php_value[date.timezone] = Asia/Shanghai
...

# 解决中文乱码
yum install wqy-microhei-fonts

# 替换默认字符集
cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf

# 启动zabbix-server和agent
systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm

# 浏览器打开
打开http:IP/zabbix  例:http://10.0.0.101/zabbix

proxy

# 安装proxy
yum install zabbix-proxy

# 安装数据库
cd /usr/local/src/
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm 
rpm -ivh mysql57-community-release-el7-8.noarch.rpm
yum -y install mysql-server

# 启动mysql
systemctl start mysqld

# 查看密码
grep 'temporary password' /var/log/mysqld.log

# 修改密码
mysql -uroot -p

mysql> set password for root@localhost = password('Abc123!@#');

# 创建库
mysql> create database zabbix_proxy character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix_proxy.* to zabbix@localhost identified by 'Abc123!@#';
mysql> quit;

# 导入
zcat /usr/share/doc/zabbix-proxy-mysql-5.0.15/schema.sql.gz |mysql -uzabbix -p'Abc123!@#' zabbix_proxy

#查看数据库
mysql -uzabbix -p'Abc123!@#'
show databases;
use zabbix_proxy;
show tables;
quit

#配置conf文件
grep ^[a-Z] /etc/zabbix/zabbix_proxy.conf 
Server=10.0.0.101
Hostname=zabbix-proxy
LogFile=/var/log/zabbix/zabbix_proxy.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_proxy.pid
SocketDir=/var/run/zabbix
DBHost=localhost
DBName=zabbix_proxy
DBUser=zabbix
DBPassword=Abc123!@#
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
StatsAllowedIP=127.0.0.1


#启动proxy并加入开机自启
systemctl start zabbix-proxy
systemctl enable zabbix-proxy
netstat -lntp

agent

# 安装agent
yum install zabbix-agent

#配置agent
grep ^[a-Z] /etc/zabbix/zabbix_agentd.conf 
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=172.16.1.102
ServerActive=172.16.1.102
Hostname=Zabbix server
Include=/etc/zabbix/zabbix_agentd.d/*.conf

#启动agnet并加入开机自启
systemctl start zabbix-agent
systemctl enable zabbix-agent
netstat -lntp

标签:log,zabbix5,server,zabbix,yum,proxy,mysql
From: https://www.cnblogs.com/ycmyay/p/17383836.html

相关文章

  • CentOS Linux release 7.6 zabbix5.0 安装
    #zabbix安装关方文档https://www.zabbix.com/cn/download?zabbix=5.0&os_distribution=centos&os_version=7&components=server_frontend_agent&db=mysql&ws=nginx安......
  • Centos7下Zabbix5.0部署
    系统简介:zabbix是一个企业级解决方案,支持实时监控数千台服务器,虚拟机和网络设备采集百万级监控指标。Zabbix的主要特点有:指标收集:从任何设备、系统、应用程序上进行......
  • Zabbix5.0微信报警
    3.1、注测企业微信:3.2、企业微信注册成功后进入后台管理:3.3、添加一个部门,并记住部门id:#我这里添加的子部门ID为23.4、添加一个用户到上面创建的部门里面(这里采取直接将管......
  • Zabbix5.0版本监控图表乱码问题
    Zabbix5.0管理界面提供多语种支持,切换中文可以通过如下操作完成:Usersettings→Users →Language→Chinese(zh_CN)→Update。中文界面中有一个小问题,就是汉字不能正常显......
  • zabbix5.0版本部署
    zabbix-server服务启动后,没有看到10051端口,那是因为:/etc/zabbix/zabbix_server.conf中连接数据库的值是lcoalhostlocalhost无法连接上数据库导致的。改成127.0.0.1就好了......
  • @zabbix5.4部署安装(zabbix+grafana)
    文章目录​​zabbix部署安装​​​​1.系统环境优化​​​​2.配置安装源​​​​3.安装zabbix​​​​4.数据库初始化​​​​5.zabbix数据表格式导入​​​​6.zabbix配置......
  • Zabbix5.0的安装(超详细)
    一、安装zabbix-server首先在虚拟机上把Centos7安装完毕并关闭防火墙与SElinux。打开Zabbix官网选择Zabbix版本-OS系统-OS版本-数据库-WebServer2、替换阿......