Feb
28
Ubuntu 16.04 - Zabbix Agent 部署脚本
留档备查
脚本里设置了 ServerActive ,会主动尝试到zabbix server注册,但需要先在zabbix frontend的 configuration->actions->auto registration 配置好 add host 动作,这样才会自动添加。
#!/bin/bash
set -x
ZABBIX_SERVER=192.168.1.100
wget http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.2-1+xenial_all.deb
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=.*$/ServerActive=lan.zabbix.thebitplus.com/' \
-e 's/^Hostname=.*$/Hostname='`hostname`'/' \
/etc/zabbix/zabbix_agentd.conf
sudo update-rc.d zabbix-agent enable
sudo service zabbix-agent restart
echo "Done"
转载请注明出自 ,如是转载文则注明原出处,谢谢:)
RSS订阅地址: https://www.felix021.com/blog/feed.php 。
脚本里设置了 ServerActive ,会主动尝试到zabbix server注册,但需要先在zabbix frontend的 configuration->actions->auto registration 配置好 add host 动作,这样才会自动添加。
引用
#!/bin/bash
set -x
ZABBIX_SERVER=192.168.1.100
wget http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.2-1+xenial_all.deb
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=.*$/ServerActive=lan.zabbix.thebitplus.com/' \
-e 's/^Hostname=.*$/Hostname='`hostname`'/' \
/etc/zabbix/zabbix_agentd.conf
sudo update-rc.d zabbix-agent enable
sudo service zabbix-agent restart
echo "Done"
欢迎扫码关注:
转载请注明出自 ,如是转载文则注明原出处,谢谢:)
RSS订阅地址: https://www.felix021.com/blog/feed.php 。