feat(fixes): ZabbixAgentMixin, a native Zabbix agent for a host without a container engine (NetOrk/netork#2571) #124

Merged
christianmanivong merged 2 commits from feat/zabbix-agent-native into main 2026-11-17 04:00:27 +00:00
Owner

ZabbixAgentMixin.configure_zabbix_agent(settings): a native Zabbix agent for a host without a container engine (NetOrk/netork#2571).

Steps: load the package index where the driver can (refresh_available_updates), install ZABBIX_AGENT_PACKAGE from the host's own packages, and where those have none and settings["release"] names the server's release line, add Zabbix's repository (the driver's _add_zabbix_repository) and try again. Then configure (the driver's _write_zabbix_agent_config), firewall (_allow_zabbix_agent_sources), and enable and restart (manage_service). Settings that do not hold raise ValueError before anything changes.

Without I/O, in zabbix_agent.py:

  • check_zabbix_agent_settings;
  • zabbix_agent_config(text, settings): sets Server, ServerActive, ListenPort and Hostname, and keeps the rest;
  • zabbix_repository_command(os_release, release): covers Debian, Ubuntu, Raspberry Pi OS, RHEL, CentOS, Oracle, Alma and Rocky, in the layout since 7.2 (<release>/release/<distro>/…) and before it. The URLs were checked against repo.zabbix.com.

LldpAgentMixin and ZabbixAgentMixin share the start step (enable_and_restart). The drivers' steps come in napalm-linux, napalm-openwrt and napalm-proxmox, which need this as 4.40.0.

Checks: ruff, mypy, napalm-standard ratchet and check are green. 1763 tests pass. Two tests in test_host_status.py::TestThePackageManagerCommandOnARealShell fail on my workstation, on a clean origin/main too; that is unrelated to this change.

`ZabbixAgentMixin.configure_zabbix_agent(settings)`: a native Zabbix agent for a host without a container engine (NetOrk/netork#2571). **Steps:** load the package index where the driver can (`refresh_available_updates`), install `ZABBIX_AGENT_PACKAGE` from the host's own packages, and where those have none and `settings["release"]` names the server's release line, add Zabbix's repository (the driver's `_add_zabbix_repository`) and try again. Then configure (the driver's `_write_zabbix_agent_config`), firewall (`_allow_zabbix_agent_sources`), and enable and restart (`manage_service`). Settings that do not hold raise `ValueError` before anything changes. **Without I/O, in `zabbix_agent.py`:** - `check_zabbix_agent_settings`; - `zabbix_agent_config(text, settings)`: sets `Server`, `ServerActive`, `ListenPort` and `Hostname`, and keeps the rest; - `zabbix_repository_command(os_release, release)`: covers Debian, Ubuntu, Raspberry Pi OS, RHEL, CentOS, Oracle, Alma and Rocky, in the layout since 7.2 (`<release>/release/<distro>/…`) and before it. The URLs were checked against repo.zabbix.com. `LldpAgentMixin` and `ZabbixAgentMixin` share the start step (`enable_and_restart`). The drivers' steps come in napalm-linux, napalm-openwrt and napalm-proxmox, which need this as **4.40.0**. **Checks:** ruff, mypy, `napalm-standard ratchet` and `check` are green. 1763 tests pass. Two tests in `test_host_status.py::TestThePackageManagerCommandOnARealShell` fail on my workstation, on a clean `origin/main` too; that is unrelated to this change.
christianmanivong added 1 commit 2026-11-17 03:52:17 +00:00
feat(fixes): ZabbixAgentMixin, a native Zabbix agent for a host without a container engine (NetOrk/netork#2571)
driver / lint (pull_request) Successful in 16s
driver / standard (pull_request) Successful in 18s
driver / types (pull_request) Successful in 49s
driver / test (3.13) (pull_request) Successful in 1m6s
driver / lowest (pull_request) Successful in 34s
driver / test (3.12) (pull_request) Successful in 1m11s
driver / build (pull_request) Successful in 24s
driver / security (pull_request) Successful in 55s
CI / driver (pull_request) Successful in 2m20s
driver / publish (pull_request) Skipped
5217c6e333
configure_zabbix_agent(settings) loads the package index where the driver can,
installs ZABBIX_AGENT_PACKAGE from the host's own packages and, where those have
none and settings["release"] names the server's release line, from Zabbix's
repository (the driver's _add_zabbix_repository); then the driver writes the
configuration and opens the firewall, and the service is enabled and restarted.
Settings that do not hold raise ValueError before anything changes.

zabbix_agent.py holds what is the same on every host, without I/O: the settings
check, the agent's configuration with Server, ServerActive, ListenPort and
Hostname set and the rest kept, and the root command that adds Zabbix's
repository for Debian, Ubuntu, Raspberry Pi OS and the RHEL family, in the
layout before and since 7.2. LldpAgentMixin and ZabbixAgentMixin share the
start step (enable_and_restart).
christianmanivong added 1 commit 2026-11-17 03:56:08 +00:00
Merge remote-tracking branch 'origin/main' into feat/zabbix-agent-native
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 12s
driver / types (pull_request) Successful in 55s
driver / test (3.12) (pull_request) Successful in 1m10s
driver / test (3.13) (pull_request) Successful in 59s
driver / lowest (pull_request) Successful in 38s
driver / build (pull_request) Successful in 33s
driver / security (pull_request) Successful in 1m2s
CI / driver (pull_request) Successful in 2m38s
driver / publish (pull_request) Skipped
3422b7d030
# Conflicts:
#	CHANGELOG.md
christianmanivong merged commit caf7ef4cc8 into main 2026-11-17 04:00:27 +00:00
christianmanivong deleted branch feat/zabbix-agent-native 2026-11-17 04:00:27 +00:00
Sign in to join this conversation.