Forked from freeminder/zabbix_agent_install.sh
Last active
September 12, 2021 14:30
-
-
Save mrl22/2cef9305c513f9b4d24ac69a364c5c9a to your computer and use it in GitHub Desktop.
Zabbix Agent installation script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
if [ "$UID" -ne 0 ]; then | |
echo "Please run as root" | |
exit 1 | |
fi | |
# Only run it if we can (ie. on Ubuntu/Debian) | |
if [ -x /usr/bin/apt-get ]; then | |
apt-get update | |
apt-get -y install zabbix-agent sysv-rc-conf | |
sysv-rc-conf zabbix-agent on | |
sed -i 's/Server=127.0.0.1/Server=18.133.222.190/' /etc/zabbix/zabbix_agentd.conf | |
sed -i 's/ServerActive=127.0.0.1/ServerActive=18.133.222.190/' /etc/zabbix/zabbix_agentd.conf | |
HOSTNAME=`hostname` && sed -i "s/Hostname=Zabbix\ server/Hostname=$HOSTNAME/" /etc/zabbix/zabbix_agentd.conf | |
service zabbix-agent restart | |
fi | |
# Only run it if we can (ie. on RHEL/CentOS) | |
if [ -x /usr/bin/yum ]; then | |
yum -y update | |
rpm -ivh http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm | |
yum -y install zabbix-agent | |
chkconfig zabbix-agent on | |
sed -i 's/Server=127.0.0.1/Server=18.133.222.190/' /etc/zabbix/zabbix_agentd.conf | |
sed -i 's/ServerActive=127.0.0.1/ServerActive=18.133.222.190/' /etc/zabbix/zabbix_agentd.conf | |
HOSTNAME=`hostname` && sed -i "s/Hostname=Zabbix\ server/Hostname=$HOSTNAME/" /etc/zabbix/zabbix_agentd.conf | |
service zabbix-agent restart | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment