diff --git a/devenv/zabbix52/bootstrap/Dockerfile b/devenv/zabbix52/bootstrap/Dockerfile
new file mode 100644
index 0000000..21b536c
--- /dev/null
+++ b/devenv/zabbix52/bootstrap/Dockerfile
@@ -0,0 +1,18 @@
+FROM python:3
+
+ENV ZBX_API_URL=http://zabbix-web
+ENV ZBX_API_USER="Admin"
+ENV ZBX_API_PASSWORD="zabbix"
+ENV ZBX_CONFIG="zbx_export_hosts_5.xml"
+ENV ZBX_BOOTSTRAP_SCRIPT="bootstrap_config.py"
+
+RUN pip install pyzabbix
+
+WORKDIR /
+
+ADD ./${ZBX_CONFIG} /${ZBX_CONFIG}
+ADD ./bootstrap_config.py /bootstrap_config.py
+# RUN cp ./${ZBX_CONFIG} /${ZBX_CONFIG}
+
+# Run bootstrap_config.py when the container launches
+CMD ["python", "/bootstrap_config.py"]
diff --git a/devenv/zabbix52/bootstrap/bootstrap_config.py b/devenv/zabbix52/bootstrap/bootstrap_config.py
new file mode 100644
index 0000000..b035adb
--- /dev/null
+++ b/devenv/zabbix52/bootstrap/bootstrap_config.py
@@ -0,0 +1,93 @@
+import os
+from time import sleep
+from pyzabbix import ZabbixAPI, ZabbixAPIException
+
+zabbix_url = os.environ['ZBX_API_URL']
+zabbix_user = os.environ['ZBX_API_USER']
+zabbix_password = os.environ['ZBX_API_PASSWORD']
+print(zabbix_url, zabbix_user, zabbix_password)
+
+zapi = ZabbixAPI(zabbix_url, timeout=5)
+
+for i in range(10):
+ print("Trying to connected to Zabbix API %s" % zabbix_url)
+ try:
+ zapi.login(zabbix_user, zabbix_password)
+ print("Connected to Zabbix API Version %s" % zapi.api_version())
+ break
+ except ZabbixAPIException as e:
+ print(e)
+ sleep(10)
+ except:
+ print("Waiting")
+ sleep(10)
+
+
+zapi.timeout = 600
+
+config_path = os.environ['ZBX_CONFIG']
+import_rules = {
+ 'applications': {
+ 'createMissing': True,
+ },
+ 'discoveryRules': {
+ 'createMissing': True,
+ 'updateExisting': True
+ },
+ 'graphs': {
+ 'createMissing': True,
+ 'updateExisting': True
+ },
+ 'groups': {
+ 'createMissing': True
+ },
+ 'hosts': {
+ 'createMissing': True,
+ 'updateExisting': True
+ },
+ 'images': {
+ 'createMissing': True,
+ 'updateExisting': True
+ },
+ 'items': {
+ 'createMissing': True,
+ 'updateExisting': True
+ },
+ 'maps': {
+ 'createMissing': True,
+ 'updateExisting': True
+ },
+# 'screens': {
+# 'createMissing': True,
+# 'updateExisting': True
+# },
+ 'templateLinkage': {
+ 'createMissing': True,
+ },
+ 'templates': {
+ 'createMissing': True,
+ 'updateExisting': True
+ },
+# 'templateScreens': {
+# 'createMissing': True,
+# 'updateExisting': True
+# },
+ 'triggers': {
+ 'createMissing': True,
+ 'updateExisting': True
+ },
+}
+
+print("Importing Zabbix config from %s" % config_path)
+with open(config_path, 'r') as f:
+ config = f.read()
+
+ try:
+ # https://github.com/lukecyca/pyzabbix/issues/62
+ import_result = zapi.confimport("xml", config, import_rules)
+ print(import_result)
+ except ZabbixAPIException as e:
+ print(e)
+
+for h in zapi.host.get(output="extend"):
+ print(h['name'])
diff --git a/devenv/zabbix52/bootstrap/host_template.xml b/devenv/zabbix52/bootstrap/host_template.xml
new file mode 100644
index 0000000..ef96e70
--- /dev/null
+++ b/devenv/zabbix52/bootstrap/host_template.xml
@@ -0,0 +1,63 @@
+
+ backend01
+ backend01
+
+
+ 0
+ -1
+ 2
+
+
+ 1
+ 1
+
+
+
+
+
+
+ Template ZAS Agent
+
+
+
+
+ Backend
+
+
+ Linux servers
+
+
+
+
+ 1
+ 1
+ 0
+ 127.0.0.1
+ zas_backend_01
+ 10050
+ 1
+ if1
+
+
+
+
+
+
+
+ -1
+
+
+
+ env
+ staging
+
+
+ group
+ backend
+
+
+ region
+ EU
+
+
+
diff --git a/devenv/zabbix52/bootstrap/zbx_export_hosts_5.xml b/devenv/zabbix52/bootstrap/zbx_export_hosts_5.xml
new file mode 100644
index 0000000..9ea8804
--- /dev/null
+++ b/devenv/zabbix52/bootstrap/zbx_export_hosts_5.xml
@@ -0,0 +1,407 @@
+
+
+ 5.0
+ 2021-09-10T12:42:13Z
+
+
+ Backend
+
+
+ Database
+
+
+ Frontend
+
+
+ Linux servers
+
+
+ Zabbix servers
+
+
+
+
+ backend01
+ backend01
+
+
+ Template ZAS Agent
+
+
+
+
+ Backend
+
+
+ Linux servers
+
+
+
+
+ NO
+ zas_backend_01
+ if1
+
+
+ DISABLED
+
+
+ backend02
+ backend02
+
+
+ Template ZAS Agent
+
+
+
+
+ Backend
+
+
+ Linux servers
+
+
+
+
+ NO
+ zas_backend_02
+ if1
+
+
+ DISABLED
+
+
+ frontend01
+ frontend01
+
+
+ Template ZAS Agent
+
+
+
+
+ Frontend
+
+
+ Linux servers
+
+
+
+
+ NO
+ zas_frontend_01
+ if1
+
+
+ DISABLED
+
+
+ frontend02
+ frontend02
+
+
+ Template ZAS Agent
+
+
+
+
+ Frontend
+
+
+ Linux servers
+
+
+
+
+ NO
+ zas_frontend_02
+ if1
+
+
+ DISABLED
+
+
+ Zabbix server
+ Zabbix server
+
+
+ Linux by Zabbix agent
+
+
+ Zabbix Server
+
+
+
+
+ Zabbix servers
+
+
+
+
+ if1
+
+
+ DISABLED
+
+
+
+
+ Template ZAS Agent
+ Template ZAS Agent
+
+
+ Template App Zabbix Agent
+
+
+
+
+ Templates
+
+
+
+
+ CPU
+
+
+ Filesystems
+
+
+ General
+
+
+ Memory
+
+
+ Network interfaces
+
+
+ OS
+
+
+ Performance
+
+
+ Processes
+
+
+ Security
+
+
+
+ -
+ Incoming network traffic on eth0
+ net.if.in[eth0]
+ 1d
+ bps
+
+
+ Network interfaces
+
+
+ POST
+
+ -
+ Outgoing network traffic on eth0
+ net.if.out[eth0]
+ 1d
+ bps
+
+
+ Network interfaces
+
+
+ POST
+
+ -
+ Processor load (1 min average per core)
+ system.cpu.load[percpu,avg1]
+ 1d
+ FLOAT
+ The processor load is calculated as system CPU load divided by number of CPU cores.
+
+
+ CPU
+
+
+ Performance
+
+
+ POST
+
+
+ {last(0)}>2
+ Processor load is too high on {HOST.NAME}
+ WARNING
+
+
+
+ -
+ Processor load (15 min average per core)
+ system.cpu.load[percpu,avg15]
+ 1d
+ FLOAT
+ The processor load is calculated as system CPU load divided by number of CPU cores.
+
+
+ CPU
+
+
+ Performance
+
+
+ POST
+
+ -
+ CPU $2 time
+ system.cpu.util[,iowait]
+ 1d
+ FLOAT
+ %
+ Amount of time the CPU has been waiting for I/O to complete.
+
+
+ CPU
+
+
+ Performance
+
+
+ POST
+
+
+ {avg(5m)}>20
+ Disk I/O is overloaded on {HOST.NAME}
+ WARNING
+ OS spends significant time waiting for I/O (input/output) operations. It could be indicator of performance issues with storage system.
+
+
+
+ -
+ CPU $2 time
+ system.cpu.util[,system]
+ 1d
+ FLOAT
+ %
+ The time the CPU has spent running the kernel and its processes.
+
+
+ CPU
+
+
+ Performance
+
+
+ POST
+
+ -
+ CPU $2 time
+ system.cpu.util[,user]
+ 1d
+ FLOAT
+ %
+ The time the CPU has spent running users' processes that are not niced.
+
+
+ CPU
+
+
+ Performance
+
+
+ POST
+
+
+
+
+ Template App Zabbix Agent
+ Template App Zabbix Agent
+
+
+ Templates
+
+
+
+
+ Zabbix agent
+
+
+
+ -
+ Host name of zabbix_agentd running
+ agent.hostname
+ 1h
+ 1w
+ 0
+ CHAR
+
+
+ Zabbix agent
+
+
+ POST
+
+
+ {diff(0)}>0
+ Host name of zabbix_agentd was changed on {HOST.NAME}
+ INFO
+
+
+
+ -
+ Agent ping
+ agent.ping
+ 1w
+ The agent always returns 1 for this item. It could be used in combination with nodata() for availability check.
+
+
+ Zabbix agent
+
+
+
+ Zabbix agent ping status
+
+ POST
+
+
+ {nodata(5m)}=1
+ Zabbix agent on {HOST.NAME} is unreachable for 5 minutes
+ AVERAGE
+
+
+
+ -
+ Version of zabbix_agent(d) running
+ agent.version
+ 1h
+ 1w
+ 0
+ CHAR
+
+
+ Zabbix agent
+
+
+ POST
+
+
+ {diff(0)}>0
+ Version of zabbix_agent(d) was changed on {HOST.NAME}
+ INFO
+
+
+
+
+
+
+
+
+ Zabbix agent ping status
+
+
+ 1
+ Up
+
+
+
+
+
\ No newline at end of file
diff --git a/devenv/zabbix52/docker-compose.yml b/devenv/zabbix52/docker-compose.yml
new file mode 100644
index 0000000..7a6d00e
--- /dev/null
+++ b/devenv/zabbix52/docker-compose.yml
@@ -0,0 +1,126 @@
+version: "3"
+
+services:
+ # Zabbix
+ zabbix-server:
+ image: zabbix/zabbix-server-pgsql:alpine-5.2.1
+ ports:
+ - "10051:10051"
+ depends_on:
+ - database
+ environment:
+ DB_SERVER_HOST: database
+ DB_SERVER_PORT: 5432
+ POSTGRES_USER: zabbix
+ POSTGRES_PASSWORD: zabbix
+ POSTGRES_DB: zabbix
+
+ zabbix-web:
+ image: zabbix/zabbix-web-apache-pgsql:alpine-5.2.1
+ ports:
+ - "8188:8080"
+ - "8189:8443"
+ # - "8188:80"
+ depends_on:
+ - database
+ - zabbix-server
+ environment:
+ ZBX_SERVER_HOST: zabbix-server
+ ZBX_SERVER_PORT: 10051
+ DB_SERVER_HOST: database
+ DB_SERVER_PORT: 5432
+ POSTGRES_USER: zabbix
+ POSTGRES_PASSWORD: zabbix
+ POSTGRES_DB: zabbix
+ ZBX_SESSION_NAME: zbx_sessionid_new
+ volumes:
+ - ./ssl:/etc/ssl/apache2:ro
+
+ database:
+ image: postgres
+ ports:
+ - "15432:5432"
+ environment:
+ POSTGRES_USER: zabbix
+ POSTGRES_PASSWORD: zabbix
+
+ zabbix-agent:
+ image: zabbix/zabbix-agent:alpine-5.2.1
+ environment:
+ ZBX_SERVER_HOST: zabbix-server
+ ZBX_SERVER_PORT: 10051
+
+ zabbix-proxy:
+ image: zabbix/zabbix-proxy-sqlite3:alpine-5.2.1
+ environment:
+ ZBX_PROXYMODE: 0
+ ZBX_HOSTNAME: zabbix-proxy
+ ZBX_SERVER_HOST: zabbix-server
+ ZBX_SERVER_PORT: 10051
+
+ zabbix-agent-proxy:
+ image: zabbix/zabbix-agent:alpine-5.2.1
+ environment:
+ ZBX_SERVER_HOST: zabbix-proxy
+ ZBX_SERVER_PORT: 10051
+
+ #########################################################
+ # Bootstrap config
+ #########################################################
+
+ bootstrap:
+ build:
+ context: ./bootstrap
+ dockerfile: Dockerfile
+ args:
+ ZBX_HOSTS_NUMBER: 10
+ environment:
+ ZBX_API_URL: http://zabbix-web:8080
+ # ZBX_API_URL: http://zabbix-web:80
+ ZBX_API_USER: Admin
+ ZBX_API_PASSWORD: zabbix
+ depends_on:
+ - database
+ - zabbix-server
+ - zabbix-web
+
+ #########################################################
+ # Fake agents
+ #########################################################
+
+ # backend
+ redis_backend:
+ image: redis:alpine
+
+ zas_backend_01:
+ build: ../zas-agent
+ volumes:
+ - ../zas-agent/conf/zas_scenario_backend.cfg:/etc/zas_scenario.cfg
+ environment:
+ REDIS_HOST: redis_backend
+ # restart: always
+
+ zas_backend_02:
+ build: ../zas-agent
+ volumes:
+ - ../zas-agent/conf/zas_scenario_backend.cfg:/etc/zas_scenario.cfg
+ environment:
+ REDIS_HOST: redis_backend
+
+ # frontend
+ redis_frontend:
+ image: redis:alpine
+
+ zas_frontend_01:
+ build: ../zas-agent
+ volumes:
+ - ../zas-agent/conf/zas_scenario_frontend.cfg:/etc/zas_scenario.cfg
+ environment:
+ REDIS_HOST: redis_frontend
+
+ zas_frontend_02:
+ build: ../zas-agent
+ volumes:
+ - ../zas-agent/conf/zas_scenario_frontend.cfg:/etc/zas_scenario.cfg
+ environment:
+ REDIS_HOST: redis_frontend