feat(notifications): add container context and normalize lifecycle events - #1427
Open
snesterkov wants to merge 2 commits into
Open
feat(notifications): add container context and normalize lifecycle events#1427snesterkov wants to merge 2 commits into
snesterkov wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is a follow-up enhancement to the previously merged Zabbix notification integration.
It adds resource context to container notifications and normalizes Docker lifecycle events so external monitoring systems can reliably correlate events with the affected container, environment, Compose stack, and service.
What changed
Container resource context
Container notifications now include additional context when available:
Standalone containers remain standalone and do not get an invented stack or service name.
Normalized lifecycle events
Docker lifecycle actions are normalized into stable notification event types:
container_startedcontainer_stoppedcontainer_exitedcontainer_restartedcontainer_oomcontainer_unhealthycontainer_healthyThe normalization also avoids duplicate or misleading notifications:
docker stopproducescontainer_stoppeddieproducescontainer_exitedkillis correlated with the followingdieinstead of producing duplicate eventsoomsuppresses the subsequent duplicatediecontainer_restartedeventThe same lifecycle semantics are used for both direct Docker environments and Hawser environments.
Why
The existing Zabbix notification provider can deliver Dockhand events to external monitoring, but lifecycle events previously lacked enough resource context for reliable per-container alerting and recovery.
These changes make it possible for monitoring systems to:
Zabbix monitoring template
This PR also includes a Zabbix 7.4 monitoring template for Dockhand.
The template provides:
history.pushTemplate:
integrations/zabbix/zbx_dockhand_by_http.jsonTesting
Added tests for:
history.pushresource contextTargeted test result:
Also verified:
git diff --checkpassesType of change