Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tag support for zabbix_host_events_info module #1258

Merged

Conversation

aplathrop
Copy link
Contributor

SUMMARY

Adds support to the zabbix_host_events_info module to filter events by tag. It also adds the tags returned by last_event

As there were no unit tests for the zabbix_host_events_info module, this also adds unit tests for it, both with and without tags

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME
  • zabbix_host_events_info
ADDITIONAL INFORMATION

Being able to filter events by tag is supported by the Zabbix API, but not the current zabbix_host_events_info module, so I've added support for it. An example of this can be seen below:

- community.zabbix.zabbix_host_events_info:
    host_identifier: ExampleHost
    host_id_type: hostname
    trigger_severity: warning
    tags:
      - tag: ExampleTag
        value: ExampleValue
        operator: equal

I believe it would also be useful to do the inverse, get a list of events for a host and then be able to do something based on the tags the events return:

- community.zabbix.zabbix_host_events_info:
    host_identifier: ExampleHost
    host_id_type: hostname
    trigger_severity: warning

- ansible.builtin.debug:
    msg: "{{ zabbix_host_events_tags.triggers_problem[0].last_event.tags }}"

@aplathrop aplathrop marked this pull request as ready for review May 31, 2024 16:00
Copy link
Collaborator

@pyrodie18 pyrodie18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Thank you for the addition

@pyrodie18 pyrodie18 merged commit 07c004e into ansible-collections:main May 31, 2024
26 checks passed
@aplathrop aplathrop deleted the zabbix_host_events_info_tags branch June 3, 2024 20:32
pyrodie18 pushed a commit to pyrodie18/community.zabbix that referenced this pull request Jun 4, 2024
pyrodie18 pushed a commit to pyrodie18/community.zabbix that referenced this pull request Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants