apt -y install apt-file lsb-release git vim screen autoconf automake pkgconf gcc libc6-dev
autoconf automake git pkgconf
# install docker host
reboot
dietpi-software install 162
# Create the file repository configuration:
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
# Import the repository signing key:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
apt-file update
apt-file search psql
apt -y install postgresql-client-14
mkdir -p ${HOME}/postgresql/14 && docker run --name pg14 -t \
-e PGDATA=/var/lib/postgresql/data/pgdata \
-v ${HOME}/postgresql/14:/var/lib/postgresql/data \
-e POSTGRES_PASSWORD="zabbix" \
-e POSTGRES_DB="dummy_db" \
--restart unless-stopped \
-p 7414:5432 -d timescale/timescaledb:2.5.0-pg14
# clone zabbix repo
cd
git clone https://github.com/zabbix/zabbix.git
cd zabbix
git reset --hard HEAD && git clean -fd
git checkout release/5.0
docker exec -it pg14 su - postgres
psql
postgres=# \password postgres
Enter new password:
postgres=# \q
cd /etc/profile.d
cat << 'EOF' > postgres.sh
PGHOST=127.0.0.1
PGUSER=postgres
PGPORT=7414
PGPASSWORD=postgres
export PGHOST
export PGUSER
export PGPORT
export PGPASSWORD
EOF
# exit terminal for the bash environment to pick up changes
exit
# create new user which will be used for everything
createuser --pwprompt zabbix
docker run --name za2 --privileged --volume /:/rootfs --net=host --volume /var/run:/var/run -e ZBX_ENABLEPERSISTENTBUFFER=true -e ZBX_PERSISTENTBUFFERPERIOD=30d -e ZBX_HOSTNAMEITEM="system.run[echo $(hostname -s).gnt2.ak.lan]" -e ZBX_PASSIVE_ALLOW="false" -e ZBX_PASSIVESERVERS="127.0.0.1" -e ZBX_STARTAGENTS=3 -e ZBX_BUFFERSIZE=65535 -e ZBX_REFRESHACTIVECHECKS=3600 -e ZBX_SERVER_HOST="167.71.78.40" -e ZBX_ALLOWKEY="system.run[*]" --restart unless-stopped -d zabbix/zabbix-agent2:ol-5.0.17
docker run --name zp50 -e ZBX_HOSTNAMEITEM="system.run[echo $(hostname -s)]" -e ZBX_SERVER_HOST=167.71.78.40 -e ZBX_SERVER_PORT=10051 -e ZBX_STARTTRAPPERS=3 -e ZBX_ENABLEREMOTECOMMANDS=1 --restart unless-stopped -d zabbix/zabbix-proxy-sqlite3:ol-5.0.17
cd /tmp
wget https://cdn.zabbix.com/zabbix/sources/oldstable/3.0/zabbix-3.0.32.tar.gz
tar xvf zabbix-3.0.32.tar.gz
cd zabbix-3.0.32/database/postgresql
createdb -O zabbix z30
cat schema.sql images.sql data.sql | PGUSER=zabbix PGPASSWORD=zabbix psql z30
docker stop z30pg && docker rm z30pg && docker run --name z30pg -t \
-e DB_SERVER_HOST="192.168.88.59" \
-e DB_SERVER_PORT="7414" \
-e POSTGRES_DB="z30" \
-e POSTGRES_USER="zabbix" \
-e POSTGRES_PASSWORD="zabbix" \
--restart unless-stopped \
-p 130:8080 -d zabbix/zabbix-web-nginx-pgsql:alpine-3.0.32
cd /tmp
wget https://cdn.zabbix.com/zabbix/sources/stable/4.0/zabbix-4.0.35.tar.gz
tar xvf zabbix-4.0.35.tar.gz
cd zabbix-4.0.35/database/postgresql
createdb -O zabbix z40
cat schema.sql images.sql data.sql | PGUSER=zabbix PGPASSWORD=zabbix psql z40
docker stop z40pg && docker rm z40pg && docker run --name z40pg -t \
-e DB_SERVER_HOST="192.168.88.59" \
-e DB_SERVER_PORT="7414" \
-e POSTGRES_DB="z40" \
-e POSTGRES_USER="zabbix" \
-e POSTGRES_PASSWORD="zabbix" \
--restart unless-stopped \
-p 140:8080 -d zabbix/zabbix-web-nginx-pgsql:alpine-4.0.35
docker stop z50pg && docker rm z50pg && docker run --name z50pg -t \
-e DB_SERVER_HOST="192.168.88.59" \
-e DB_SERVER_PORT="7414" \
-e POSTGRES_DB="z50" \
-e POSTGRES_USER="zabbix" \
-e POSTGRES_PASSWORD="zabbix" \
--restart unless-stopped \
-p 150:8080 -d zabbix/zabbix-web-nginx-pgsql:alpine-5.0.17
No comments:
Post a Comment