一、一鍵部署 zabbix_agent shell腳本c++
cat auto_install_zabbix_agent_v2.sh #!/bin/bash #2020-9-23 16:21:15 #auto install zabbix #by jiachuanlin ####################### ZBX_VER="5.0.3" ZBX_SOFT="zabbix-${ZBX_VER}.tar.gz" ZBX_DIR="/usr/local/zabbix" ZBX_ANT="zabbix_agentd" ZBX_BAK="/data/backup/2020607" ZBX_URL="https://cdn.zabbix.com/zabbix/sources/stable/5.0" ZBX_SER_IP="192.168.0.11" ZBX_CLI_IP="192.168.0.12" yum install -y gcc gcc-c++ glibc wget tar make pcre* wget -c $ZBX_URL/$ZBX_SOFT tar -xzf $ZBX_SOFT cd zabbix-${ZBX_VER} ./configure --prefix=$ZBX_DIR/ --enable-agent make make install \cp ../zabbix-${ZBX_VER}/misc/init.d/tru64/${ZBX_ANT} /etc/init.d/ chmod o+x /etc/init.d/${ZBX_ANT} useradd -s /sbin/nologin zabbix ln -s $ZBX_DIR/sbin/* /usr/local/sbin/ mkdir -p ${ZBX_BAK} cp $ZBX_DIR/etc/${ZBX_ANT}.conf ${ZBX_BAK} cat>$ZBX_DIR/etc/${ZBX_ANT}.conf<<EOF LogFile=/tmp/${ZBX_ANT}.log Server=${ZBX_SER_IP} ServerActive=${ZBX_SER_IP} Hostname = ${ZBX_CLI_IP} EOF /etc/init.d/${ZBX_ANT} start ps -ef|grep zabbix netstat -tnlp|grep 10050 setenforce 0 systemctl stop firewalld.service
添加到開機啓動:shell
vim /etc/rc.local 添加:/usr/local/zabbix/sbin/zabbix_agentd