Zabbix Lab

Context and motivation

At work I rolled out monitoring with Zabbix, and I wanted to be able to reproduce that kind of setup without relying on memory or manual clicks. Here everything is versioned as text and comes up with a single command.

With `vagrant up` the lab starts a complete Zabbix server (PostgreSQL + frontend with Nginx and PHP-FPM), a Linux agent and, optionally, a Windows Server and a domain controller, all on a host-only network.

I never touch the configuration of hosts, triggers and notifications from the UI. I define it in JSON files and apply it with Python scripts against the Zabbix API.

Technologies

VagrantDebian 12PostgreSQLPythonNginx

Main features

  • Fully automatic provisioning with a single `vagrant up`
  • Hosts, triggers and alerts defined as code (JSON + Zabbix API)
  • Detection of agent outages, disk >85%, CPU load and memory
  • PostgreSQL connectivity check
  • Email alerts captured with Mailpit (no real SMTP) and an optional Telegram channel
  • Monitoring of Windows hosts and domain controllers via WinRM

Gallery

Conclusion

It's a lab environment, not production, and it's documented as such. The credentials are trivial on purpose and the known issues have their workaround noted.

It let me take the Zabbix work I already handled at my job and turn it into infrastructure as code. Knowing how to configure something is one thing, knowing how to automate it is another.

Links

View code on GitHub