


[{"content":"Hello,\nThe idea behind this site is to bring together projects, notes, experiences, and knowledge I\u0026rsquo;ve gathered throughout my journey in technology. I mainly write about computer networking, infrastructure, Linux, security, monitoring, and other topics related to computing.\nHere you\u0026rsquo;ll find tutorials, configurations, solutions to problems I\u0026rsquo;ve encountered, experiments, and personal projects. Some posts will be more detailed, while others will simply be notes about something I found interesting and wanted to document.\nBesides the articles, you can explore some of my projects on GitHub and follow my work on LinkedIn. You\u0026rsquo;ll find links to both here on the site.\nFeel free to explore, and I hope you find something useful along the way. See you around!\n","date":"2 December 2026","externalUrl":null,"permalink":"/en/","section":"","summary":"","title":"","type":"page"},{"content":"","date":"2 December 2026","externalUrl":null,"permalink":"/en/categories/","section":"Categories","summary":"","title":"Categories","type":"categories"},{"content":"L2L (LAN-to-LAN) services provide a way to transport native Ethernet frames across routed IP infrastructures, allowing devices at remote locations to share the same broadcast domain and network services (such as DHCP, ARP, and VLANs) as if they were physically connected to the same switch.\nFor internet service providers, interconnecting networks across different sites is an important service for enterprise customers that need to keep their networks connected at Layer 2. One way to provide this type of service is through Ethernet over MPLS circuits, such as VPWS and VPLS, where the provider is responsible for transporting frames between sites.\nEoIP offers another option for this scenario. For an ISP, it makes it possible to establish Ethernet tunnels over its existing IP/MPLS infrastructure without having to provision an MPLS L2VPN for each connection. For companies looking to build their own interconnection infrastructure, it allows them to set up a concentrator and connect remote sites through different internet connections, including connections from different providers. This way, the company retains control over communication between its sites without relying exclusively on a Layer 2 service provided by a single carrier.\nIn this article, we will build an L2L concentrator using MikroTik and EoIP. By the end, we will have a Layer 2 network connecting all locations through EoIP tunnels.\nSolution Architecture # For this scenario, we use a Hub-and-Spoke topology consisting of a central concentrator (Hub) and two remote locations (Spokes), represented by the Terra and Mar branch offices.\nTopology with a concentrator and two branch offices The branch offices connect to the internet through PPPoE connections and receive public IP addresses that allow them to communicate with the headquarters. In an ISP environment, however, public addresses are not required if all endpoints are within the provider\u0026rsquo;s infrastructure. If part of the customer\u0026rsquo;s network is hosted by another provider, reachable addresses between the tunnel endpoints are necessary, since EoIP uses GRE and does not work particularly well with NAT.\nAt the headquarters, local network devices are connected to a switch, which also connects the MATRIZ-SRV-01 server. At the branch offices, computers are distributed across two VLANs (10 and 20), representing separate segments of the local network.\nConfiguring EoIP # EoIP (Ethernet over IP) is a proprietary MikroTik protocol that transports Ethernet frames between two routers over an IP network. It uses GRE encapsulation, defined in RFCs 1701 and 1702, and updated by RFCs 2890 and 2784. This allows RouterOS to create a virtual Ethernet interface and extend a Layer 2 domain between separate locations.\nWhen this interface is added to a bridge, the router forwards Ethernet frames through the tunnel, including broadcasts, multicast traffic, and protocols such as ARP. As a result, the networks connected at both ends can share the same broadcast domain. Each tunnel is identified by a tunnel-id, which must match on both routers.\nInfo Since EoIP uses GRE (IP Protocol 47) to encapsulate Ethernet frames, this protocol must be allowed in the router\u0026rsquo;s firewall for the tunnels to be established.\nExample rule allowing GRE connections from the addresses listed in ip-filiais:\n/ip firewall filter add chain=input action=accept protocol=gre \\ src-address-list=ip-filiais Although EoIP can operate over any infrastructure that provides IP connectivity between the endpoints, it does not provide encryption of its own. To protect traffic transported over public networks, it can be combined with IPsec, which is covered in the Protecting EoIP Tunnels with IPsec section.\nWarning EoIP is a MikroTik proprietary protocol and does not have a cross-vendor interoperability standard. Although third-party implementations exist, compatibility with equipment from other vendors is not guaranteed.\nConfiguration is straightforward: simply specify the remote endpoint address and a tunnel ID. Although optional, I also recommend specifying the source IP address to avoid errors, especially when using loopback addresses.\nTunnel configuration on the concentrator:\n/interface eoip add local-address=203.0.113.1 name=eoip-tunnel-filial-mar \\ remote-address=198.51.100.1 tunnel-id=2 add local-address=203.0.113.1 name=eoip-tunnel-filial-terra \\ remote-address=192.0.2.1 tunnel-id=1 Important To prevent connectivity issues in TCP applications caused by a reduced path MTU, TCP MSS Clamping should remain enabled. This mechanism adjusts the MSS advertised during TCP connection establishment (SYN packets), causing devices to use smaller segments that fit within the effective path MTU.\nThis is particularly important in scenarios where EoIP is combined with IPsec, since the additional overhead can significantly reduce the maximum size of transported packets.\nKeep in mind that MSS clamping applies exclusively to TCP connections and does not solve MTU issues for protocols such as UDP and ICMP.\nThe configuration on the branch routers is identical; only the IP addresses change:\n/interface eoip add local-address=192.0.2.1 mac-address=FE:11:34:40:37:0C name=\\ eoip-tunnel-matriz remote-address=203.0.113.1 tunnel-id=1 Warning When using EoIP, MTU requires careful consideration because of the substantial protocol overhead. We add 20 bytes for the outer IP header, 8 bytes for GRE, and another 14 bytes for the encapsulated Ethernet frame (18 bytes when VLAN tags are used). This results in 42 bytes of overhead, or 46 bytes with VLANs. If the connection uses PPPoE, another 8 bytes must be accounted for. With a 1500-byte MTU, the tunnel MTU would therefore be 1458 bytes in the first case. With VLANs and PPPoE, it would be 1446 bytes. When IPsec is used, the available MTU is reduced even further and may fall below 1390 bytes.\nNote Another important point is that the bridge MTU is not automatically constrained by the EoIP interface MTU. The bridge uses the l2mtu parameter to determine the maximum size of Ethernet frames it can forward. By default, the EoIP tunnel has l2mtu=65535, allowing frames larger than the tunnel\u0026rsquo;s effective MTU to reach it. In this scenario, with dont-fragment=no (the default), the outer IP packet may be fragmented to traverse the underlay network. Therefore, it is important to consider the MTU across the entire transport path, not just the MTU configured on the bridge or EoIP interface. Fragmentation should be avoided whenever possible, especially when transporting maximum-sized frames or jumbo frames.\nTo examine the encapsulation in practice, below is a packet capture taken while the EoIP tunnel was operating. It shows the outer IP header, GRE encapsulation, and the transported Ethernet frame.\nEoIP packet captured in Wireshark I am also providing the original capture in PCAPNG format, so you can reproduce the analysis and inspect the packet fields directly in Wireshark.\nProtecting EoIP Tunnels with IPsec # As mentioned earlier, EoIP does not include its own encryption mechanisms. To protect the traffic carried by the tunnel, RouterOS allows IPsec to be integrated directly into the EoIP interface through the ipsec-secret parameter, which uses a pre-shared key (PSK).\nWhen this key is configured at both ends, RouterOS automatically creates a dynamic IPsec peer and policy to protect the communication, eliminating the need to configure these elements manually.\nIPsec configuration on the EoIP interface It is important to note that, on IPv4 EoIP interfaces, IPsec and Fast Path are incompatible. Therefore, Fast Path must be disabled by setting allow-fast-path=no before configuring ipsec-secret. Otherwise, RouterOS will reject the key configuration.\n/interface eoip add local-address=203.0.113.1 name=eoip-tunnel-filial-mar \\ remote-address=198.51.100.1 tunnel-id=2 \\ allow-fast-path=no ipsec-secret=@mikrotik add local-address=203.0.113.1 name= eoip-tunnel-filial-terra \\ remote-address=192.0.2.1 tunnel-id=1 \\ allow-fast-path=no ipsec-secret=@mikrotik Once the configuration has been applied at both ends, EoIP traffic is protected by IPsec using ESP (Encapsulating Security Payload). The capture below shows the ESP protocol carrying data between the routers\u0026rsquo; IP addresses.\nEoIP packet encapsulated by ESP RouterOS also automatically creates the Security Associations (SAs), peers, and policies required for communication, as shown below.\nSecurity Associations generated by IPsec Bridge and VLAN Configuration # With the EoIP tunnels established, the next step is to add them to a bridge so Ethernet frames can be forwarded between locations.\nOn the concentrator, we created a bridge named bridge-eoip, which connects the two EoIP tunnels and the physical ether2 interface used to connect to the headquarters\u0026rsquo; local network.\nThe configuration uses VLAN Filtering to control traffic forwarding between bridge ports. VLANs 10, 20, and 99 were defined, allowing these segments to be transported between the branch offices and headquarters without sharing the same broadcast domain.\nVLAN configuration on the bridge Warning In some situations, MSS clamping may not be applied correctly to tagged VLAN traffic, causing TCP connections to become slow or experience interruptions.\nFor the port configuration, frame-types=admit-only-vlan-tagged was used to allow tagged frames only. This makes the EoIP tunnels and physical interface operate as trunk ports, carrying the configured VLANs.\nInterfaces added to the bridge /interface bridge add igmp-snooping=yes name=bridge-eoip priority=0x7000 vlan-filtering=yes /interface bridge port add bridge=bridge-eoip frame-types=admit-only-vlan-tagged interface=\\ eoip-tunnel-filial-terra add bridge=bridge-eoip frame-types=admit-only-vlan-tagged interface=\\ eoip-tunnel-filial-mar add bridge=bridge-eoip frame-types=admit-only-vlan-tagged interface=ether2 /interface bridge vlan add bridge=bridge-eoip tagged=\\ bridge-eoip,eoip-tunnel-filial-mar,eoip-tunnel-filial-terra,ether2 \\ vlan-ids=10,20,99 Info Since EoIP tunnels participate in the same Layer 2 domain, they are susceptible to loops and broadcast storms. When connecting multiple tunnels to the same bridge, keep RSTP enabled to allow loops to be detected and prevented. It is also important to ensure that each EoIP interface has a unique MAC address to avoid problems with address learning on the bridge.\nOn the DHCP server configured on the headquarters router, we can see the devices\u0026rsquo; leases. As shown below, devices at the different locations received IP addresses belonging to their respective networks.\nWhen running ping tests between devices connected at different locations, we can see that the TTL remains at 64 for devices in the same VLAN and at 63 for devices in different VLANs. This difference is caused by forwarding through the gateway when communicating between different networks. Connectivity between devices at the branch offices demonstrates that the VLANs are being transported correctly through the EoIP tunnels.\nFinally, we use traceroute to observe the TTL and the hops traversed by packets on their way to the destination, making it possible to see how gateways forward traffic between remote networks.\nConclusion # This implementation demonstrated how EoIP tunnels can be used to extend Ethernet connectivity between separate locations over an existing IP infrastructure. Using bridges with VLAN Filtering made it possible to transport different network segments while preserving logical traffic separation.\nAlthough EoIP is a simple and flexible option for environments using MikroTik equipment, it has limitations related to scalability, encapsulation overhead, and dependence on the RouterOS ecosystem. In ISP infrastructures that use an MPLS backbone, technologies such as VPLS may be more suitable for providing Layer 2 transport services at a larger scale.\n","date":"2 December 2026","externalUrl":null,"permalink":"/en/posts/networking/mikrotik-eoip-l2l/","section":"Posts","summary":"Learn how to configure EoIP tunnels and bridges to build an L2L concentrator with MikroTik.","title":"Implementing an L2L Concentrator with MikroTik and EoIP","type":"posts"},{"content":"","date":"2 December 2026","externalUrl":null,"permalink":"/en/tags/ipsec/","section":"Tags","summary":"","title":"Ipsec","type":"tags"},{"content":"","date":"2 December 2026","externalUrl":null,"permalink":"/en/tags/l2vpn/","section":"Tags","summary":"","title":"L2vpn","type":"tags"},{"content":"","date":"2 December 2026","externalUrl":null,"permalink":"/en/tags/layer-2/","section":"Tags","summary":"","title":"Layer-2","type":"tags"},{"content":"","date":"2 December 2026","externalUrl":null,"permalink":"/en/tags/mikrotik/","section":"Tags","summary":"","title":"Mikrotik","type":"tags"},{"content":"","date":"2 December 2026","externalUrl":null,"permalink":"/en/categories/networking/","section":"Categories","summary":"","title":"Networking","type":"categories"},{"content":"","date":"2 December 2026","externalUrl":null,"permalink":"/en/posts/","section":"Posts","summary":"","title":"Posts","type":"posts"},{"content":"","date":"2 December 2026","externalUrl":null,"permalink":"/en/tags/","section":"Tags","summary":"","title":"Tags","type":"tags"},{"content":"","date":"2 December 2026","externalUrl":null,"permalink":"/en/tags/tunneling/","section":"Tags","summary":"","title":"Tunneling","type":"tags"},{"content":"","date":"14 September 2026","externalUrl":null,"permalink":"/en/tags/housekeeping/","section":"Tags","summary":"","title":"Housekeeping","type":"tags"},{"content":"","date":"14 September 2026","externalUrl":null,"permalink":"/en/tags/monitoring/","section":"Tags","summary":"","title":"Monitoring","type":"tags"},{"content":"","date":"14 September 2026","externalUrl":null,"permalink":"/en/categories/observability/","section":"Categories","summary":"","title":"Observability","type":"categories"},{"content":"Tuning in Zabbix involves fine-tuning processes, caches, and maintenance mechanisms to adapt the server to the workload of the environment. The goal is to use available resources efficiently, reduce processing bottlenecks, and minimize the load on the database.\nHowever, tuning does not simply mean increasing configuration values. Each change should be based on identifying a bottleneck and accompanied by an analysis of its effects on CPU, memory, storage, and the database. There is no one-size-fits-all configuration: sizing depends on the characteristics and workload of each environment.\nAdjusting the StartPollers parameter in the configuration file Zabbix parameters can be adjusted in the /etc/zabbix/zabbix_server.conf file or, when running in containers, through environment variables. To apply these changes, the Zabbix server must be restarted.\nContainer environment variables If you use Docker to run Zabbix or are interested in this deployment approach, I\u0026rsquo;ve also written a dedicated article covering the deployment and configuration of a containerized Zabbix environment:\nDeploying Zabbix with Docker 20 July 2026\u0026middot;Updated: 15 November 2026\u0026middot;17 mins Observability Zabbix Docker Containers Monitoring In this section, we will explore some of the main components that can be adjusted: collection processes, in-memory caches, and database maintenance mechanisms. In addition to these parameters, it is essential to monitor Zabbix internal metrics to determine when a component is becoming a bottleneck. All the parameters mentioned can be found in the official Zabbix documentation.\nCollection Tuning # Pollers are Zabbix processes responsible for performing different types of checks on hosts. When the number of checks or the time required to process them exceeds the available capacity, processes can become busy, causing items to accumulate delays in the queue.\nThis phenomenon is commonly associated with what is known as poller starvation. Under heavy load, checks may be processed with delays and, in extreme cases, reach their timeout, resulting in data loss, delayed metric updates, and false availability alerts.\nThe number and types of processes used by Zabbix can be adjusted through different parameters.\nStartPollers controls generic polling processes, while recent versions of Zabbix also provide specific parameters for certain types of checks, such as StartSNMPPollers, StartAgentPollers, and StartHTTPAgentPollers.\nStartPollersUnreachable maintains dedicated processes for handling devices considered unreachable. This is important because checks waiting for a timeout can occupy processes for extended periods, preventing the entire pool of pollers from being affected by unavailable devices.\nStartPingers controls the processes responsible for ICMP checks. StartPreprocessors determines the number of processes responsible for preprocessing received values, while StartDiscoverers controls the processes used for network discovery.\nHigh poller utilization leading to poller starvation The fundamental principle is to avoid increasing these parameters indiscriminately. Adding processes may reduce a specific queue, but it also increases CPU and memory consumption, as well as file descriptor usage. Therefore, adjustments should be accompanied by monitoring process utilization and the overall behavior of the server.\nTo reduce the amount of data collection concentrated on the main server, it is also possible to use Zabbix Proxy and active Zabbix Agent checks. Zabbix Proxy allows collection to be distributed across different points in the infrastructure. However, it does not transfer all processing to the proxy: certain operations, such as trigger processing, are still performed by the Zabbix Server.\nWith active checks, the agent initiates communication with the server or proxy and sends the collected values. This reduces the need for pollers on the server for items configured in this way.\nAnother point to consider is the operating system\u0026rsquo;s file descriptor limit. Increasing the number of processes excessively can increase the number of connections and files used by Zabbix. If system limits are not properly configured, a process may reach the file descriptor limit and experience failures.\nFor this reason, increasing the number of pollers should always be an evidence-based decision. The goal is not to have as many processes as possible, but rather a number that matches the actual workload of the environment.\nCache and Memory # To reduce unnecessary database operations and accelerate certain processing stages, Zabbix uses several in-memory caches.\nThe main ones include the configuration cache, which stores configuration information; the value cache, which stores values required for processing certain functions; and caches related to history and trends. Environments using VMware monitoring may also use VMwareCacheSize.\nThe size of these components can be adjusted through parameters such as CacheSize, HistoryCacheSize, HistoryIndexCacheSize, TrendCacheSize, ValueCacheSize, and VMwareCacheSize. However, simply increasing a cache because RAM is available does not necessarily result in better performance. The goal is to size each cache according to its actual usage.\nCache utilization after adjusting the CacheSize value Zabbix provides internal metrics to monitor cache utilization and includes triggers that can indicate excessive usage, such as Excessive configuration cache usage, Excessive history cache usage, and Excessive value cache usage.\nThese alerts should be interpreted as indicators that a particular component may be approaching its capacity, rather than universal thresholds that determine the correct configuration. Adjustments should take into account the environment\u0026rsquo;s behavior, workload growth, and available memory.\nHousekeeper # The housekeeper is the mechanism responsible for removing old data retained by Zabbix according to retention policies. Its operation prevents stored data from growing indefinitely.\nAlthough necessary, the housekeeper can generate significant database load, especially in environments with large volumes of history and trends data. For this reason, its configuration should take into account both the amount of data and the database\u0026rsquo;s capacity.\nHousekeepingFrequency defines how often, in hours, the housekeeping process runs. Increasing the frequency excessively can generate more frequent maintenance operations, while setting it too high may concentrate a larger amount of work into each execution.\nSetting HousekeepingFrequency to 0 disables automatic housekeeping. This configuration requires data maintenance to be handled through other mechanisms, such as specific database routines and partitioning strategies, when applicable.\nAnother important parameter is MaxHousekeeperDelete. This parameter limits the number of records removed per task during a housekeeper execution, particularly in the context of data remaining in the database after items have been deleted.\nThis is especially relevant when an item or prototype has been applied to a large number of hosts. Deleting these objects afterward may leave a very large number of records to be removed. If the limit is not configured appropriately, a single cleanup operation can generate a significant load on the database.\nWhen MaxHousekeeperDelete is set to 0, there is no limit on this quantity. In large environments, this can result in extremely heavy deletion operations. For this reason, the housekeeper should not be analyzed in isolation.\nIn large-scale environments, the retention strategy may also involve table partitioning and database-specific features. In certain architectures, this reduces the dependency on large DELETE operations for data maintenance.\nIt is also important to distinguish between data retention and housekeeping: the former defines how long data should be kept, while the latter represents the mechanism used by Zabbix to perform certain cleanup tasks.\nTo understand the details of how this works, it is worth consulting the official documentation on the housekeeping procedure.\nFinal Considerations # Keeping Zabbix stable and ready to scale requires a balance between collection processes, caches, memory, storage, and the database.\nIncreasing an individual parameter may solve a specific bottleneck, but it can also shift the workload to another component. Increasing pollers may raise CPU and file descriptor consumption; increasing caches requires more memory; and housekeeping operations may increase database I/O and processing load.\nFor this reason, tuning should be guided by metrics and evidence, rather than by values considered universally ideal.\nBy continuously monitoring process utilization, caches, and database performance, and making adjustments according to the actual needs of the infrastructure, it is possible to reduce bottlenecks, improve environmental predictability, and keep Zabbix ready to accommodate infrastructure growth.\n","date":"14 September 2026","externalUrl":null,"permalink":"/en/posts/observability/zabbix-tuning-basics/","section":"Posts","summary":"Learn how to optimize Zabbix internal processes, size in-memory caches, and configure housekeeping to improve server performance and reliability.","title":"Optimizing Zabbix: Tuning Fundamentals","type":"posts"},{"content":"","date":"14 September 2026","externalUrl":null,"permalink":"/en/tags/performance/","section":"Tags","summary":"","title":"Performance","type":"tags"},{"content":"","date":"14 September 2026","externalUrl":null,"permalink":"/en/tags/tuning/","section":"Tags","summary":"","title":"Tuning","type":"tags"},{"content":"","date":"14 September 2026","externalUrl":null,"permalink":"/en/tags/zabbix/","section":"Tags","summary":"","title":"Zabbix","type":"tags"},{"content":"","date":"20 July 2026","externalUrl":null,"permalink":"/en/tags/containers/","section":"Tags","summary":"","title":"Containers","type":"tags"},{"content":"In this article, we will explore how to deploy Zabbix using Docker and Docker Compose, from preparing environment variables to configuring the services responsible for running the platform.\nThe goal is to build an organized environment in which each Zabbix component runs in its own container. This approach allows us to manage services individually, simplify future updates, and keep data persistent regardless of the containers\u0026rsquo; lifecycle.\nAll files used in this deployment are available on GitHub: netns/zbx-docker. The repository contains the Docker Compose configuration files and other resources required to reproduce the environment presented in this article.\nA brief introduction to how Docker works # Docker is a containerization platform that allows applications and their dependencies to be packaged into isolated units called containers. Unlike traditional virtual machines, containers share the host operating system\u0026rsquo;s kernel, reducing resource consumption and simplifying application distribution.\nDocker Compose complements this functionality by allowing us to define and manage applications composed of multiple containers through a single YAML file. Within this file, we can declare services, images, environment variables, volumes, networks, and restart policies.\nIn the case of Zabbix, this approach allows us to separate components such as the server, web interface, and database while maintaining communication between them through an internal Docker network.\nFor more information, refer to the official Docker documentation and the Docker Compose documentation.\nDocker Compose Services # Before defining the services, let\u0026rsquo;s organize the variables used throughout the deployment.\nDocker Compose allows us to use a file named .env to centralize values that will be referenced in the YAML configuration file. This avoids repeating information and makes the environment easier to maintain.\nAn example .env file:\nPOSTGRES_PASSWORD=strong-password-here ZBX_SERVER_NAME=\u0026#34;Zabbix Docker\u0026#34; PHP_TZ=America/Sao_Paulo # HA (uncomment only in multi-node deployments) # ZBX_HANODENAME=zabbix-node-1 # ZBX_NODEADDRESS=zabbix-server ZBX_STARTPOLLERS=10 ZBX_STARTPOLLERSUNREACHABLE=3 ZBX_STARTPINGERS=3 ZBX_STARTPREPROCESSORS=5 ZBX_STARTDISCOVERERS=2 ZBX_CACHESIZE=32M ZBX_HISTORYCACHESIZE=64M ZBX_HISTORYINDEXCACHESIZE=16M ZBX_TRENDCACHESIZE=16M ZBX_VALUECACHESIZE=32M ZBX_CACHEUPDATEFREQUENCY=10 ZBX_HOUSEKEEPINGFREQUENCY=1 ZBX_MAXHOUSEKEEPERDELETE=5000 ZBX_LOGSLOWQUERIES=3000 The variables above represent different configurations for the components. Some are used by Docker Compose to substitute values in the YAML file, while others correspond directly to Zabbix configuration parameters.\nIt is important to note that the Docker Compose .env file does not automatically make all its variables available inside containers. To achieve this, they must be explicitly referenced through the environment attribute or made available using env_file in the service definition.\nWarning The snippets presented in this article show only the service definitions. The root-level volume and network declarations, along with the remaining parameters, are included in the complete file available in the repository: zbx_srv_postgres.yml. To reproduce the environment, use the repository file rather than assembling the YAML configuration using only the fragments shown below.\nTip The ZBX_HANODENAME and ZBX_NODEADDRESS variables are related to Zabbix Server High Availability (HA) configuration. In a single-node deployment, these variables are not required. Refer to the official Zabbix HA documentation for further information.\nCaution Do not commit .env files containing credentials or sensitive information to public repositories. Add the file to .gitignore and, in production environments, consider using dedicated secrets management mechanisms.\nDatabase # The database is one of the most important components of the Zabbix architecture. It stores information about hosts, monitored items, events, history, trends, and platform configurations.\nFor smaller environments, the database can run in a container on the same machine as the other components. However, in larger environments or those with stricter availability and performance requirements, it is worth considering running the database on dedicated infrastructure.\nIn this example, we will use PostgreSQL 18:\nzabbix-db: image: postgres:18 container_name: zabbix-db environment: POSTGRES_DB: zabbix POSTGRES_USER: zabbix POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} volumes: - db-data:/var/lib/postgresql restart: unless-stopped networks: - zabbix-net healthcheck: test: [\u0026#34;CMD-SHELL\u0026#34;, \u0026#34;pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}\u0026#34;] interval: 30s timeout: 5s retries: 5 Let\u0026rsquo;s take a look at the main parameters used.\nimage: defines the image used to create the container. In this case, we use the official PostgreSQL image, version 18.\ncontainer_name: assigns a name to the container, making it easier to identify and manage.\nenvironment: provides environment variables used during PostgreSQL initialization. Here, we define the database name, username, and password.\nvolumes: attaches a persistent Docker volume to the PostgreSQL data directory.\nrestart: defines the restart policy. With unless-stopped, the container will restart after a failure or Docker restart, unless it has been manually stopped.\nnetworks: connects the service to the internal network used by the other Zabbix components.\nData Persistence with Docker Volumes # One aspect that deserves attention in a containerized deployment is data persistence.\nBy default, data stored in a container\u0026rsquo;s writable layer is tied to its lifecycle. If the container is removed, this data may also be lost.\nTo prevent this issue, Docker provides volumes, which allow data to be stored outside the containers\u0026rsquo; writable layers.\nIn the previous example, we used a named volume called db-data, mounted at the /var/lib/postgresql directory inside the container.\nThis way, even if the container is removed and recreated, the database data remains stored in the volume, provided that the volume itself is not explicitly removed.\nFor more information, refer to the official Docker Volumes documentation.\nZabbix Server # The Zabbix Server is the core component of the platform. It is responsible for data collection and processing, executing checks, evaluating triggers, managing events, and sending notifications.\nIn this deployment, we will use the official zabbix/zabbix-server-pgsql image, version 8.0, which is the latest Long-term Support (LTS) release based on Ubuntu.\nzabbix-server: image: zabbix/zabbix-server-pgsql:ubuntu-8.0-latest container_name: zabbix-server depends_on: zabbix-db: condition: service_healthy environment: # Database Config DB_SERVER_HOST: zabbix-db POSTGRES_DB: zabbix POSTGRES_USER: zabbix POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} # HA Config ZBX_HANODENAME: ${ZBX_HANODENAME} ZBX_NODEADDRESS: ${ZBX_NODEADDRESS} # Pollers Tuning ZBX_STARTPOLLERS: ${ZBX_STARTPOLLERS} ZBX_STARTPOLLERSUNREACHABLE: ${ZBX_STARTPOLLERSUNREACHABLE} ZBX_STARTPINGERS: ${ZBX_STARTPINGERS} ZBX_STARTPREPROCESSORS: ${ZBX_STARTPREPROCESSORS} ZBX_STARTDISCOVERERS: ${ZBX_STARTDISCOVERERS} # Mem and Cache Tuning ZBX_CACHESIZE: ${ZBX_CACHESIZE} ZBX_HISTORYCACHESIZE: ${ZBX_HISTORYCACHESIZE} ZBX_HISTORYINDEXCACHESIZE: ${ZBX_HISTORYINDEXCACHESIZE} ZBX_TRENDCACHESIZE: ${ZBX_TRENDCACHESIZE} ZBX_VALUECACHESIZE: ${ZBX_VALUECACHESIZE} # Housekeeper ZBX_CACHEUPDATEFREQUENCY: ${ZBX_CACHEUPDATEFREQUENCY} ZBX_HOUSEKEEPINGFREQUENCY: ${ZBX_HOUSEKEEPINGFREQUENCY} ZBX_MAXHOUSEKEEPERDELETE: ${ZBX_MAXHOUSEKEEPERDELETE} ZBX_LOGSLOWQUERIES: ${ZBX_LOGSLOWQUERIES} # Other ZBX_ENABLE_SNMP_TRAPS: true ports: - \u0026#34;10051:10051\u0026#34; volumes: - zabbix-alertscripts:/usr/lib/zabbix/alertscripts - zabbix-externalscripts:/usr/lib/zabbix/externalscripts - zabbix-modules:/var/lib/zabbix/modules - zabbix-enc:/var/lib/zabbix/enc - zabbix-ssh-keys:/var/lib/zabbix/ssh_keys - zabbix-ssl-certs:/var/lib/zabbix/ssl/certs - zabbix-ssl-keys:/var/lib/zabbix/ssl/keys - zabbix-ssl-ca:/var/lib/zabbix/ssl/ssl_ca:ro - zabbix-snmptraps-data:/var/lib/zabbix/snmptraps - zabbix-export-data:/var/lib/zabbix/export - zabbix-mibs:/var/lib/zabbix/mibs restart: unless-stopped networks: - zabbix-net Database Connection # The DB_SERVER_HOST, POSTGRES_DB, POSTGRES_USER, and POSTGRES_PASSWORD variables are used to establish the connection between Zabbix Server and PostgreSQL.\nNotice that we use zabbix-db as the database hostname. This is possible because both services share the same Docker network, allowing them to communicate using their respective service names as internal DNS addresses.\nProcess and Cache Management # Zabbix Server uses different processes to perform monitoring tasks. Through variables such as ZBX_STARTPOLLERS, ZBX_STARTPINGERS, ZBX_STARTPREPROCESSORS, and others, we can adjust the number of processes available for each task.\nWe can also define the amount of memory allocated to the server\u0026rsquo;s internal caches using parameters such as ZBX_CACHESIZE, ZBX_HISTORYCACHESIZE, and ZBX_TRENDCACHESIZE.\nThese parameters directly affect resource consumption and platform performance. Their values should be defined based on the number of monitored hosts, collected items, update intervals, and available processing capacity.\nSNMP Traps and MIB Files # The ZBX_ENABLE_SNMP_TRAPS variable enables SNMP trap processing on Zabbix Server.\nFor this feature to work, the trap file generated by the zabbix-snmptraps service must be made available through a shared volume between the two containers.\nThe /var/lib/zabbix/mibs volume allows additional MIB files to be made available for interpreting OIDs during network device monitoring.\nThe /var/lib/zabbix/export volume is used to store real-time export files containing events, history, and trends when this feature is enabled.\nPorts and Persistence # TCP port 10051 is used by Zabbix Server to receive connections from active agents and proxies. Publishing this port on the host allows components outside the Docker network to reach the service.\nFinally, the volumes ensure that files used by additional features remain persistent, regardless of container recreation.\nNote Lists of all environment variables and volumes that can be used in Docker Compose are available on the official Zabbix Docker Hub page:\nZabbix Server MySQL Zabbix Server PostgreSQL Zabbix Proxy MySQL Zabbix Proxy SQLite3 Zabbix Frontend Apache (MySQL) Zabbix Frontend Nginx (MySQL) Zabbix Frontend Apache (PostgreSQL) Zabbix Frontend Nginx (PostgreSQL) Zabbix Agent Zabbix Agent 2 Zabbix MCP Server Also refer to the official Zabbix documentation on installation using containers.\nZabbix SNMP Traps # The SNMP Trapper is responsible for receiving SNMP notifications sent by monitored devices, such as switches, routers, firewalls, and other network equipment.\nUnlike traditional SNMP polling, in which Zabbix periodically queries devices, traps are sent asynchronously by the devices themselves when specific events occur.\nIn a Docker deployment, we can use a separate container to run the service responsible for receiving these notifications.\nTo enable this functionality, we need to set the ZBX_ENABLE_SNMP_TRAPS variable to true in Zabbix Server and share the /var/lib/zabbix/snmptraps volume between the two containers.\nExample configuration:\nzabbix-snmp-traps: image: zabbix/zabbix-snmptraps:ubuntu-8.0-latest container_name: zabbix-snmp-traps depends_on: zabbix-server: condition: service_started ports: - \u0026#34;162:1162/udp\u0026#34; volumes: - zabbix-snmptraps-data:/var/lib/zabbix/snmptraps - zabbix-mibs:/var/lib/zabbix/mibs restart: unless-stopped networks: - zabbix-net In this example, we publish UDP port 162 on the host and map it to UDP port 1162 inside the container, which is used by the trap reception service in the official image.\nThe shared volume allows the records received by the zabbix-snmptraps container to be made available to Zabbix Server for processing.\nIt is important to remember that configuring the container alone does not guarantee that SNMP Traps will work correctly. The network devices must also be configured to send notifications to the Docker host\u0026rsquo;s IP address, UDP traffic must be allowed, and the corresponding items must be configured in Zabbix.\nZabbix Frontend # The Zabbix Frontend is the web interface used to administer the platform. Through it, we can register hosts, configure templates, create monitoring items, track problems, view graphs, and manage users.\nFor this deployment, we will use the official zabbix/zabbix-web-nginx-pgsql image, which combines the Nginx web server with the Zabbix PHP frontend, using PostgreSQL as its database.\nRunning the Frontend in a separate container allows us to manage the interface independently of Zabbix Server.\nzabbix-web: image: zabbix/zabbix-web-nginx-pgsql:ubuntu-8.0-latest container_name: zabbix-web depends_on: zabbix-db: condition: service_healthy zabbix-server: condition: service_started environment: # Database Config DB_SERVER_HOST: zabbix-db POSTGRES_DB: zabbix POSTGRES_USER: zabbix POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} # Zabbix Server Config ZBX_SERVER_HOST: zabbix-server ZBX_SERVER_PORT: 10051 ZBX_SERVER_NAME: ${ZBX_SERVER_NAME} # PHP Config PHP_TZ: ${PHP_TZ} ports: - \u0026#34;8080:8080\u0026#34; restart: unless-stopped networks: - zabbix-net Some parameters deserve special attention:\nDB_SERVER_HOST: address of the container responsible for the database. POSTGRES_DB, POSTGRES_USER, and POSTGRES_PASSWORD: credentials used to access PostgreSQL. ZBX_SERVER_HOST: address of Zabbix Server. Since both services are on the same Docker network, we use the service name. ZBX_SERVER_PORT: port used for communication with Zabbix Server. ZBX_SERVER_NAME: installation identifier displayed in the web interface. PHP_TZ: defines the timezone used by PHP, preventing discrepancies in the display of dates and times. Host port 8080 will be mapped to port 8080 inside the container, allowing access to the interface through a web browser at http://SERVER_IP:8080.\nIn production environments, I recommend using a reverse proxy with HTTPS, avoiding direct exposure of the web interface without encryption.\nZabbix Agent # The Zabbix Agent is a component responsible for collecting information about the operating system and applications running on the monitored host, such as CPU usage, memory utilization, disk space, network interfaces, and processes.\nZabbix provides two implementations: the traditional Agent and Agent 2. The second version was developed with a plugin-based architecture, offering greater flexibility for integration with different technologies.\nIn this example, we will use Agent 2:\nzabbix-agent: image: zabbix/zabbix-agent2:ubuntu-8.0-latest container_name: zabbix-agent depends_on: zabbix-server: condition: service_started environment: ZBX_SERVER_HOST: zabbix-server ZBX_SERVER_PORT: 10051 ZBX_HOSTNAME: \u0026#34;Zabbix server\u0026#34; restart: unless-stopped networks: - zabbix-net The ZBX_SERVER_HOST variable defines the address of Zabbix Server, while ZBX_HOSTNAME specifies the identification name of the monitored host. The latter must exactly match the name configured in the Zabbix frontend.\nSince the containers share the zabbix-net network, we can use the zabbix-server service name to establish communication between them, taking advantage of Docker\u0026rsquo;s built-in internal DNS resolution.\nThis way, Agent 2 becomes available to monitor the containerized environment itself and collect host information, depending on the permissions and resources made available to the container.\nImportant It is important to distinguish between container monitoring and host operating system monitoring.\nBy default, Docker containers run in isolated environments and do not have access to most host resources. Therefore, Zabbix Agent 2 will be able to collect information about the container itself, but it will not have complete visibility into the resources of the host machine.\nIf the goal is to monitor the host, the container must be run with additional privileges (privileged) or provided with the system volumes and resources required to collect metrics.\nRefer to the official image documentation to check the required volumes and permissions: Zabbix Agent 2 – Docker Hub.\nStarting the Services # With the services configured, we can start the deployment using Docker Compose.\nRun the following command in the directory where the Docker Compose configuration file is stored. In this example, we will use the filename zbx_srv_postgres.yml, but you can choose another name according to your organizational preferences:\ndocker compose -f zbx_srv_postgres.yml up -d If an .env file is being used, it must also be available in the working directory or explicitly referenced in the configuration.\nThe -f parameter specifies the Compose file to be used, while -d runs the containers in the background (detached mode).\nAfter execution, Docker Compose will create the network, volumes, and containers defined in the configuration file.\nTo check the status of the services, run:\ndocker compose -f zbx_srv_postgres.yml ps If any service fails to start correctly, check its logs using:\ndocker compose -f zbx_srv_postgres.yml logs -f Once all components are running, the Zabbix web interface will be available at:\nhttp://SERVER_IP:8080.\nFrom this point onward, we can access the Frontend and begin configuring the monitoring environment.\nSelf-Monitoring # By default, Zabbix Server self-monitoring may use the address 127.0.0.1 to perform queries to the Agent. However, inside a container, this loopback address always refers to the container itself, rather than another service in the infrastructure.\nSince we are running Zabbix Server and Agent 2 in separate containers, we need to modify the interface configuration of the host responsible for self-monitoring.\nIn the web interface, navigate to the configuration of the Zabbix server host and change the Agent interface address to use DNS, specifying zabbix-agent as the address.\nSince both containers share the zabbix-net network, Docker can automatically resolve the zabbix-agent service name, directing queries to the correct address.\nAfter this change, Zabbix Server will be able to query Agent 2 normally, allowing us to monitor the resources and operation of the environment.\nDatabase Backup Procedure # One of the simplest ways to back up a database is to use a tool such as pg_dump for PostgreSQL or mysqldump for MySQL/MariaDB. These tools are generally more suitable for smaller environments, as they do not provide features such as Point-in-Time Recovery (PITR) or take advantage of Write-Ahead Logging (WAL) for continuous archiving. At the end of this section, I have included some articles that explore these tools in greater detail.\nThe procedure for creating a database dump in Docker is shown in the example below. In this case, we use pg_dump, but for MySQL/MariaDB, the command structure is similar, using mysqldump instead.\ndocker exec -T zabbix-db pg_dump -U zabbix -d zabbix \\ \u0026gt; dump_$(date +%Y-%m-%d_%H_%M_%S).sql It is also possible to create compressed dumps. In this example, I use pigz, a multithreaded implementation of gzip, but you can use whichever tool you prefer.\ndocker exec -T zabbix-db pg_dump -U zabbix -d zabbix \\ | pigz --best \u0026gt; dump_$(date +%Y-%m-%d_%H_%M_%S).sql.gz To restore an uncompressed dump, simply run:\ndocker exec -iT zabbix-db psql -U zabbix -d zabbix \u0026lt; dump.sql To restore a gzip-compressed file, use:\ngunzip -c dump.sql.gz | docker exec -iT zabbix-db psql -U zabbix -d zabbix Another alternative is to use PostgreSQL\u0026rsquo;s Custom format, generated with the -Fc parameter in pg_dump. This format allows you to use pg_restore for restoration, providing additional features such as object selection and parallel processing.\nTo create the backup:\ndocker exec -T zabbix-db pg_dump -U zabbix -d zabbix -Fc \\ \u0026gt; dump_$(date +%Y-%m-%d_%H_%M_%S).dump To restore it, run:\ndocker exec -iT zabbix-db pg_restore -U zabbix -d zabbix \\ \u0026lt; backup.dump Unlike psql, pg_restore supports parallel restoration using the -j parameter. For this, the backup file must be directly accessible inside the container:\ndocker exec -T zabbix-db pg_restore -U zabbix -d zabbix -j 4 \\ /backup/backup.dump Tip A file can be made available inside the container using the following command:\ndocker cp backup.dump zabbix-db:/backup/backup.dump In this example, four simultaneous processes are used to perform the restoration, potentially reducing the time required for larger databases.\nNote This section was only a brief introduction to backing up a database running in a container. However, I recommend exploring the following articles and tools to deepen your knowledge:\nThe Zabbix Book – Taking Backups Barman pgBackRest PostgreSQL – Backup and Restore MariaDB – mariadb-dump Percona XtraBackup Upgrade Procedure for New Versions # Keeping Zabbix up to date is important to receive security fixes, performance improvements, and new features. However, before updating the containers, some precautions are necessary to avoid data loss or compatibility issues.\nThe first step is to perform a full database backup. Since PostgreSQL stores the platform\u0026rsquo;s configurations, events, history, and other information, preserving this data is essential to allow recovery in case of a failure during the procedure.\nBefore starting, review the upgrade notes and check the requirements for the target version:\nGeneral Zabbix Upgrade Procedure Upgrading Zabbix Using Containers Preparation and Backup # First, I recommend stopping the application components to prevent new operations during the backup and upgrade process. The database container must remain running.\nConsidering the architecture presented in this article, we can execute:\ndocker compose -f zbx_srv_postgres.yml stop \\ zabbix-web zabbix-server Next, back up PostgreSQL. In this example, we will use pg_dump:\ndocker exec -T zabbix-db \\ pg_dump -U zabbix -d zabbix -Fc \\ \u0026gt; dump_$(date +%Y-%m-%d_%H_%M_%S).dump The -Fc parameter uses PostgreSQL\u0026rsquo;s custom format, allowing the database to be restored using pg_restore.\nIn addition to the database, preserve the .env and zbx_srv_postgres.yml files, as they contain the configuration required to recreate the services.\nImage Updates # With the backup completed, we can download the updated images:\ndocker compose -f zbx_srv_postgres.yml pull This command checks and downloads the images corresponding to the references defined in the Compose file.\nNext, recreate the containers:\ndocker compose -f zbx_srv_postgres.yml up -d Docker Compose will identify changes in the images and recreate the necessary services.\nAutomatic Database Upgrade # An important detail is that the Zabbix Server automatically upgrades the database schema during startup when it detects that the existing structure needs to be updated.\nDuring this process, the server checks the database version and performs the necessary changes to make it compatible with the new version.\nAutomatic Zabbix database upgrade Depending on the database size and the amount of stored information, this procedure may take a few minutes or even longer.\nDo not interrupt the database upgrade process. Monitor the Zabbix Server logs to check its progress:\ndocker compose -f zbx_srv_postgres.yml logs -f zabbix-server After completion, verify that the server has started successfully and that data collection has resumed.\nHigh Availability (HA) Considerations # In environments using Zabbix\u0026rsquo;s native High Availability mechanism, the upgrade procedure requires additional precautions.\nWhen upgrading between major versions, all nodes must be stopped and a full database backup must be performed. Next, one of the nodes must be selected to carry out the database upgrade, temporarily operating in standalone mode, without the ZBX_HANODENAME configuration.\nAfter the upgrade is complete and the server has been confirmed to be working correctly, the node can be returned to its HA configuration. The remaining nodes can then be upgraded and restarted.\nFor minor version upgrades, the procedure is simpler: it is generally sufficient to upgrade one node first, verify that it is working correctly, and then upgrade the remaining nodes.\nFinal Considerations # Using Docker Compose allows us to organize the Zabbix deployment into independent services, simplifying the management, maintenance, and updating of the platform components.\nThroughout this article, we explored how to structure an environment using PostgreSQL, Zabbix Server, Frontend, Agent, and SNMP Traps, covering the main configurations of each service and the persistence mechanisms provided by Docker.\nAlthough containerization simplifies several deployment tasks, it is important to remember that it does not eliminate the need for proper planning. Resource sizing, data persistence, credential security, backups, and upgrade procedures remain important responsibilities when managing the environment.\nThe configuration presented here serves as a starting point for lab environments and can be adapted to meet the requirements of different infrastructures. For production environments, also consider availability requirements, container monitoring, storage, backup policies, and secure communication between services.\n","date":"20 July 2026","externalUrl":null,"permalink":"/en/posts/observability/zabbix-container-deployment/","section":"Posts","summary":"A practical guide to deploying Zabbix with Docker, covering container architecture, service configuration, and key environment parameters.","title":"Deploying Zabbix with Docker","type":"posts"},{"content":"","date":"20 July 2026","externalUrl":null,"permalink":"/en/tags/docker/","section":"Tags","summary":"","title":"Docker","type":"tags"},{"content":"Hi! I\u0026rsquo;m Daniel, a Networking and infrastructure professional.\nMuch of my time is spent studying, building labs, testing technologies, and troubleshooting problems. I\u0026rsquo;m particularly interested in service provider networks, an area in which I currently work, routing architecture, Linux systems, and the tools used to operate and monitor infrastructure.\nIn networking, I\u0026rsquo;ve been exploring technologies such as OSPF, BGP, MPLS, IPv6, and GPON. I also work with virtualization, DNS services, monitoring, observability, and automation using tools like Zabbix, Grafana, Python, and Ansible.\nThis website started as a way to organize and share that journey.\nHere, I document personal projects, lab environments, configurations, problems I\u0026rsquo;ve encountered, and solutions I\u0026rsquo;ve developed. Some articles come from practical experiences, while others are driven by curiosity about a particular technology or the desire to experiment with a new tool.\nMany of the projects and experiments featured here are also available on my GitHub, where I maintain code, configurations, and technical documentation.\nContact # For professional inquiries, career opportunities, or discussions about networking and infrastructure, feel free to reach me via email or connect with me on LinkedIn.\nTo explore my projects, labs, and experiments, visit my GitHub.\n","externalUrl":null,"permalink":"/en/about/","section":"","summary":"","title":"About","type":"page"},{"content":"","externalUrl":null,"permalink":"/en/authors/","section":"Authors","summary":"","title":"Authors","type":"authors"},{"content":"","externalUrl":null,"permalink":"/en/series/","section":"Series","summary":"","title":"Series","type":"series"}]