Áú»¢¶Ä²©

This is the documentation page for an unsupported version of Áú»¢¶Ä²©.
Is this not what you were looking for? Switch to the current version or choose one from the drop-down menu.

5 Installation from containers

Docker

Áú»¢¶Ä²© provides images for each Áú»¢¶Ä²© component as portable and self-sufficient containers to speed up deployment and update procedure.

Áú»¢¶Ä²© components come with MySQL and PostgreSQL database support, Apache2 and Nginx web server support. These images are separated into different images.

Docker base images

Áú»¢¶Ä²© components are provided on Ubuntu and Alpine Linux base images:

Image Version
latest
trusty

All images are configured to rebuild latest images if base images are updated.

Docker file sources

Everyone can follow Docker file changes using the Áú»¢¶Ä²© on . You can fork the project or make your own images based on official Docker files.

Structure

All Áú»¢¶Ä²© components are available in the following Docker repositories:

  • Áú»¢¶Ä²© agent -
  • Áú»¢¶Ä²© server
    • Áú»¢¶Ä²© server with MySQL database support -
    • Áú»¢¶Ä²© server with PostgreSQL database support -
  • Áú»¢¶Ä²© web-interface
    • Áú»¢¶Ä²© web-interface based on Apache2 web server with MySQL database support -
    • Áú»¢¶Ä²© web-interface based on Nginx web server with MySQL database support -
    • Áú»¢¶Ä²© web-interface based on Nginx web server with PostgreSQL database support -
  • Áú»¢¶Ä²© proxy
    • Áú»¢¶Ä²© proxy with SQLite3 database support -
    • Áú»¢¶Ä²© proxy with MySQL database support -
  • Áú»¢¶Ä²© Java Gateway -

Additionally there is SNMP trap support. It is provided as additional repository () based on Ubuntu Trusty only. It could be linked with Áú»¢¶Ä²© server and Áú»¢¶Ä²© proxy.

Versions

Each repository of Áú»¢¶Ä²© components contains the following tags:

  • latest - latest stable version of a Áú»¢¶Ä²© component based on Alpine Linux image
  • alpine-latest - latest stable version of a Áú»¢¶Ä²© component based on Alpine Linux image
  • ubuntu-latest - latest stable version of a Áú»¢¶Ä²© component based on Ubuntu image
  • alpine-3.2-latest - latest minor version of a Áú»¢¶Ä²© 3.2 component based on Alpine Linux image
  • ubuntu-3.2-latest - latest minor version of a Áú»¢¶Ä²© 3.2 component based on Ubuntu image
  • alpine-3.2.* - different minor versions of a Áú»¢¶Ä²© 3.2 component based on Alpine Linux image, where * is the minor version of Áú»¢¶Ä²© component
  • ubuntu-3.2.* - different minor versions of a Áú»¢¶Ä²© 3.2 component based on Ubuntu image, where * is the minor version of Áú»¢¶Ä²© component

Usage

Environment variables

All Áú»¢¶Ä²© component images provide environment variables to control configuration. These environment variables are listed in each component repository. These environment variables are options from Áú»¢¶Ä²© configuration files, but with different naming method. For example, ZBX_LOGSLOWQUERIES is equal to LogSlowQueries from Áú»¢¶Ä²© server and Áú»¢¶Ä²© proxy configuration files.

Some of configuration options are not allowed to change. For example, PIDFile and LogType.

Some of components have specific environment variables, which do not exist in official Áú»¢¶Ä²© configuration files:

Variable Components Description
DB_SERVER_HOST Server
Proxy
Web interface
This variable is IP or DNS name of MySQL or PostgreSQL server.
By default, value is mysql-server or postgres-server for MySQL or PostgreSQL respectively
DB_SERVER_PORT Server
Proxy
Web interface
This variable is port of MySQL or PostgreSQL server.
By default, value is '3306' or '5432' respectively.
MYSQL_USER Server
Proxy
Web-interface
MySQL database user.
By default, value is 'zabbix'.
MYSQL_PASSWORD Server
Proxy
Web interface
MySQL database password.
By default, value is 'zabbix'.
MYSQL_DATABASE Server
Proxy
Web interface
Áú»¢¶Ä²© database name.
By default, value is 'zabbix' for Áú»¢¶Ä²© server and 'zabbix_proxy' for Áú»¢¶Ä²© proxy.
POSTGRES_USER Server
Web interface
PostgreSQL database user.
By default, value is 'zabbix'.
POSTGRES_PASSWORD Server
Web interface
PostgreSQL database password.
By default, value is 'zabbix'.
POSTGRES_DB Server
Web interface
Áú»¢¶Ä²© database name.
By default, value is 'zabbix' for Áú»¢¶Ä²© server and 'zabbix_proxy' for Áú»¢¶Ä²© proxy.
PHP_TZ Web-interface Timezone in PHP format. Full list of supported timezones are available on .
By default, value is 'Europe/Riga'.
ZBX_SERVER_NAME Web interface Visible Áú»¢¶Ä²© installation name in right top corner of the web interface.
By default, value is 'Áú»¢¶Ä²© Docker'
ZBX_JAVAGATEWAY_ENABLE Server
Proxy
Enables communication with Áú»¢¶Ä²© Java gateway to collect Java related checks.
By default, value is "false"
ZBX_ENABLE_SNMP_TRAPS Server
Proxy
Enables SNMP trap feature. It requires zabbix-snmptraps instance and shared volume /var/lib/zabbix/snmptraps to Áú»¢¶Ä²© server or Áú»¢¶Ä²© proxy.
Volumes

The images allow to use some mount points. These mount points are different and depend on Áú»¢¶Ä²© component type:

Volume Description
Áú»¢¶Ä²© agent
/etc/zabbix/zabbix_agentd.d The volume allows to include *.conf files and extend Áú»¢¶Ä²© agent using the UserParameter feature
/var/lib/zabbix/modules The volume allows to load additional modules and extend Áú»¢¶Ä²© agent using the LoadModule feature
/var/lib/zabbix/enc The volume is used to store TLS-related files. These file names are specified using ZBX_TLSCAFILE, ZBX_TLSCRLFILE, ZBX_TLSKEY_FILE and ZBX_TLSPSKFILE environment variables
Áú»¢¶Ä²© server
/usr/lib/zabbix/alertscripts The volume is used for custom alert scripts. It is the AlertScriptsPath parameter in zabbix_server.conf
/usr/lib/zabbix/externalscripts The volume is used by external checks. It is the ExternalScripts parameter in zabbix_server.conf
/var/lib/zabbix/modules The volume allows to load additional modules and extend Áú»¢¶Ä²© server using the LoadModule feature
/var/lib/zabbix/enc The volume is used to store TLS related files. These file names are specified using ZBX_TLSCAFILE, ZBX_TLSCRLFILE, ZBX_TLSKEY_FILE and ZBX_TLSPSKFILE environment variables
/var/lib/zabbix/ssl/certs The volume is used as location of SSL client certificate files for client authentication. It is the SSLCertLocation parameter in zabbix_server.conf
/var/lib/zabbix/ssl/keys The volume is used as location of SSL private key files for client authentication. It is the SSLKeyLocation parameter in zabbix_server.conf
/var/lib/zabbix/ssl/ssl_ca The volume is used as location of certificate authority (CA) files for SSL server certificate verification. It is the SSLCALocation parameter in zabbix_server.conf
/var/lib/zabbix/snmptraps The volume is used as location of snmptraps.log file. It could be shared by zabbix-snmptraps container and inherited using the volumes_from Docker option while creating a new instance of Áú»¢¶Ä²© server. SNMP trap processing feature could be enabled by using shared volume and switching the ZBX_ENABLE_SNMP_TRAPS environment variable to 'true'
/var/lib/zabbix/mibs The volume allows to add new MIB files. It does not support subdirectories, all MIBs must be placed in /var/lib/zabbix/mibs
Áú»¢¶Ä²© proxy
/usr/lib/zabbix/externalscripts The volume is used by external checks. It is the ExternalScripts parameter in zabbix_proxy.conf
/var/lib/zabbix/modules The volume allows to load additional modules and extend Áú»¢¶Ä²© server using the LoadModule feature
/var/lib/zabbix/enc The volume is used to store TLS related files. These file names are specified using ZBX_TLSCAFILE, ZBX_TLSCRLFILE, ZBX_TLSKEY_FILE and ZBX_TLSPSKFILE environment variables
/var/lib/zabbix/ssl/certs The volume is used as location of SSL client certificate files for client authentication. It is the SSLCertLocation parameter in zabbix_proxy.conf
/var/lib/zabbix/ssl/keys The volume is used as location of SSL private key files for client authentication. It is the SSLKeyLocation parameter in zabbix_proxy.conf
/var/lib/zabbix/ssl/ssl_ca The volume is used as location of certificate authority (CA) files for SSL server certificate verification. It is the SSLCALocation parameter in zabbix_proxy.conf
/var/lib/zabbix/snmptraps The volume is used as location of snmptraps.log file. It could be shared by the zabbix-snmptraps container and inherited using the volumes_from Docker option while creating a new instance of Áú»¢¶Ä²© server. SNMP trap processing feature could be enabled by using shared volume and switching the ZBX_ENABLE_SNMP_TRAPS environment variable to 'true'
/var/lib/zabbix/mibs The volume allows to add new MIB files. It does not support subdirectories, all MIBs must be placed in /var/lib/zabbix/mibs
Áú»¢¶Ä²© web interface based on Apache2 web server
/etc/ssl/apache2 The volume allows to enable HTTPS for Áú»¢¶Ä²© web interface. The volume must contain the two ssl.crt and ssl.key files prepared for Apache2 SSL connections
Áú»¢¶Ä²© web interface based on Nginx web server
/etc/ssl/nginx The volume allows to enable HTTPS for Áú»¢¶Ä²© web interface. The volume must contain the two ssl.crt, ssl.key files and dhparam.pem prepared for Nginx SSL connections
Áú»¢¶Ä²© snmptraps
/var/lib/zabbix/snmptraps The volume contains the snmptraps.log log file named with received SNMP traps
/var/lib/zabbix/mibs The volume allows to add new MIB files. It does not support subdirectories, all MIBs must be placed in /var/lib/zabbix/mibs

For additional information use Áú»¢¶Ä²© official repositories in Docker Hub.

Usage examples

** Example 1 **

The example demonstrates how to run Áú»¢¶Ä²© server with MySQL database support, Áú»¢¶Ä²© web interface based on the Nginx web server and Áú»¢¶Ä²© Java gateway.

1. Start empty MySQL server instance

# docker run --name mysql-server -t \
             -e MYSQL_DATABASE="zabbix" \
             -e MYSQL_USER="zabbix" \
             -e MYSQL_PASSWORD="zabbix_pwd" \
             -e MYSQL_ROOT_PASSWORD="root_pwd" \
             -d mysql:5.7 \
             --character-set-server=utf8 --collation-server=utf8_bin

2. Start Áú»¢¶Ä²© Java gateway instance

# docker run --name zabbix-java-gateway -t \
             -d zabbix/zabbix-java-gateway:latest

3. Start Áú»¢¶Ä²© server instance and link the instance with created MySQL server instance

# docker run --name zabbix-server-mysql -t \
             -e DB_SERVER_HOST="mysql-server" \
             -e MYSQL_DATABASE="zabbix" \
             -e MYSQL_USER="zabbix" \
             -e MYSQL_PASSWORD="zabbix_pwd" \
             -e MYSQL_ROOT_PASSWORD="root_pwd" \
             -e ZBX_JAVAGATEWAY="zabbix-java-gateway" \
             --link mysql-server:mysql \
             --link zabbix-java-gateway:zabbix-java-gateway \
             -p 10051:10051 \
             -d zabbix/zabbix-server-mysql:latest

Áú»¢¶Ä²© server instance exposes 10051/TCP port (Áú»¢¶Ä²© trapper) to host machine.

4. Start Áú»¢¶Ä²© web interface and link the instance with created MySQL server and Áú»¢¶Ä²© server instances

# docker run --name zabbix-web-nginx-mysql -t \
             -e DB_SERVER_HOST="mysql-server" \
             -e MYSQL_DATABASE="zabbix" \
             -e MYSQL_USER="zabbix" \
             -e MYSQL_PASSWORD="zabbix_pwd" \
             -e MYSQL_ROOT_PASSWORD="root_pwd" \
             --link mysql-server:mysql \
             --link zabbix-server-mysql:zabbix-server \
             -p 80:80 \
             -d zabbix/zabbix-web-nginx-mysql:latest

Áú»¢¶Ä²© web interface instance exposes 80/TCP port (HTTP) to host machine.

** Example 2 **

The example demonstrates how to run Áú»¢¶Ä²© server with PostgreSQL database support, Áú»¢¶Ä²© web interface based on the Nginx web server and SNMP trap feature.

1. Start empty PostgreSQL server instance

# docker run --name postgres-server -t \
             -e POSTGRES_USER="zabbix" \
             -e POSTGRES_PASSWORD="zabbix" \
             -e POSTGRES_DB="zabbix_pwd" \
             -d postgres:latest

2. Start Áú»¢¶Ä²© snmptraps instance

# docker run --name zabbix-snmptraps -t \
             -v /zbx_instance/snmptraps:/var/lib/zabbix/snmptraps:rw \
             -v /var/lib/zabbix/mibs:/usr/share/snmp/mibs:ro \
             -p 162:162/udp \
             -d zabbix/zabbix-snmptraps:latest

Áú»¢¶Ä²© snmptrap instance exposes the 162/UDP port (SNMP traps) to host machine.

3. Start Áú»¢¶Ä²© server instance and link the instance with created PostgreSQL server instance

# docker run --name zabbix-server-pgsql -t \
             -e DB_SERVER_HOST="postgres-server" \
             -e POSTGRES_USER="zabbix" \
             -e POSTGRES_PASSWORD="zabbix" \
             -e POSTGRES_DB="zabbix_pwd" \
             -e ZBX_ENABLE_SNMP_TRAPS="true" \
             --link postgres-server:postgres \
             -p 10051:10051 \
             --volumes-from zabbix-snmptraps \
             -d zabbix/zabbix-server-pgsql:latest

Áú»¢¶Ä²© server instance exposes the 10051/TCP port (Áú»¢¶Ä²© trapper) to host machine.

4. Start Áú»¢¶Ä²© web interface and link the instance with created PostgreSQL server and Áú»¢¶Ä²© server instances

# docker run --name zabbix-web-nginx-pgsql -t \
             -e DB_SERVER_HOST="postgres-server" \
             -e POSTGRES_USER="zabbix" \
             -e POSTGRES_PASSWORD="zabbix" \
             -e POSTGRES_DB="zabbix_pwd" \
             --link postgres-server:postgres \
             --link zabbix-server-pgsql:zabbix-server \
             -p 443:443 \
             -v /etc/ssl/nginx:/etc/ssl/nginx:ro \
             -d zabbix/zabbix-web-nginx-pgsql:latest

Áú»¢¶Ä²© web interface instance exposes the 443/TCP port (HTTPS) to host machine.
Directory /etc/ssl/nginx must contain certificate with required name.

Docker Compose

Áú»¢¶Ä²© provides compose files also for defining and running multi-container Áú»¢¶Ä²© components in Docker. These compose files are available in Áú»¢¶Ä²© docker official repository on github.com: . These compose files are added as examples, they are overloaded. For example, they contain proxies with MySQL and SQLite3 support.

There are a few different versions of compose files:

File name Description
docker-compose_v2_alpine_mysql_latest.yaml The compose file runs the latest version of Áú»¢¶Ä²© 3.2 components on Alpine Linux with MySQL database support.
docker-compose_v2_alpine_mysql_local.yaml The compose file locally builds the latest version of Áú»¢¶Ä²© 3.2 and runs Áú»¢¶Ä²© components on Alpine Linux with MySQL database support.
docker-compose_v2_alpine_pgsql_latest.yaml The compose file runs the latest version of Áú»¢¶Ä²© 3.2 components on Alpine Linux with PostgreSQL database support.
docker-compose_v2_alpine_pgsql_local.yaml The compose file locally builds the latest version of Áú»¢¶Ä²© 3.2 and runs Áú»¢¶Ä²© components on Alpine Linux with PostgreSQL database support.
docker-compose_v2_ubuntu_mysql_latest.yaml The compose file runs the latest version of Áú»¢¶Ä²© 3.2 components on Ubuntu 14.04 with MySQL database support.
docker-compose_v2_ubuntu_mysql_local.yaml The compose file locally builds the latest version of Áú»¢¶Ä²© 3.2 and runs Áú»¢¶Ä²© components on Ubuntu 14.04 with MySQL database support.
docker-compose_v2_ubuntu_pgsql_latest.yaml The compose file runs the latest version of Áú»¢¶Ä²© 3.2 components on Ubuntu 14.04 with PostgreSQL database support.
docker-compose_v2_ubuntu_pgsql_local.yaml The compose file locally builds the latest version of Áú»¢¶Ä²© 3.2 and runs Áú»¢¶Ä²© components on Ubuntu 14.04 with PostgreSQL database support.

Available Docker compose files support only version 2 of Docker Compose.

Storage

Compose files are configured to support local storage on a host machine. Docker Compose will create a zbx_env directory in the folder with the compose file when you run Áú»¢¶Ä²© components using the compose file. The directory will contain the same structure as described above in the Volumes section and directory for database storage.

There are also volumes in read-only mode for /etc/localtime and /etc/timezone files.

Environment files

In the same directory with compose files on github.com you can find files with default environment variables for each component in compose file. These environment files are named like .env_<type of component>.

Examples

** Example 1 **

# docker-compose -f ./docker-compose_v2_alpine_mysql_latest.yaml up -d

The command will download latest Áú»¢¶Ä²© 3.2 images for each Áú»¢¶Ä²© component and run them in detach mode.

Do not forget to download .env_<type of component> files from github.com official Áú»¢¶Ä²© repository with compose files.

** Example 2 **

# docker-compose -f ./docker-compose_v2_ubuntu_mysql_local.yaml up -d

The command will download base image Ubuntu 14.04, then build Áú»¢¶Ä²© 3.2 components locally and run them in detach mode.