首页 > 代码库 > zabbix客户在linux 上安装

zabbix客户在linux 上安装

#!/bin/bash
ip=59.201.201.152
groupadd zabbix
useradd -g zabbix zabbix
yum -y install gcc  curl-devel net-snmp-devel fping e2fsprogs-devel zlib-devel libgssapi-devel krb5-devel openssl-devel wget libssh2-devel openldap-devel libxml2-devel make patch
rm -rf /etc/zabbix
rm -rf zabbix-2.4.3
rm zabbix-2.4.3.tar.gz
wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.4.3/zabbix-2.4.3.tar.gz
RETVAL=$?
tar xzf zabbix-2.4.3.tar.gz
cd zabbix-2.4.3
./configure --prefix=/opt/zabbix_agent --enable-agent
make install
cat >>/etc/services<<EOF
zabbix-agent 10050/tcp Zabbix Agent
zabbix-agent 10050/udp Zabbix Agent
zabbix-trapper 10051/tcp Zabbix Trapper
zabbix-trapper 10051/udp Zabbix Trapper
EOF

sed -i "s/^[ ]*Server=.*/Server=$ip/g" /opt/zabbix_agent/etc/zabbix_agent.conf
sed -i "s/^[ ]*Server=.*/Server=$ip/g" /opt/zabbix_agent/etc/zabbix_agentd.conf

cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
sed -i "s#^[ ]*BASEDIR.*#          BASEDIR=/opt/zabbix_agent#g" /etc/init.d/zabbix_agentd
chmod a+x /etc/init.d/zabbix_*

cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
chmod a+x /etc/init.d/zabbix_*
BASEDIR=/ect/zabbix_agent
FULLPATH=$BASEDIR/sbin/$BINARY_NAME
#configuration file
CONF_FILE=$BASEDIR/etc/zabbix_agentd.conf
action $"Starting $BINARY_NAME: " $FULLPATH -c $CONF_FILE
service zabbix_agentd start
ps ax|grep zabbix_agentd

zabbix客户在linux 上安装