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