Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Ubuntu 16.04 - Zabbix Agent 部署脚本:脚本里设置了 ServerActive ,会主动尝试到zabbix server注册,但需要先在zabbix frontend的 configuration->actions->auto registration 配置好 add host 动作,这样才会自动添加。
set -x
dpkg -i zabbix-release_3.2-1+xenial_all.deb
apt update
apt -y install zabbix-agent
ip=`ifconfig | grep -o 'inet addr:172\.[0-9.]*' | awk -F: '{print $2}'`
sed -i \
-e 's/^Server=.*$/Server='$ZABBIX_SERVER'/' \
-e 's/^ServerActive=.*$/' \
-e 's/^Hostname=.*$/Hostname='`hostname`'/' \
sudo update-rc.d zabbix-agent enable
sudo service zabbix-agent restart
echo "Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.