Install postgres:

mkdir /opt/pgdata
docker run -d --name postgres --restart always -p 5432:5432 -e POSTGRES_PASSWORD=***** -e PGDATA=/var/lib/postgresql/data/pgdata -v /opt/pgdata:/var/lib/postgresql/data postgres


Create the Database

sudo apt-get install postgresql-client
psql -U postgres -h localhost


In the PSQL Console

CREATE ROLE zabbix WITH LOGIN PASSWORD '******' VALID UNTIL 'infinity';
CREATE DATABASE zabbix WITH ENCODING 'UTF-8' OWNER=zabbix CONNECTION LIMIT=-1;


Install Zabbix Server and Web Frontend:

docker run -d --restart always --name zabbix-server-pgsql -e DB_SERVER_HOST="77.243.52.131" -e POSTGRES_USER="zabbix" -e POSTGRES_PASSWORD="******" -p 10051:10051 zabbix/zabbix-server-pgsql

docker run -d --restart always --name zabbix-web-apache-pgsql -e DB_SERVER_HOST="77.243.52.131" -e POSTGRES_USER="zabbix" -e POSTGRES_PASSWORD="*****" -e ZBX_SERVER_HOST="77.243.52.131" -e PHP_TZ="Europe/Copenhagen" -p 8080:8080 zabbix/zabbix-web-apache-pgsql


Zabbix frontend should now be available at port 8080

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-zabbix-to-securely-monitor-remote-servers-on-centos-7#:~:text=The%20default%20user%20is%20Admin%20and%20the%20password%20is%20zabbix.


Agent install on the Zabbix server:

docker run --restart always --name zabbix-agent -e ZBX_HOSTNAME="moserver" -e ZBX_SERVER_HOST="???" -d --privileged -p 10050:10050 zabbix/zabbix-agent


On other Hosts:

docker run --restart always --name zabbix-agent -e ZBX_HOSTNAME="moserver" -e ZBX_SERVER_HOST="77.243.52.131" -d --privileged -p 10050:10050 zabbix/zabbix-agent


View logs

docker logs --tail 50 --follow --timestamps "zabbix-agent"