Repository navigation
Conversation
2d95ca4 to
e9b4ef1
Compare
Adds Site, SiteGroup, and Region as valid assignment targets for all ZabbixServerAssignment, ZabbixHostgroupAssignment, ZabbixTemplateAssignment, ZabbixTagAssignment, ZabbixMacroAssignment, and ZabbixHostInventory objects. This allows assignments made at the Site/SiteGroup/Region level to be inherited by all devices and VMs at that site or below, via the existing inheritance_chain mechanism. Changes: - Constants: Site/SiteGroup/Region added to ASSIGNMENT_MODELS, ASSIGNMENT_TYPE_TO_FIELD, PATH_LABELS - Forms: All 7 assignment forms get Site/SiteGroup/Region DynamicModelChoiceField + FieldSet - Settings: inheritance_chain extended with Site/SiteGroup/Region resolution paths - Jobs: SyncHostJob._prepare_assignment() creates detached copies for inherited assignments - HostSync: _get_sync_target() resolves actual Device/VM for Jinja2 rendering - HostSync: get_tag_attributes() deduplicates tags by (tag, value) to prevent Zabbix 7 rejecting duplicate pairs inherited from multiple sources - HostInterfaceSync: get_create_params() falls back to the device's primary IP when the interface has no IP assigned (e.g. when inherited from SiteGroup) - HostInterfaceSync: errors are caught per-interface so one failing interface does not prevent the remaining interfaces and templates from being synced - Inheritance: ConfigGroup interface expansion removed; interfaces are now resolved naturally via the inheritance chain with primary IP fallback - SyncBase: _is_inherited_copy guard prevents save()/update_sync_info() on inherited copies - Views: ZabbixSiteTabView, ZabbixSiteGroupTabView, ZabbixRegionTabView added - Tests: 9 new tests for inheritance resolution Tested: all 1076 existing tests pass. Verified end-to-end on dev NetBox.
- Filter inherited/direct ZabbixServerAssignment and ZabbixHostInterface by zabbixserver - Resolve ConfigGroup interface IP from primary_ip4/primary_ip6 - Add seen-set cycle guard to resolve_path
- Fixes silent dropping of Site/SiteGroup assignments
91a5918 to
1bd513c
Compare
Fixes inherited Site/SiteGroup/Region assignments reading custom fields from the intermediate object instead of the actual Device/VM.
Adds a new exclude_tag plugin setting that allows excluding hosts from Zabbix sync entirely via a ZabbixTag assigned to any object in the inheritance chain (Role, Platform, Site, SiteGroup, Manufacturer, or directly on a Device/VM). When a ZabbixTagAssignment with a tag matching exclude_tag is present in the resolved assignments, SyncHostJob skips sync entirely. If the host was previously synced, it is deleted from Zabbix. The tag itself is filtered before Jinja2 rendering in get_tag_attributes(), so it never reaches Zabbix as a host tag. The setting defaults to '' (disabled), so existing deployments are unaffected. This follows the same pattern as no_alerting_tag — a signal tag that controls sync behavior without being pushed to Zabbix. Tested: 7 new tests covering exclusion enabled/disabled, tag present absent, and delete-on-exclude behavior. All 1092 existing tests pass.
1bd513c to
334ec6a
Compare
|
This PR is part of the zero-touch provisioning feature set described in #121. Please see that issue for the full architecture and motivation. |
578ea5b to
334ec6a
Compare
Conflict resolution note for rebaseWhen rebasing this PR after #115 lands, there will be a conflict in
Correct resolution: Combine both — keep the exclude_tag filtering from this PR, but use #115's exclude_tag = self.pluginsettings.exclude_tag
for assigned_tag in (self.context.get('all_objects', {}).get('tags', []) or []):
if exclude_tag and assigned_tag.zabbixtag.tag == exclude_tag:
continueVerified in the integration-test branch: 1135 tests pass, E2E confirmed. |
|
Superseded by #115, which now consolidates the hierarchy / site-mapping slice of #121 (#115 + #116 + #124 + #113 + #114). Commits from this PR are preserved there with their authorship. Closing to keep hierarchy review in one place. Template rules, bindings, CI, OOB and rendering PRs remain separate. |
Summary
Adds a new
exclude_tagplugin setting that allows excluding hosts from Zabbix sync entirely via aZabbixTagassigned to any object in the inheritance chain (Role, Platform, Site, SiteGroup, Manufacturer, or directly on a Device/VM).How it works
ZabbixTagwithtag='do_not_monitor'(or any name) and any valueDeviceRole(e.g. 'Desktop PC'),Platform,Site, or individualDevice/VirtualMachine'exclude_tag': 'do_not_monitor'inPLUGINS_CONFIGThe tag is filtered before Jinja2 rendering in
get_tag_attributes(), so it never reaches Zabbix as a host tag.Dependencies
Stacks on PR #115. Merge after #115.
Testing
7 new tests covering: exclusion disabled (default), tag present/absent, skip sync when excluded, delete on exclude, and no-delete when already decommissioned. All 1076 existing tests pass.
Part of #121.