Skip to content

Instantly share code, notes, and snippets.

@lichti
Created December 15, 2016 14:08
Show Gist options
  • Save lichti/73a8d1559b362ff8c142cb6308352df1 to your computer and use it in GitHub Desktop.
Save lichti/73a8d1559b362ff8c142cb6308352df1 to your computer and use it in GitHub Desktop.
ZABBIX_SERVER=zabbix-server.lichti.com.br
ZABBIX_PROXY=zabbix-proxy.lichti.com.br
ZABBIX_DBPASS=my_super_pass
sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
setenforce Permissive
sed -i "s/^HOSTNAME=.*/HOSTNAME=${ZABBIX_PROXY}/g" /etc/sysconfig/network
echo '${ZABBIX_PROXY}' > /etc/hostname
systemctl disable firewalld
yum update
yum install epel-release -y
yum install mariadb-server mariadb -y
rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
yum install zabbix-proxy-mysql zabbix-agent -y
systemctl enable mariadb
systemctl enable zabbix-proxy
systemctl enable zabbix-agent
systemctl start mariadb
mysql_secure_installation
mysql -uroot -p -e "create database zabbixdb character set utf8;"
mysql -uroot -p -e "grant all privileges on zabbixdb.* to 'zabbixuser'@'localhost' identified by '${ZABBIX_DBPASS}';"
mysql -uroot -p -e "flush privileges;"
zcat /usr/share/doc/zabbix-proxy-mysql-3.2.2/schema.sql.gz | mysql -uzabbixuser -p${ZABBIX_DBPASS} zabbixdb
cat << EOF > /etc/zabbix/zabbix_proxy.conf
Server=${ZABBIX_SERVER}
ServerPort=10051
Hostname=${ZABBIX_PROXY}
ListenPort=10051
LogFile=/var/log/zabbix/zabbix_proxy.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_proxy.pid
DBHost=localhost
DBName=zabbixdb
DBUser=zabbixuser
DBPassword=${ZABBIX_DBPASS}
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
EOF
cat << EOF > /etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=${ZABBIX_PROXY}
ServerActive=${ZABBIX_PROXY}
Hostname=${ZABBIX_PROXY}
Include=/etc/zabbix/zabbix_agentd.d/*.conf
EOF
systemctl restart mariadb
systemctl start zabbix-server
systemctl start zabbix-agent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment