forked from infra/ansible
Zabbix: Add COPR notification target
Signed-off-by: Greg Sutcliffe <fedora@emeraldreverie.org>
This commit is contained in:
parent
e8799f5dc5
commit
013b1f8b48
2 changed files with 121 additions and 46 deletions
|
|
@ -145,52 +145,8 @@
|
|||
tags:
|
||||
- zabbix_triggers
|
||||
|
||||
- name: Create a new Zabbix user for Matrix triggers
|
||||
community.zabbix.zabbix_user:
|
||||
username: matrix-bot
|
||||
name: Matrix
|
||||
surname: Bot
|
||||
role_name: Super admin role # needed to allow notifications without lots of config around usergroups
|
||||
usrgrps:
|
||||
- Zabbix administrators
|
||||
passwd: "{{ (env == 'staging') | ternary(zabbix_stg_botuser_pwd, zabbix_botuser_pwd) }}"
|
||||
user_medias:
|
||||
- mediatype: Matrix
|
||||
sendto: "{{ (env == 'staging') | ternary(zabbix_stg_matrix_roomid, zabbix_matrix_roomid) }}"
|
||||
period: 1-7,00:00-24:00
|
||||
severity:
|
||||
not_classified: yes
|
||||
information: yes
|
||||
warning: yes
|
||||
average: yes
|
||||
high: yes
|
||||
disaster: yes
|
||||
active: yes
|
||||
state: present
|
||||
tags:
|
||||
- zabbix_users
|
||||
|
||||
- name: Send alerts to Matrix
|
||||
community.zabbix.zabbix_action:
|
||||
name: "Send alerts to Matrix"
|
||||
event_source: "trigger"
|
||||
state: present
|
||||
status: enabled
|
||||
esc_period: 1m
|
||||
conditions:
|
||||
- type: "trigger_severity"
|
||||
operator: ">="
|
||||
value: "Average"
|
||||
operations:
|
||||
- type: send_message
|
||||
media_type: "Matrix"
|
||||
send_to_users:
|
||||
- "matrix-bot"
|
||||
recovery_operations:
|
||||
- type: send_message
|
||||
media_type: "Matrix"
|
||||
send_to_users:
|
||||
- "matrix-bot"
|
||||
- name: Configure Zabbix users and notifies
|
||||
ansible.builtin.include_tasks: configure_users.yml
|
||||
tags:
|
||||
- zabbix_users
|
||||
- zabbix_triggers
|
||||
|
|
|
|||
119
roles/zabbix/zabbix_server/tasks/configure_users.yml
Normal file
119
roles/zabbix/zabbix_server/tasks/configure_users.yml
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
---
|
||||
# Configure the Zabbix users and notification channels
|
||||
|
||||
# Use a block so we can specify the connection vars once
|
||||
- name: API Block
|
||||
vars:
|
||||
ansible_zabbix_auth_key: "{{ zabbix_auth_key }}"
|
||||
ansible_network_os: "{{ zabbix_network_os }}"
|
||||
ansible_connection: "{{ zabbix_connection }}"
|
||||
ansible_httpapi_port: "{{ zabbix_httpapi_port }}"
|
||||
ansible_httpapi_use_ssl: "{{ zabbix_httpapi_use_ssl }}"
|
||||
ansible_httpapi_validate_certs: "{{ zabbix_httpapi_validate_certs }}"
|
||||
ansible_host: "{{ zabbix_server }}"
|
||||
ansible_zabbix_url_path: "{{ zabbix_url_path }}"
|
||||
tags:
|
||||
- zabbix_configuration
|
||||
block:
|
||||
- name: Create an infra Zabbix user for Matrix triggers
|
||||
community.zabbix.zabbix_user:
|
||||
username: matrix-bot
|
||||
name: Matrix
|
||||
surname: Bot
|
||||
role_name: Super admin role # needed to allow notifications without lots of config around usergroups
|
||||
usrgrps:
|
||||
- Zabbix administrators
|
||||
passwd: "{{ (env == 'staging') | ternary(zabbix_stg_botuser_pwd, zabbix_botuser_pwd) }}"
|
||||
user_medias:
|
||||
- mediatype: Matrix
|
||||
sendto: "{{ (env == 'staging') | ternary(zabbix_stg_matrix_roomid, zabbix_matrix_roomid) }}"
|
||||
period: 1-7,00:00-24:00
|
||||
severity:
|
||||
not_classified: yes
|
||||
information: yes
|
||||
warning: yes
|
||||
average: yes
|
||||
high: yes
|
||||
disaster: yes
|
||||
active: yes
|
||||
state: present
|
||||
tags:
|
||||
- zabbix_users
|
||||
|
||||
- name: Send infra alerts to Matrix
|
||||
community.zabbix.zabbix_action:
|
||||
name: "Send alerts to Matrix"
|
||||
event_source: "trigger"
|
||||
state: present
|
||||
status: enabled
|
||||
esc_period: 1m
|
||||
conditions:
|
||||
- type: "trigger_severity"
|
||||
operator: ">="
|
||||
value: "Average"
|
||||
operations:
|
||||
- type: send_message
|
||||
media_type: "Matrix"
|
||||
send_to_users:
|
||||
- "matrix-bot"
|
||||
recovery_operations:
|
||||
- type: send_message
|
||||
media_type: "Matrix"
|
||||
send_to_users:
|
||||
- "matrix-bot"
|
||||
tags:
|
||||
- zabbix_users
|
||||
- zabbix_triggers
|
||||
|
||||
- name: Create a Copr Zabbix user for Matrix triggers
|
||||
community.zabbix.zabbix_user:
|
||||
username: matrix-bot-copr
|
||||
name: Matrix
|
||||
surname: Bot
|
||||
role_name: Super admin role # needed to allow notifications without lots of config around usergroups
|
||||
usrgrps:
|
||||
- Zabbix administrators
|
||||
passwd: "{{ (env == 'staging') | ternary(zabbix_stg_botuser_pwd, zabbix_botuser_pwd) }}"
|
||||
user_medias:
|
||||
- mediatype: Matrix
|
||||
sendto: "!rALCnapvdNTxUTuENl:matrix.org" # both prod and stg to #buildsys
|
||||
period: 1-7,00:00-24:00
|
||||
severity:
|
||||
not_classified: yes
|
||||
information: yes
|
||||
warning: yes
|
||||
average: yes
|
||||
high: yes
|
||||
disaster: yes
|
||||
active: yes
|
||||
state: present
|
||||
tags:
|
||||
- zabbix_users
|
||||
|
||||
- name: Send COPR alerts to Matrix
|
||||
community.zabbix.zabbix_action:
|
||||
name: "Send COPR alerts to Matrix"
|
||||
event_source: "trigger"
|
||||
state: present
|
||||
status: enabled
|
||||
esc_period: 1m
|
||||
conditions:
|
||||
- type: "host_group"
|
||||
operator: "equals"
|
||||
value: "Copr_all_instances_aws"
|
||||
- type: "host_group"
|
||||
operator: "equals"
|
||||
value: "Copr_hypervisor"
|
||||
operations:
|
||||
- type: send_message
|
||||
media_type: "Matrix"
|
||||
send_to_users:
|
||||
- "matrix-bot-copr"
|
||||
recovery_operations:
|
||||
- type: send_message
|
||||
media_type: "Matrix"
|
||||
send_to_users:
|
||||
- "matrix-bot-copr"
|
||||
tags:
|
||||
- zabbix_users
|
||||
- zabbix_triggers
|
||||
Loading…
Add table
Add a link
Reference in a new issue