community.zabbix.zabbix_host_events_info – Get all triggers about a Zabbix host¶
Note
This plugin is part of the community.zabbix collection (version 1.3.0).
To install it use: ansible-galaxy collection install community.zabbix
.
To use it in a playbook, specify: community.zabbix.zabbix_host_events_info
.
Synopsis¶
This module allows you to see if a Zabbix host have no active alert to make actions on it. For this case use module Ansible ‘fail’ to exclude host in trouble.
Length of “triggers_ok” allow if template’s triggers exist for Zabbix Host
Requirements¶
The below requirements are needed on the host that executes this module.
python >= 2.7
zabbix-api >= 0.5.3
Parameters¶
Notes¶
Note
If you use login_password=zabbix, the word “zabbix” is replaced by “****” in all module output, because login_password uses
no_log
. See this FAQ for more information.
Examples¶
- name: exclude machine if alert active on it
community.zabbix.zabbix_host_events_info:
server_url: "{{ zabbix_url }}"
login_user: "{{ lookup('env','ZABBIX_USER') }}"
login_password: "{{ lookup('env','ZABBIX_PASSWORD') }}"
host_identifier: "{{inventory_hostname}}"
host_id_type: "hostname"
timeout: 120
register: zbx_host
delegate_to: localhost
- fail:
msg: "machine alert in zabbix"
when: zbx_host['triggers_problem']|length > 0
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Authors¶
Stéphane Travassac (@stravassac)