Public | Automated Build

Last pushed: a year ago
Short Description
Dockerized Zabbix 2.4 - server, web UI - deprecated, please use monitoringartist/zabbix-3.0-xxl
Full Description

Zabbix XXL

Zabbix XXL is a standard Zabbix prepared for Docker world. You must install Zabbix package (rpm, deb, ...) in the old world. Similarly you need to pull Zabbix Docker image in the Docker world. This Docker image contains standard Zabbix + additional XXL (community) extensions. Routine tasks such as import of Zabbix DB are automated, so it's prepared for easy deployment.

If you like or use this project, please provide feedback to author - Star it ★.

Overview of Monitoring Artist (dockerized) monitoring ecosystem:

zabbix-2.4

Zabbix 2.4 is not supported - please use 3.0 version - http://www.zabbix.com/life_cycle_and_release_policy.php

Compiled Zabbix with almost all features (MySQL support, Java, SNMP,
Curl, Ipmi, fping) and Zabbix web UI based on CentOS 7, Supervisor, Nginx, PHP.
Image requires external MySQL database (you can run MySQL also as Docker
container).

Standard Dockerized Zabbix deployment

# create /var/lib/mysql as persistent volume storage
docker run -d -v /var/lib/mysql --name zabbix-db-storage busybox:latest

# start DB for Zabbix - default 1GB innodb_buffer_pool_size is used
docker run \
    -d \
    --name zabbix-db \
    -v /backups:/backups \
    -v /etc/localtime:/etc/localtime:ro \
    --volumes-from zabbix-db-storage \
    --env="MARIADB_USER=zabbix" \
    --env="MARIADB_PASS=my_password" \
    monitoringartist/zabbix-db-mariadb

# start Zabbix linked to started DB
docker run \
    -d \
    --name zabbix \
    -p 80:80 \
    -p 10051:10051 \
    -v /etc/localtime:/etc/localtime:ro \
    --link zabbix-db:zabbix.db \
    --env="ZS_DBHost=zabbix.db" \
    --env="ZS_DBUser=zabbix" \
    --env="ZS_DBPassword=my_password" \
    monitoringartist/zabbix-2.4
# wait ~60 seconds for Zabbix initialization
# Zabbix web UI will be available on the port 80, Zabbix server on the port 10051

Examples of admin tasks:

# Backup of Zabbix configuration data only
docker exec \
    -ti zabbix-db \
    /zabbix-backup/zabbix-mariadb-dump -u zabbix -p my_password -o /backups

# Full DB backup of Zabbix
docker exec \
    -ti zabbix-db \
    bash -c "\
    mysqldump -u zabbix -pmy_password zabbix | \
    bzip2 -cq9 > /backups/zabbix_db_dump_$(date +%Y-%m-%d-%H.%M.%S).sql.bz2"

Up and Running with Docker Compose

docker-compose up -d

Zabbix database as Docker container

To be able to connect to database we would need one to be running first.
Easiest way to do that is to use another docker image. For this purpose you
can use monitoringartist/zabbix-db-mariadb image as database.

For more information about monitoringartist/zabbix-db-mariadb see
README of zabbix-db-mariadb.

Example:

docker run \
    -d \
    --name zabbix-db \
    -p 3306:3306 \
    -v /etc/localtime:/etc/localtime:ro \
    --env="MARIADB_USER=zabbix" \
    --env="MARIADB_PASS=my_password" \
    monitoringartist/zabbix-db-mariadb

Remember to use the same credentials when deploying zabbix image.

Environmental variables

You can use environmental variables to config Zabbix server and Zabbix web UI (PHP). Available
variables:

Variable Default value
PHP_date_timezone UTC
PHP_max_execution_time 300
PHP_max_input_time 300
PHP_memory_limit 128M
PHP_error_reporting E_ALL
ZS_ListenPort 10051
ZS_SourceIP
ZS_LogFile /tmp/zabbix_server.log
ZS_LogFileSize 10
ZS_DebugLevel 3
ZS_PidFile /var/run/zabbix_server.pid
ZS_DBHost zabbix.db
ZS_DBName zabbix
ZS_DBSchema
ZS_DBUser zabbix
ZS_DBPassword zabbix
ZS_DBSocket /tmp/mysql.sock
ZS_DBPort 3306
ZS_StartPollers 5
ZS_StartPollersUnreachable 1
ZS_StartTrappers 5
ZS_StartPingers 1
ZS_StartDiscoverers 1
ZS_StartHTTPPollers 1
ZS_StartTimers 1
ZS_JavaGateway 127.0.0.1
ZS_JavaGatewayPort 10052
ZS_StartJavaPollers 0
ZS_StartVMwareCollectors 0
ZS_VMwareFrequency 60
ZS_VMwarePerfFrequency 60
ZS_VMwareCacheSize 8M
ZS_VMwareTimeout 10
ZS_SNMPTrapperFile /tmp/zabbix_traps.tmp
ZS_StartSNMPTrapper 0
ZS_ListenIP 0.0.0.0
ZS_HousekeepingFrequency 1
ZS_MaxHousekeeperDelete 500
ZS_SenderFrequency 30
ZS_CacheSize 8M
ZS_CacheUpdateFrequency 60
ZS_StartDBSyncers 4
ZS_HistoryCacheSize 8M
ZS_TrendCacheSize 4M
ZS_HistoryTextCacheSize 16M
ZS_ValueCacheSize 8M
ZS_Timeout 3
ZS_TrapperTimeout 300
ZS_UnreachablePeriod 45
ZS_UnavailableDelay 60
ZS_UnreachableDelay 15
ZS_AlertScriptsPath /usr/local/share/zabbix/alertscripts
ZS_ExternalScripts /usr/local/share/zabbix/externalscripts
ZS_FpingLocation /usr/sbin/fping
ZS_Fping6Location /usr/sbin/fping6
ZS_SSHKeyLocation
ZS_LogSlowQueries 0
ZS_TmpDir /tmp
ZS_StartProxyPollers 1
ZS_ProxyConfigFrequency 3600
ZS_ProxyDataFrequency 1
ZS_AllowRoot 0
ZS_User zabbix
ZS_Include
ZS_SSLCertLocation /usr/local/share/zabbix/ssl/certs
ZS_SSLKeyLocation /usr/local/share/zabbix/ssl/keys
ZS_SSLCALocation
ZS_LoadModulePath /usr/lib/zabbix/modules
ZS_LoadModule
ZW_ZBX_SERVER localhost
ZW_ZBX_SERVER_PORT 10051
ZW_ZBX_SERVER_NAME Zabbix Server

Configuration from volume

Full config files can be also used. Environment configs will be overriden by
values from config files in this case. You need only to add /etc/custom-config/
volume:

-v /host/custom-config/:/etc/custom-config/

Available files:

File Description
php-zabbix.ini PHP configuration file
zabbix_server.conf Zabbix server configuration file

Zabbix role environment variables:

Variable Default value Description
ZS_enabled true Zabbix Server enablement, DB operations will be enabled as well
ZA_enabled true Zabbix Agent enablement, DB operations will be enabled as well
ZW_enabled true Zabbix Web UI enablement, DB operations will be enabled as well
SNMPTRAP_enabled false SNMP trap process (port 162) enablement

All Zabbix components are enabled by default except SNMP traps proccessing. However users
want to run dedicated Zabbix component per container. Typical use case is Zabbix
web UI. Thanks to role environment variables are users able to execute many web
UI containers, which helps to scale Zabbix as a service.

Zabbix deployment

Now when we have Zabbix database running we can deploy Zabbix image with
appropriate environmental variables set.

Example:

docker run \
    -d \
    --name zabbix \
    -p 80:80 \
    -p 10051:10051 \
    -v /etc/localtime:/etc/localtime:ro \
    --link zabbix-db:zabbix.db \
    --env="ZS_DBHost=zabbix.db" \
    --env="ZS_DBUser=zabbix" \
    --env="ZS_DBPassword=my_password" \
    monitoringartist/zabbix-2.4

Access to Zabbix web interface

To log in into Zabbix web interface for the first time use credentials
Admin:zabbix.

Access web interface under http://docker_host_ip

Docker troubleshooting

Use docker command to see if all required containers are up and running:

$ docker ps

Check logs of Zabbix container:

$ docker logs zabbix

Sometimes you might just want to review how things are deployed inside a running
container, you can do this by executing a bash shell through docker's
exec
command:

docker exec -ti zabbix /bin/bash

History of an image and size of layers:

docker history --no-trunc=true monitoringartist/zabbix-2.4 | tr -s ' ' | tail -n+2 | awk -F " ago " '{print $2}'

Run specific Zabbix version, e.g. 2.4.4 - just specify 2.4.4 tag for image:

    docker run \
        -d \
        --name zabbix \
        -p 80:80 \
        -p 10051:10051 \
        -v /etc/localtime:/etc/localtime:ro \
        --link zabbix-db:zabbix.db \
        --env="ZS_DBHost=zabbix.db" \
        --env="ZS_DBUser=zabbix" \
        --env="ZS_DBPassword=my_password" \
        monitoringartist/zabbix-2.4:2.4.4

Author

Devops Monitoring Expert,
who loves monitoring systems, which start with letter Z. Those are Zabbix and Zenoss.

Professional devops / monitoring services:

[]
(http://www.monitoringartist.com 'DevOps / Docker / Kubernetes / AWS ECS / Zabbix / Zenoss / Terraform / Monitoring')

Docker Pull Command
Owner
monitoringartist
Source Repository

Comments (0)