自動安裝zabbix agent的shell指令碼

來源:互聯網
上載者:User

標籤:ini   tmp   指令碼   fedora   echo   shel   login   figure   chkconfig   

#!/bin/bash

#install the zabbix agent

#Create by ShiYong

id zabbix &> /dev/null || useradd -s /sbin/nologin zabbix

mkdir /etc/zabbix /var/log/zabbix

chown zabbix.zabbix /var/log/zabbix/

tar zxf zabbix-2.0.12.tar.gz -C /usr/src/

cd /usr/src/zabbix-2.0.12/

./configure --prefix=/usr/local/zabbix/ --sysconfdir=/etc/zabbix/ --enable-agent &>/dev/null && make &>/dev/null && make install &> /dev/null

cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/

cd /etc/zabbix/

cp zabbix_agentd.conf zabbix_agentd.conf.origin

 

echo "modify the zabbix_agentd conf file"

sleep 1

read -p "input the zabbix server IP: " IP

 

#使用""引用變數IP

sed -i "/Server=127.0.0.1/ s/Server=127.0.0.1/Server=127.0.0.1,$IP/" /etc/zabbix/zabbix_agentd.conf

sed -i "/ServerActive=127.0.0.1/ s/ServerActive=127.0.0.1/ServerActive=$IP:10051/" /etc/zabbix/zabbix_agentd.conf

 

 

sed -i ‘/LogFile=\/tmp\/zabbix_agentd.log/ [email protected]=/tmp/[email protected]=/var/log/zabbix/[email protected]‘ /etc/zabbix/zabbix_agentd.conf

 

sed -i ‘/# UnsafeUserParameters=0/ s/# UnsafeUserParameters=0/UnsafeUserParameters=1/‘ /etc/zabbix/zabbix_agentd.conf

echo "Include=/etc/zabbix/zabbix_agentd.conf.d/" >> /etc/zabbix/zabbix_agentd.conf

 

ln -s /usr/local/zabbix/sbin/zabbix_agentd /usr/local/sbin/

/etc/init.d/zabbix_agentd start

chkconfig zabbix_agentd on

 

echo "zabbix install finished"

自動安裝zabbix agent的shell指令碼

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.