linux_centos7 监控软件 zabbix3.0.20 一键化安装部署脚本
zabbix3.0.20
zabbix-server端
#!/bin/bash
#一键化zabbix.sh,支持 centos7
# echo "配置本地yum源"
# rm -f /etc/yum.repos.d/*;wget -O /etc/yum.repos.d/localyum.repo http://10.0.0.253/soft/localyum.repo
# sed 's#\/6\/#\/7\/#g' /etc/yum.repos.d/localyum.repo -i &>/dev/null
# yum install vim -y
#centos7#centos7#centos7#centos7#centos7#centos7#centos7#centos7#centos7#centos7#centos7#centos7#centos7#centos7#centos7#centos7
function centos7_set {
#关闭防火墙及selinux
systemctl stop firewalld.service
systemctl disable firewalld.service
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
grep SELINUX=disabled /etc/selinux/config
setenforce 0
#安装数据库
yum install mariadb-server mariadb -y
systemctl start mariadb
systemctl enable mariadb
#下载rpm包
#rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
#rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-web-3.0.20-1.el7.noarch.rpm
rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
#"安装zabbix服务端数据库以及web界面》》》》》》》"
yum install zabbix-server-mysql zabbix-web-mysql -y
#"配置数据库密码为oldboy123"
mysqladmin -u root password "oldboy123"
mysql -hlocalhost -P3306 -uroot -poldboy123 $test --default-character-set=utf8 -e "create database zabbix character set utf8 collate utf8_bin;"
mysql -hlocalhost -P3306 -uroot -poldboy123 $test --default-character-set=utf8 -e "grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';"
#导入数据库
zcat /usr/share/doc/zabbix-server-mysql-3.0.20/create.sql.gz | mysql -uzabbix -pzabbix zabbix
#解决Zabbix服务器端运行状态报错问题
sed -i 's#\# DBPassword=#DBPassword=zabbix#' /etc/zabbix/zabbix_server.conf
#启动zabbix服务,加入开机自启
systemctl start zabbix-server
systemctl enable zabbix-server
#设置时区
echo 'php_value date.timezone Asia/Shanghai' >> /etc/httpd/conf.d/zabbix.conf
#启动Apache服务并且加入开机自启
systemctl start httpd #启动服务
systemctl enable httpd #配置为开机启动
}
centos7_set
echo "浏览器输入ip/zabbix回车"
echo "默认登录账户Admin"
echo "密码zabbix"
echo "数据库账户密码均为zabbix"
#centos7#centos7#centos7#centos7#centos7#centos7#centos7#centos7#centos7#centos7#centos7#centos7#centos7#centos7#centos7#centos7
#解决zabbix网站页面图形界面中文乱码
rm -f /usr/share/fonts/dejavu/DejaVuSans.ttf
wget -O /usr/share/fonts/dejavu/DejaVuSans.ttf http://ftp.ntu.edu.tw/cpatch/w/windows_10_font/msyhbd.ttc
zabbix-agent端
#centos7_3.0.20版本
rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/3.0/rhel/7/x86_64/zabbix-agent-3.0.20-1.el7.x86_64.rpm
#centos6_3.0.20版本
rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/3.0/rhel/6/x86_64/zabbix-agent-3.0.20-1.el6.x86_64.rpm