From fb5e9cbe81279ab59a3c3e8d5d8abdd8ea9c339d Mon Sep 17 00:00:00 2001 From: Andreas Hilbig Date: Wed, 4 Feb 2026 13:50:58 +0100 Subject: [PATCH] feat: improve Zabbix multi-version compatibility and introduce local development environment This update enhances compatibility across multiple Zabbix versions and introduces tools for easier local development and testing. Key improvements and verified version support: - Verified Zabbix version support: 6.2, 6.4, 7.0, and 7.4. - Version-specific feature handling: - `history.push` is enabled only for Zabbix 7.0+; older versions skip it with a clear error or notice. - Conditional JSON-RPC authentication: the `auth` field is automatically added to the request body for versions older than 6.4. - Implemented static Zabbix version caching in the datasource to minimize redundant API calls. - Query optimization refinements: - Added mapping for implied fields (e.g., `state` -> `items`, `deviceType` -> `tags`). - Automatically prune unnecessary Zabbix parameters (like `selectItems` or `selectTags`) when not requested. - Local development environment: - Added a new `zabbix-local` Docker Compose profile that includes PostgreSQL, Zabbix Server, and Zabbix Web. - Supports testing different versions by passing the `ZABBIX_VERSION` environment variable (e.g., 6.2, 6.4, 7.0, 7.4). - Provided a sample environment file at `samples/zabbix-local.env`. - Documentation and Roadmap: - Updated README with a comprehensive version compatibility matrix and local environment instructions. - Created a new guide: `docs/howtos/local_development.md`. - Updated maintenance guides and added "Local Development Environment" as an achieved milestone in the roadmap. - Test suite enhancements: - Improved Smoketest and RegressionTest executors with more reliable resource cleanup and error reporting. - Made tests version-aware to prevent failures on older Zabbix instances. BREAKING CHANGE: Dropped Zabbix 6.0 specific workarounds; the minimum supported version is now 6.2. --- .gitignore | 5 +- .idea/workspace.xml | 47 ++++---- README.md | 38 +++++- docker-compose.yml | 45 +++++++ docs/howtos/README.md | 3 + docs/howtos/local_development.md | 88 ++++++++++++++ docs/howtos/maintenance.md | 3 + roadmap.md | 13 +- samples/zabbix-local.env | 10 ++ src/api/graphql_utils.ts | 2 +- src/api/resolvers.ts | 24 ++-- src/datasources/zabbix-api.ts | 14 +++ src/datasources/zabbix-history.ts | 4 + src/datasources/zabbix-hostgroups.ts | 1 + src/datasources/zabbix-hosts.ts | 15 +-- src/datasources/zabbix-permissions.ts | 16 ++- src/datasources/zabbix-request.ts | 30 ++++- src/datasources/zabbix-usergroups.ts | 89 ++++++++------ src/execution/regression_test_executor.ts | 139 +++++++++++++--------- src/execution/smoketest_executor.ts | 4 +- src/test/history_push.test.ts | 10 +- src/test/history_push_integration.test.ts | 1 + src/test/host_importer.test.ts | 1 + src/test/host_integration.test.ts | 1 + src/test/host_query.test.ts | 1 + src/test/indirect_dependencies.test.ts | 1 + src/test/misc_resolvers.test.ts | 3 +- src/test/query_optimization.test.ts | 5 +- src/test/template_deleter.test.ts | 3 +- src/test/template_importer.test.ts | 3 +- src/test/template_integration.test.ts | 1 + src/test/template_link.test.ts | 1 + src/test/template_query.test.ts | 15 ++- src/test/user_rights.test.ts | 1 + src/test/user_rights_integration.test.ts | 4 +- src/test/zabbix_docs_samples.test.ts | 1 + 36 files changed, 470 insertions(+), 172 deletions(-) create mode 100644 docs/howtos/local_development.md create mode 100644 samples/zabbix-local.env diff --git a/.gitignore b/.gitignore index 78ded7b..a612f5d 100644 --- a/.gitignore +++ b/.gitignore @@ -74,10 +74,7 @@ web_modules/ # dotenv environment variable files .env -.env.development.local -.env.test.local -.env.production.local -.env.local +.env.* # parcel-bundler cache (https://parceljs.org/) .cache diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d1b9822..6696220 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,30 +5,17 @@ - - - - - - - - - - - - - - - - - + + + + + - - - - + + + - @@ -103,7 +90,7 @@ "RunOnceActivity.git.unshallow": "true", "RunOnceActivity.typescript.service.memoryLimit.init": "true", "com.intellij.ml.llm.matterhorn.ej.ui.settings.DefaultModelSelectionForGA.v1": "true", - "git-widget-placeholder": "main", + "git-widget-placeholder": "feature-improve-zabbix-version-compatiblity", "go.import.settings.migrated": "true", "javascript.preferred.runtime.type.id": "node", "junie.onboarding.icon.badge.shown": "true", @@ -124,6 +111,11 @@ "to.speed.mode.migration.done": "true", "ts.external.directory.path": "\\\\wsl.localhost\\Ubuntu\\home\\ahilbig\\git\\vcr\\zabbix-graphql-api\\node_modules\\typescript\\lib", "vue.rearranger.settings.migration": "true" + }, + "keyToStringList": { + "com.intellij.ide.scratch.ScratchImplUtil$2/New Scratch File": [ + "TEXT" + ] } }]]> @@ -231,7 +223,10 @@ - + + + +