version: '2'
services:
web:
image: zabbix/zabbix-web-nginx-mysql
hostname: "web"
links:
- server
- db
ports:
- "8080:80"
environment:
DB_SERVER_HOST: db
MYSQL_USER: "root"
MYSQL_DATABASE: "zabbix"
MYSQL_PASSWORD: "123456a"
ZBX_SERVER_HOST: server
PHP_TZ: "Asia/Shanghai"
server:
image: zabbix/zabbix-server-mysql
hostname: "server"
links:
- db
ports:
- "10051:10051"
environment:
DB_SERVER_HOST: db
MYSQL_USER: "root"
MYSQL_DATABASE: "zabbix"
MYSQL_PASSWORD: "123456a"
db:
image: mysql
hostname: "db"
environment:
- MYSQL_ROOT_PASSWORD=123456a
from https://www.cnblogs.com/saneri/p/6019858.html
#!/bin/bash
#suto install zabbix_agentd
#author :swh
echo "Now this shell will install zabbix_agentd autoly:please wait"
yum install net-snmp-devel libxml2-devel libcurl-devel -y
echo "add zabbix group and user:"
groupadd zabbix
useradd -r zabbix -g zabbix -s /sbin/nologin
echo "download package -make and make install "
cd /usr/local/src
wget -c "http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.0.3/zabbix-3.0.3.tar.gz"
tar -xzvf zabbix-3.0.3.tar.gz
cd zabbix-3.0.3
./configure --prefix=/usr/local/zabbix-3.0.3/ --enable-agent
make
make install
ret=$?
if [ $? -eq 0 ]
then
read -p "please input zabbix_serverIP:" zabbix_serverIP
sed -i 's/Server=127.0.0.1/Server='$zabbix_serverIP'/' /usr/local/zabbix-3.0.3/etc/zabbix_agentd.conf
sed -i 's/ServerActive=127.0.0.1/ServerActive='$zabbix_serverIP'/' /usr/local/zabbix-3.0.3/etc/zabbix_agentd.conf
sed -i 's/Hostname=Zabbix server/Hostname='$HOSTNAME'/' /usr/local/zabbix-3.0.3/etc/zabbix_agentd.conf
echo "zabbix install success,you need set hostname: $HOSTNAME"
else
echo "install failed,please check"
fi
/usr/local/zabbix-3.0.3/sbin/zabbix_agentd
if [ $? -eq 0 ]
then
echo "set zabbix_agentd start with system"
echo "/usr/local/zabbix-3.0.3/sbin/zabbix_agentd start" >> /etc/rc.d/rc.local
else
echo "start error,please check"
fi