fix(zabbix): populate hostname on pulled and pushed alerts#6612
Open
washosk wants to merge 1 commit into
Open
Conversation
Zabbix problem.get() alerts never carried a host, since _get_alerts()
never requested host data from the API. Add selectHosts to the request
and map it onto AlertDto's service/hostname fields.
The webhook push path had a separate bug: the installed script sends
the host as host_name/host_ip (matching its own parameter names), but
_format_alert() looked for hostName/hostIp, so the fallback silently
returned None whenever {HOST.HOST} was empty (e.g. multi-host trigger
problems).
shahargl
requested changes
Jul 3, 2026
shahargl
left a comment
Member
There was a problem hiding this comment.
Can you just add the new fields and not remove the old one? For backward compatibility /older zabbix versions
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.
Fixes #6613
Summary
Zabbix alerts were missing the host name in two separate ways:
_get_alerts): theproblem.getcall never asked Zabbix for host data (selectHostswas not set), so pulled alerts had no host information at all._format_alert): the installed Zabbix script sends the host ashost_name/host_ip(matching the parameter names configured insetup_webhook), but the code readhostName/hostIpinstead. The primary source,service({HOST.HOST}), can be empty for problems tied to multiple hosts, and the fallback silently returnedNonedue to this key mismatch.Changes
selectHosts: ["host", "name"]to theproblem.getrequest in_get_alerts, and map the host's visible name (falling back to its technical name) ontoservice/hostnameon theAlertDto._format_alertto readhost_name/host_ip(matching the actual webhook payload keys) instead of the non-existenthostName/hostIp.Test plan
problem.getpolling) now include a host name_get_alertsand_format_alertcovering these cases