zabbix 4.0监控平台快速部署
2019.12.07 TsengYia
---- http://tsengyia.blog.chinaunix.net/
系统环境:
CentOS Linux release 7.5.1804 (Core)
软件环境:
zabbix-agent-4.0.15-1.el7
zabbix-server-mysql-4.0.15-1.el7
zabbix-web.4.0.15-1.el7
zabbix-web-mysql-4.0.15-1.el7
fping-3.10-4.el7
iksemel-1.4-6.sdl7
#################################################################
#!/bin/bash
# TsengYia 2019.12.07
# for CentOS 7.5 or RHEL 7.5 Server
# 1. 设置好软件源(比如国内阿里的镜像)
rm -rf /etc/yum.repos.d/*.repo #//清理其他可能有问题的源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#//下载阿里的CentOS 7源配置
yum-config-manager --add https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/x86_64/
#//添加阿里的zabbix 4.0源配置
sed '/gpgcheck/s/1/0/g' /etc/yum.conf #//关闭GPG签名检查
# 2. 安装LAMP平台、依赖包
yum -y install httpd mariadb-server mariadb php php-mysql
yum -y install http://rpmfind.net/linux/epel/7/x86_64/Packages/f/fping-3.10-4.el7.x86_64.rpm
yum -y install http://springdale.math.ias.edu/data/puias/unsupported/7/x86_64//iksemel-1.4-6.sdl7.x86_64.rpm
# 3. 安装zabbix,简单检查
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
if [ $(yum list installed | grep -c zabbix) -lt 4 ]
then
echo "zabbix packages installation failed." >&2
exit 2
fi
# 4. 数据库配置、初始化
systemctl restart mariadb ; systemctl enable mariadb
mysql -uroot -e 'create database zabbix character set utf8 collate utf8_bin;'
mysql -uroot -e 'grant all privileges on zabbix.* to zabbix@localhost identified by "password";'
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -ppassword zabbix
# 5. 配置、启动zabbix-server平台
sed -i '/timezone/{s/#//g;s#Europe/Riga#Asia/Shanghai#g}' /etc/httpd/conf.d/zabbix.conf
systemctl restart httpd ; systemctl enable httpd
sed -i '/DBPassword=/cDBPassword=password' /etc/zabbix/zabbix_server.conf
systemctl restart zabbix-server zabbix-agent ; systemctl enable zabbix-server zabbix-agent
# 6. 结果提示
echo '请访问 http://server_ip_or_name/zabbix,按照提示完成zabbix前端安装'
#################################################################
阅读(170) | 评论(0) | 转发(0) |