community / community.zabbix / 1.8.0 / module / zabbix_service Create/update/delete Zabbix service Authors: Emmanuel Riviere (@emriver), Evgeny Yurchenko (@BGmot)community.zabbix.zabbix_service (1.8.0) — module
Install with ansible-galaxy collection install community.zabbix:==1.8.0
collections: - name: community.zabbix version: 1.8.0
Create/update/delete Zabbix service.
--- # Creates a new Zabbix service with Zabbix < 6.0 - name: Manage services community.zabbix.zabbix_service: server_url: "http://zabbix.example.com/zabbix/" login_user: username login_password: password name: apache2 service sla: 99.99 calculate_sla: yes algorithm: one_child trigger_name: apache2 service status trigger_host: webserver01 state: present
# Creates a new Zabbix service with Zabbix >= 6.0 - name: Create Zabbix service monitoring Apache2 in DCs in Toronto area community.zabbix.zabbix_service: server_url: "zabbix.example.com/zabbix/" login_user: username login_password: password name: 'apache2 service Toronto' description: Apache2 services in Toronto area sortorder: 0 propagation_rule: increase propagation_value: warning weight: 1 state: present tags: - tag: zabbix_service value: apache2 - tag: area value: Toronto problem_tags: - tag: service_name value: httpd - tag: area operator: like value: toronto status_rules: - type: at_least_n_child_services_have_status_or_above limit_value: 4242 limit_status: ok new_status: average
- name: Create Zabbix service monitoring all Apache2 services community.zabbix.zabbix_service: server_url: "zabbix.example.com/zabbix/" login_user: username login_password: password name: apache2 service description: Apache2 services tags: - tag: zabbix_service value: apache2 - tag: area value: global children: - 'apache2 service Toronto'
sla: description: - Sla value (i.e 99.99), goodsla in Zabbix API - With >= Zabbix 6.0 this field is removed from the API and is dropped silently by module. required: false type: float name: description: - Name of Zabbix service required: true type: str tags: description: - Service tags to be created for the service. - New field with >= Zabbix 6.0. elements: dict required: false suboptions: tag: description: - Service tag name. required: true type: str value: description: - Service tag value. required: false type: str type: list state: choices: - present - absent default: present description: - 'State: present - create/update service; absent - delete service.' required: false type: str parent: description: - Name of Zabbix service parent - With >= Zabbix 6.0 this field is removed from the API and is dropped silently by module. required: false type: str weight: default: '0' description: - Service weight. - New field with >= Zabbix 6.0. required: false type: str parents: description: - Parent services to be linked to the service. - New field with >= Zabbix 6.0. elements: str required: false type: list timeout: default: 10 description: - The timeout of API request (seconds). type: int children: description: - Child services to be linked to the service. - New field with >= Zabbix 6.0. elements: str required: false type: list algorithm: choices: - 'no' - one_child - all_children - status_to_ok - most_crit_if_all_children - most_crit_of_child_serv default: one_child description: - Algorithm used to calculate the sla with < Zabbix 6.0 - ' - C(no), sla is not calculated' - ' - C(one_child), problem if at least one child has a problem' - ' - C(all_children), problem if all children have problems' - Status calculation rule. Only applicable if child services exists with >= Zabbix 6.0 - ' - C(status_to_ok), set status to OK with' - ' - C(most_crit_if_all_children), most critical if all children have problems' - ' - C(most_crit_of_child_serv), most critical of child services with' required: false type: str sortorder: description: - Position of the service used for sorting. required: true type: str login_user: description: - Zabbix user name. - If not set the environment variable C(ZABBIX_USERNAME) will be used. required: true type: str server_url: aliases: - url description: - URL of Zabbix server, with protocol (http or https). C(url) is an alias for C(server_url). - If not set the environment variable C(ZABBIX_SERVER) will be used. required: true type: str description: description: - Description of the service. - New field with >= Zabbix 6.0. required: false type: str problem_tags: description: - Problem tags to be created for the service. - New field with >= Zabbix 6.0. elements: dict required: false suboptions: operator: choices: - equals - like default: equals description: - Mapping condition operator. - C(equals) - C(like) required: false type: str tag: description: - Problem tag name. required: true type: str value: default: '' description: - Problem tag value. required: false type: str type: list status_rules: description: - Status rules for the service. - New field with >= Zabbix 6.0. elements: dict required: false suboptions: limit_status: description: - Limit status. - C(ok) OK - C(not_classified) Not classified - C(information) Information - C(warning) Warning - C(average) Average - C(high) High - C(disaster) Disaster required: true type: str limit_value: description: - 'Limit value: N, N% or W' - 'Possible values: 1-100000 for N and W, 1-100 for N%' required: true type: int new_status: description: - New status value. - C(not_classified) Not classified - C(information) Information - C(warning) Warning - C(average) Average - C(high) High - C(disaster) Disaster required: true type: str type: description: - Condition for setting (New status) status. - C(at_least_n_child_services_have_status_or_above) if at least (N) child services have (Status) status or above - C(at_least_npct_child_services_have_status_or_above) if at least (N%) of child services have (Status) status or above - C(less_than_n_child_services_have_status_or_below) if less than (N) child services have (Status) status or below - C(less_than_npct_child_services_have_status_or_below) if less than (N%) of child services have (Status) status or below - C(weight_child_services_with_status_or_above_at_least_w) if weight of child services with (Status) status or above is at least (W) - C(weight_child_services_with_status_or_above_at_least_npct) if weight of child services with (Status) status or above is at least (N%) - C(weight_child_services_with_status_or_below_less_w) if weight of child services with (Status) status or below is less than (W) - C(weight_child_services_with_status_or_below_less_npct) if weight of child services with (Status) status or below is less than (N%) required: true type: str type: list trigger_host: description: - Name of host linked to the service. - With >= Zabbix 6.0 this field is removed from the API and is dropped silently by module. required: false type: str trigger_name: description: - Name of trigger linked to the service. - With >= Zabbix 6.0 this field is removed from the API and is dropped silently by module. required: false type: str calculate_sla: default: false description: - If yes, calculate the SLA value for this service, showsla in Zabbix API - With >= Zabbix 6.0 this field is removed from the API and is dropped silently by module. required: false type: bool login_password: description: - Zabbix user password. - If not set the environment variable C(ZABBIX_PASSWORD) will be used. required: true type: str validate_certs: default: true description: - If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. - If not set the environment variable C(ZABBIX_VALIDATE_CERTS) will be used. type: bool http_login_user: description: - Basic Auth login type: str propagation_rule: default: as_is description: - Status propagation value. Must be set together with propagation_rule. - New field with >= Zabbix 6.0. - C(as_is) propagate service status as is - without any changes - C(increase) increase the propagated status by a given propagation_value (by 1 to 5 severities) - C(decrease) decrease the propagated status by a given propagation_value (by 1 to 5 severities) - C(ignore) ignore this service - the status is not propagated to the parent service at all - C(fixed) set fixed service status using a given propagation_value - Required with C(propagation_value) required: false type: str propagation_value: description: - Status propagation value. Must be set together with propagation_rule. - New field with >= Zabbix 6.0. - 'Possible values when I(propagation_rule=as_is or ignore):' - ' - C(not_classified)' - 'Possible values when I(propagation_rule=increase or decrease):' - ' - C(information)' - ' - C(warning)' - ' - C(average)' - ' - C(high)' - ' - C(disaster)' - 'Possible values when I(propagation_rule=fixed):' - ' - C(ok)' - ' - C(not_classified)' - ' - C(information)' - ' - C(warning)' - ' - C(average)' - ' - C(high)' - ' - C(disaster)' - Required with C(propagation_rule) required: false type: str http_login_password: description: - Basic Auth password type: str