You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Ubuntu 24.04 zabbix 7 server setup with docer compose

Remove zabbix

docker compose -f zabbix.yml down
docker system prune --all -f
rm -Rf /docker/zabbix-db /docker/zabbix-server /docker/zabbix-web


Install zabbix

vi zabbix.yml
services:
  # Zabbix database
  zabbix-db:
    container_name: zabbix-db
    image: mariadb:11.3.2
    restart: always
    volumes:
      - /docker/zabbix-db/mariadb:/var/lib/mysql:rw
      - /docker/zabbix-db/backups:/backups
    command:
      - mariadbd
      - --character-set-server=utf8mb4
      - --collation-server=utf8mb4_bin
      - --default-authentication-plugin=mysql_native_password
    environment:
      - MARIADB_USER=zabbix
      - MARIADB_PASSWORDzabbix_pass
      - MARIADB_ROOT_PASSWORD=root_pass
    stop_grace_period: 1m

  # Zabbix server
  zabbix-server:
    container_name: zabbix-server
    image: zabbix/zabbix-server-mysql:7.0-ubuntu-latest
    restart: always
    ports:
      - 10051:10051
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /docker/zabbix-server/alertscripts:/usr/lib/zabbix/alertscripts:ro
      - /docker/zabbix-server/externalscripts:/usr/lib/zabbix/externalscripts:ro
      - /docker/zabbix-server/dbscripts:/var/lib/zabbix/dbscripts:ro
      - /docker/zabbix-server/export:/var/lib/zabbix/export:rw
      - /docker/zabbix-server/modules:/var/lib/zabbix/modules:ro
      - /docker/zabbix-server/enc:/var/lib/zabbix/enc:ro
      - /docker/zabbix-server/ssh_keys:/var/lib/zabbix/ssh_keys:ro
      - /docker/zabbix-server/mibs:/var/lib/zabbix/mibs:ro
    environment:
      - MYSQL_USER=zabbix
      - MYSQL_PASSWORD=zabbix_pass
      - MYSQL_ROOT_USER=root
      - MYSQL_ROOT_PASSWORD=root_pass
      - DB_SERVER_HOST=zabbix-db
      - ZBX_STARTPINGERS=10
    depends_on:
      - zabbix-db
    stop_grace_period: 30s
    sysctls:
      - net.ipv4.ip_local_port_range=1024 65000
      - net.ipv4.conf.all.accept_redirects=0
      - net.ipv4.conf.all.secure_redirects=0
      - net.ipv4.conf.all.send_redirects=0

  # Zabbix web UI
  zabbix-web:
    container_name: zabbix-web
    image: zabbix/zabbix-web-nginx-mysql:7.0-ubuntu-latest
    restart: always
    ports:
      - 80:8080
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /docker/zabbix-web/nginx:/etc/ssl/nginx:ro
      - /docker/zabbix-web/modules/:/usr/share/zabbix/modules/:ro
    environment:
      - MYSQL_USER=zabbix
      - MYSQL_PASSWORD=zabbix_pass
      - DB_SERVER_HOST=zabbix-db
      - ZBX_SERVER_HOST=zabbix.example.com
      - ZBX_SERVER_NAME=zabbix.example.com
      - PHP_TZ=Europe/Kyiv
    depends_on:
      - zabbix-db
      - zabbix-server
    stop_grace_period: 10s


mkdir /docker/zabbix-db /docker/zabbix-server /docker/zabbix-web
docker compose -f zabbix.yml up -d
docker logs zabbix-server --follow
docker inspect   -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' zabbix-server

setup client

wget https://repo.zabbix.com/zabbix/7.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_7.0-1+ubuntu24.04_all.deb
dpkg -i zabbix-release_7.0-1+ubuntu24.04_all.deb
apt update
apt install zabbix-agent2
#vi /etc/zabbix/zabbix_agent2.conf
systemctl status zabbix-agent2.service
vi /etc/zabbix/zabbix_agent2.conf
PidFile=/var/run/zabbix/zabbix_agent2.pid

LogFile=/var/log/zabbix/zabbix_agent2.log

LogFileSize=0

Server=zabbix.example.com.info,172.18.0.6/12

Hostname=somehost.example.com

Include=/etc/zabbix/zabbix_agent2.d/*.conf

PluginSocket=/run/zabbix/agent.plugin.sock

ControlSocket=/run/zabbix/agent.sock

Include=/etc/zabbix/zabbix_agent2.d/plugins.d/*.conf


Additional

Template for Synology monitoring

https://www.zabbix.com/integrations/synology


Example dasboard

  • No labels