Deployment guide

Zabbix on a VPS: Monitor Servers, Services and Network

Deploy on a VPS Cloud →

Tutorial

Self-hosting

Zabbix on a VPS: Monitor Servers, Services and Network

A disk filling up overnight, a service stopping without warning, a saturated network link: without monitoring, a customer is the one who tells you. Zabbix is an open-source monitoring platform (AGPL-3.0 licence) that watches servers, applications and network devices, and notifies the right person as soon as a threshold is crossed. This guide installs it on a VPS with Docker Compose, puts it behind nginx over HTTPS, links the VPS to its own agent, then adds your other servers and your alerts.

6 min read3 steps
Contents· What Zabbix does1/12
  1. 01What Zabbix does
  2. 02What Zabbix brings
  3. 03Zabbix compared with other options
  4. 04Prerequisites
  5. 05Install Zabbix with Docker Compose
  6. 06Change the factory password first
  7. 07Put Zabbix behind nginx over HTTPS
  8. 08Link the "Zabbix server" host to the VPS agent
  9. 09Monitor your other servers
  10. 10Receive alerts
  11. 11Back up and update
  12. 12One-click installation on ServOrbit

What Zabbix does

Zabbix collects measurements — CPU load, free memory, disk space, a service's state, a page's response time — and compares them with triggers. When an expression becomes true, for example "less than 10% free space for five minutes", Zabbix opens a problem, shows it on its dashboards and runs the planned actions: an email, a Telegram message, a webhook.

Measurements arrive through several paths: the Zabbix agent installed on each server, the SNMP protocol for routers, switches and UPS units, web scenarios for websites and APIs, or direct queries to a database. Ready-made templates group the right items and triggers for Linux, Windows, nginx, MySQL, PostgreSQL or Docker.

What Zabbix brings

  • Linux and Windows agents — CPU, memory, disks, network, services, processes and logs.
  • SNMP — network devices monitored without an agent, with automatic interface discovery.
  • Triggers and escalations — readable thresholds, dependencies between hosts, alerts that move up a level if nobody reacts.
  • Web scenarios — availability, response time and content of a sequence of pages or API calls.
  • Dashboards, maps and reports — for the operations team as well as for your clients.
  • Permissions per host group — each user only sees what concerns them.

Zabbix compared with other options

Scroll the table

ZabbixPrometheus + GrafanaUptime Kuma
What is monitoredServers, services, network, websitesApplication and container metricsAvailability of sites and ports
CollectionAgent, SNMP, HTTP, databasesScraped exportersHTTP, TCP and ping probes
ConfigurationWeb interfaceYAML filesWeb interface
AlertsBuilt in, with escalationsSeparate AlertmanagerBuilt in
CostPrice of the VPSPrice of the VPSPrice of the VPS

Prerequisites

An Ubuntu 24.04 VPS with 2 GB of RAM and 20 GB of disk for a few dozen hosts, Docker and the Compose plugin installed, and a subdomain pointing to the VPS, for example zabbix.example.com. Plan more disk if you keep a long history: the PostgreSQL database grows with the number of measurements.

Install Zabbix with Docker Compose

  1. Prepare the directory and the database password

    The .env file holds the PostgreSQL password, shared by the server and the web interface.

    mkdir -p /opt/zabbix && cd /opt/zabbix
    echo "DB_PASSWORD=$(openssl rand -hex 16)" > .env
    chmod 600 .env
  2. Write the docker-compose.yml file

    Four services: the Zabbix server, the web interface (nginx and PHP), the VPS agent and PostgreSQL. Only the web interface is published, and only on the loopback: nginx will handle HTTPS.

    services:
      zabbix-server:
        image: zabbix/zabbix-server-pgsql:alpine-8.0.0
        restart: unless-stopped
        depends_on:
          database:
            condition: service_healthy
        environment:
          DB_SERVER_HOST: database
          POSTGRES_USER: zabbix
          POSTGRES_PASSWORD: ${DB_PASSWORD}
          POSTGRES_DB: zabbix
      zabbix-web:
        image: zabbix/zabbix-web-nginx-pgsql:alpine-8.0.0
        restart: unless-stopped
        depends_on:
          - zabbix-server
        ports:
          - "127.0.0.1:8080:8080"
        environment:
          ZBX_SERVER_HOST: zabbix-server
          DB_SERVER_HOST: database
          POSTGRES_USER: zabbix
          POSTGRES_PASSWORD: ${DB_PASSWORD}
          POSTGRES_DB: zabbix
          PHP_TZ: Africa/Casablanca
      zabbix-agent:
        image: zabbix/zabbix-agent2:alpine-8.0.0
        restart: unless-stopped
        environment:
          ZBX_HOSTNAME: "Zabbix server"
          ZBX_SERVER_HOST: zabbix-server
      database:
        image: postgres:17.11-alpine
        restart: unless-stopped
        environment:
          POSTGRES_USER: zabbix
          POSTGRES_PASSWORD: ${DB_PASSWORD}
          POSTGRES_DB: zabbix
        volumes:
          - zabbix-db:/var/lib/postgresql/data
        healthcheck:
          test: ["CMD-SHELL", "pg_isready -U zabbix -d zabbix"]
          interval: 5s
          retries: 12
    volumes:
      zabbix-db: {}
  3. Start the stack

    On first start, the server creates the database schema; allow a minute before the interface answers.

    docker compose up -d
    docker compose ps
    curl -fsS -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8080/

Change the factory password first

A fresh Zabbix installation opens the Admin account with the password zabbix, known to everyone. Log in immediately and replace it in User settings, Profile, Change password — even before putting the interface behind its domain name.

Put Zabbix behind nginx over HTTPS

Port 8080 only listens on 127.0.0.1: nginx, installed on the host, receives public traffic and relays it. Certbot then adds the certificate and the redirect to HTTPS.

server {
    listen 80;
    server_name zabbix.example.com;
    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}
certbot --nginx -d zabbix.example.com

Link the "Zabbix server" host to the VPS agent

Zabbix creates a "Zabbix server" host out of the box, which polls an agent on 127.0.0.1. In Docker, the agent lives in its own container: open Data collection, then Hosts, click "Zabbix server" and replace the Agent interface with the DNS name zabbix-agent, with "Connect to" set to DNS. A minute later, the ZBX indicator turns green and Latest data shows the VPS's CPU, memory and load.

Monitor your other servers

On each server, install the zabbix-agent2 package from your distribution or from the official Zabbix repository, then declare the public IP of your Zabbix VPS as the allowed server. In passive mode, the Zabbix server polls the agent on port 10050: open that port to that IP only.

# /etc/zabbix/zabbix_agent2.conf
Server=203.0.113.10
Hostname=web-01
systemctl restart zabbix-agent2
ufw allow from 203.0.113.10 to any port 10050 proto tcp

In Data collection, then Hosts, create the host web-01 with its IP and the "Linux by Zabbix agent" template. Active mode, where the agent pushes its data to the server's port 10051, requires opening that port on the Zabbix VPS: restrict it to your servers' IPs.

Receive alerts

In Alerts, then Media types, enable and configure email (SMTP server, sender), Telegram or Slack — Zabbix ships ready-made types for dozens of services. Then add the media to your user in User settings, Profile, Media, and enable the "Report problems to Zabbix administrators" action in Alerts, Actions. Test it by stopping a server's agent: a "Zabbix agent is not available" problem should reach you.

Back up and update

All configuration and history live in PostgreSQL. A daily pg_dump backup is enough:

cd /opt/zabbix
docker compose exec -T database pg_dump -U zabbix zabbix | gzip > zabbix-$(date +%F).sql.gz

To update, change the version number of the three Zabbix images in docker-compose.yml, then run docker compose pull && docker compose up -d: the server upgrades the schema on start. Back up the database just before, and read the release notes before moving to a new major branch.

One-click installation on ServOrbit

From the Marketplace in your client area, Zabbix installs on a ServOrbit VPS without writing a line: server, web interface, PostgreSQL and VPS agent are deployed, the "Zabbix server" host is already linked to its agent, the factory password is replaced by a generated one shown in your client area, and the interface is published over HTTPS on your domain or on the VPS's free subdomain.

Monitor your fleet from your VPS

A ServOrbit Ubuntu 24.04 VPS with 2 GB of RAM is enough to start Zabbix. One-click installation from the Marketplace, HTTPS on your domain or on the VPS's free subdomain, administrator password generated for you.