Zabbix agentインストールスクリプト
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
[[Zabbix]]
*説明 [#w6eaed37]
対話式のインストールスクリプトです。
*スクリプトの内容 [#oe2b90af]
#!/bin/bash
### Zabbix agent install check
RPMCHK=`rpm -qa | grep zabbix-agent`
if [ $? -eq 0 ];
then
echo "Zabbix agent is aleready installed."
exit 10
fi
### Zabbix install check
MACHINEARC01=`uname -m`
case ${MACHINEARC01} in
x86_64 ) ARC01=x84_64 ;;
i686 ) ARC01=i386 ;;
i386 ) ARC01=i386 ;;
esac
cd /usr/local/src
wget http://repo.zabbix.com/zabbix/2.2/rhel/6/${ARC01}/z...
if [ $? -ne 0 ] ; then echo "[FAIL] It does not installe...
wget http://repo.zabbix.com/zabbix/2.2/rhel/6/${ARC01}/z...
if [ $? -ne 0 ] ; then echo "[FAIL] It does not installe...
rpm -ivh zabbix-*
if [ $? -ne 0 ] ; then echo "[FAIL] It does not installe...
chkconfig zabbix-agent on
### Zabbix agent conf var
cd /etc/zabbix
cp -p zabbix_agentd.conf zabbix_agentd.conf.original.`da...
echo " "
sleep 2
echo -n "Type server IP address for zabbix check :"
read LISTENIP
sed -i "s/# ListenIP=0.0.0.0/ListenIP=${LISTENIP}/g" ./z...
#sed -i "s/# SourceIP=/SourceIP=${LISTENIP}/g" ./zabbix_...
#echo -n "Type server IP address for outgoing connection...
#read OUTIP
#sed -i "s/# SourceIP=/SourceIP=${OUTIP}/g" ./zabbix_age...
echo -n "Type Zabbix server IP address :"
read ZABBIXIP
sed -i "s/Server=127.0.0.1/Server=${ZABBIXIP}/g" ./zabbi...
sed -i "s/ServerActive=127.0.0.1 /ServerActive=${ZABBIXI...
sed -i "s/Hostname=Zabbix server/Hostname=${HOSTNAME}/g"...
sed -i "s/# Timeout=3/Timeout=10/g" ./zabbix_agentd.conf
### Zabbix start
/etc/init.d/zabbix-agent start
if [ $? -eq 0 ];then
echo "[INFO] Zabbix agent start success!!"
else
echo "[FAIL] Zabbix agent start failed... bye.";exit
fi
### Fire wall
echo -n "Do you change iptables config?(y/n):"
read IPTBL
if [ ${IPTBL} = "y" ]; then
cd /etc/sysconfig
cp -p iptables iptables.`date +%Y%m%d`
iptables -A INPUT -s ${ZABBIXIP}/32 -p tcp -j ACCEPT
service iptables save
if [ $? -eq 0 ]; then
echo "[IFNO] iptables config change script succes...
else
echo "[FAIL] Please check iptables config file.";...
fi
else
echo "[INFO] iptables config does not chanege."
fi
echo "[INFO] Zabbix agent install script success!"
exit 0
終了行:
[[Zabbix]]
*説明 [#w6eaed37]
対話式のインストールスクリプトです。
*スクリプトの内容 [#oe2b90af]
#!/bin/bash
### Zabbix agent install check
RPMCHK=`rpm -qa | grep zabbix-agent`
if [ $? -eq 0 ];
then
echo "Zabbix agent is aleready installed."
exit 10
fi
### Zabbix install check
MACHINEARC01=`uname -m`
case ${MACHINEARC01} in
x86_64 ) ARC01=x84_64 ;;
i686 ) ARC01=i386 ;;
i386 ) ARC01=i386 ;;
esac
cd /usr/local/src
wget http://repo.zabbix.com/zabbix/2.2/rhel/6/${ARC01}/z...
if [ $? -ne 0 ] ; then echo "[FAIL] It does not installe...
wget http://repo.zabbix.com/zabbix/2.2/rhel/6/${ARC01}/z...
if [ $? -ne 0 ] ; then echo "[FAIL] It does not installe...
rpm -ivh zabbix-*
if [ $? -ne 0 ] ; then echo "[FAIL] It does not installe...
chkconfig zabbix-agent on
### Zabbix agent conf var
cd /etc/zabbix
cp -p zabbix_agentd.conf zabbix_agentd.conf.original.`da...
echo " "
sleep 2
echo -n "Type server IP address for zabbix check :"
read LISTENIP
sed -i "s/# ListenIP=0.0.0.0/ListenIP=${LISTENIP}/g" ./z...
#sed -i "s/# SourceIP=/SourceIP=${LISTENIP}/g" ./zabbix_...
#echo -n "Type server IP address for outgoing connection...
#read OUTIP
#sed -i "s/# SourceIP=/SourceIP=${OUTIP}/g" ./zabbix_age...
echo -n "Type Zabbix server IP address :"
read ZABBIXIP
sed -i "s/Server=127.0.0.1/Server=${ZABBIXIP}/g" ./zabbi...
sed -i "s/ServerActive=127.0.0.1 /ServerActive=${ZABBIXI...
sed -i "s/Hostname=Zabbix server/Hostname=${HOSTNAME}/g"...
sed -i "s/# Timeout=3/Timeout=10/g" ./zabbix_agentd.conf
### Zabbix start
/etc/init.d/zabbix-agent start
if [ $? -eq 0 ];then
echo "[INFO] Zabbix agent start success!!"
else
echo "[FAIL] Zabbix agent start failed... bye.";exit
fi
### Fire wall
echo -n "Do you change iptables config?(y/n):"
read IPTBL
if [ ${IPTBL} = "y" ]; then
cd /etc/sysconfig
cp -p iptables iptables.`date +%Y%m%d`
iptables -A INPUT -s ${ZABBIXIP}/32 -p tcp -j ACCEPT
service iptables save
if [ $? -eq 0 ]; then
echo "[IFNO] iptables config change script succes...
else
echo "[FAIL] Please check iptables config file.";...
fi
else
echo "[INFO] iptables config does not chanege."
fi
echo "[INFO] Zabbix agent install script success!"
exit 0
ページ名: