#!/bin/bash
# 此腳本主要針對(duì)CentOS 6 or 7 版本進(jìn)行zabbix-agent添加
# 以root用戶運(yùn)行腳本
if [ $(id -u) != "0" ]; then
echo "You must be root to run this script ..."
exit 1
fi
if [ $# != "1" ]; then
echo "Give me ZABBIX server IP ..."
exit 2
fi
# selinux 會(huì)阻止服務(wù)開啟,所以關(guān)閉
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
setenforce 0
if [ -f /etc/redhat-release ];then
Edition=`grep -o '[[:digit:]]' /etc/redhat-release |head -1`
else
Edition=`uname`
fi
case "$Edition" in
7)
echo -e "\n\033[34mStart installation……\033[0m\n"
rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
yum -y install zabbix-agent zabbix-sender
sed -i "/Server/s/Server=127.0.0.1/Server=$1/" /etc/zabbix/zabbix_agentd.conf
sed -i "/Server/s/ServerActive=127.0.0.1/ServerActive=$1/" /etc/zabbix/zabbix_agentd.conf
systemctl start zabbix-agent
systemctl enable zabbix-agent
;;
6)
echo -e "\n\033[34mStart installation……\033[0m\n"
rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm
yum -y install zabbix-agent zabbix-sender
sed -i "/Server/s/Server=127.0.0.1/Server=$1/" /etc/zabbix/zabbix_agentd.conf
sed -i "/Server/s/ServerActive=127.0.0.1/ServerActive=$1/" /etc/zabbix/zabbix_agentd.conf
/etc/init.d/zabbix-agent start
chkconfig zabbix-agent on
;;
*)
echo "========================================================================"
echo "This system is not CentOS 6 or 7, script execution failed!!"
echo "========================================================================"
exit 3
esac
if ss -ntl|grep 10050 &>/dev/null; then
echo -e "\n\033[32mCongratulations, ZABBIX client installed successfully\033[0m\n"
else
echo -e "\n\033[31mSorry, please rerun the command or contact the administrator\033[0m\n"
fi
成都創(chuàng)新互聯(lián)是一家專業(yè)提供茶陵企業(yè)網(wǎng)站建設(shè),專注與網(wǎng)站設(shè)計(jì)、網(wǎng)站制作、H5頁(yè)面制作、小程序制作等業(yè)務(wù)。10年已為茶陵眾多企業(yè)、政府機(jī)構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)網(wǎng)絡(luò)公司優(yōu)惠進(jìn)行中。
新聞標(biāo)題:zabbix-client-install
文章源于:http://muchs.cn/article6/igeiog.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站策劃、自適應(yīng)網(wǎng)站、搜索引擎優(yōu)化、定制網(wǎng)站、App開發(fā)、網(wǎng)站排名
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)